Compare commits

..

170 Commits

Author SHA1 Message Date
David Kohler
75f6368f2c Merge pull request #125 from jwdeveloper/develop-1.10.3
Change websocket connection logic!
2025-05-10 22:06:35 -04:00
kohlerpop1
b9eb0eba93 Removal of debug print statements! 2025-05-04 21:59:22 -04:00
GitHub Action
50d6d6e515 Update version in pom.xml 2025-04-25 21:00:20 +00:00
kohlerpop1
42f9fe360b Removal of debug print statements! 2025-04-25 16:58:24 -04:00
GitHub Action
dff226740c Update version in pom.xml 2025-04-25 19:42:02 +00:00
David Kohler
951d30e6a7 Merge pull request #124 from jwdeveloper/develop-1.10.1
Add additional helper methods back to TikTokLinkMicBattleEvent!
2025-04-25 15:40:08 -04:00
kohlerpop1
1df912b722 Add additional helper methods back to TikTokLinkMicBattleEvent! 2025-04-25 15:37:22 -04:00
GitHub Action
4aec20cc35 Update version in pom.xml 2025-04-17 21:47:42 +00:00
kohlerpop1
d877d38db6 MINOR 2025-04-17 17:45:25 -04:00
David Kohler
db199e9a64 MINOR 2025-04-17 17:39:03 -04:00
David Kohler
1c56cf35f0 MINOR 2025-04-17 17:33:10 -04:00
David Kohler
225cb2df11 Merge pull request #123 from jwdeveloper/develop-1.10.0
Adapt everything to newly updated proto and fix all mappings for those events
2025-04-17 17:32:17 -04:00
kohlerpop1
1cc8a5af1b Adapt everything to newly updated proto and fix all mappings for those events. 2025-04-16 22:25:22 -04:00
GitHub Action
edefd0c1fd Update version in pom.xml 2025-02-19 19:16:59 +00:00
David Kohler
07a28e2632 Update README.md 2025-02-19 14:15:01 -05:00
David Kohler
cc811f6c0a Merge pull request #121 from jwdeveloper/develop-1.9.2
Updates to Priority Order and Preconnection logic and Recording Cancellation!
2025-02-19 14:13:30 -05:00
kohlerpop1
735bdfbb10 Clarify Priority calling order
Altered pre-connection logic to make reason settable
Optionally cancel connection if recorder is used and fails to find record url!
2025-02-19 13:18:25 -05:00
GitHub Action
28ef3562b6 Update version in pom.xml 2025-02-15 00:52:55 +00:00
David Kohler
3b6b381e31 Update README.md 2025-02-14 19:51:18 -05:00
David Kohler
86a79d687e Merge pull request #120 from jwdeveloper/develop-1.9.1
Fix clientParams and send cookies when present and not null to specific requests for 18+ livestreams.
2025-02-14 19:50:34 -05:00
kohlerpop1
65a651d4b8 Fix clientParams and send cookies when present and not null to specific requests for 18+ livestreams. 2025-02-14 19:44:32 -05:00
GitHub Action
8bda5d789c Update version in pom.xml 2025-02-11 22:09:28 +00:00
David Kohler
81fb2b4576 MINOR 2025-02-11 17:07:56 -05:00
David Kohler
64b2e74d2b Update README.md 2025-02-11 17:06:36 -05:00
David Kohler
8a1f3255d0 Merge pull request #119 from jwdeveloper/develop-1.9.0
Develop 1.9.0
2025-02-11 17:06:10 -05:00
kohlerpop1
03892390fa Optimize for loop! 2025-02-11 16:39:44 -05:00
kohlerpop1
71602d5513 Updates for example gifts classes! 2025-02-11 16:36:20 -05:00
kohlerpop1
20db7cb773 Removal of deprecated methods and addition of information in TikTokLiveUnknownHostException and TikTokLiveOfflineHostException! 2025-02-11 16:34:27 -05:00
GitHub Action
3fda7fe446 Update version in pom.xml 2025-02-11 04:35:54 +00:00
David Kohler
8fcbb4b20f Update README.md 2025-02-10 23:33:40 -05:00
David Kohler
d90ab60e52 Merge pull request #118 from jwdeveloper/develop-1.8.14
Add signature to user class and remove no longer UUC param!
2025-02-10 23:32:51 -05:00
kohlerpop1
33f9862758 Add signature to user class and remove no longer UUC param! 2025-02-10 23:32:11 -05:00
GitHub Action
d74c294323 Update version in pom.xml 2024-12-24 03:44:34 +00:00
David Kohler
31f0e4210d Update README.md 2024-12-23 22:42:53 -05:00
David Kohler
2e22da1fbe Merge pull request #115 from jwdeveloper/develop-1.8.13
Develop 1.8.13
2024-12-23 22:41:01 -05:00
kohlerpop1
4b4874d33e Update bytes required for ping task! 2024-12-23 22:17:27 -05:00
kohlerpop1
9c7b24f33e Add settings for allowing proxies to be used for working through Websockets. 2024-12-23 22:16:49 -05:00
kohlerpop1
7476a11ae0 Optimized TikTokLinkMicBattleEvent and added helper methods! 2024-12-23 22:14:55 -05:00
GitHub Action
125e421ea9 Update version in pom.xml 2024-12-19 18:48:50 +00:00
David Kohler
5d84e28bdb Merge pull request #114 from jwdeveloper/develop-1.8.12
Develop 1.8.12
2024-12-19 13:47:09 -05:00
kohlerpop1
a9003f4296 Add details to Disconnect events, removed unused imports, and not needed blank lines! 2024-12-10 19:25:20 -05:00
kohlerpop1
8cd640f8eb Converted list of teams to just 2 teams as we know the size is always 2 and updated methods accordingly. 2024-12-03 09:43:17 -05:00
kohlerpop1
ca741ed931 Add helper methods to get TikTokLinkMicBattleEvent teams by battleHostName! 2024-12-02 23:46:16 -05:00
GitHub Action
96872e27b5 Update version in pom.xml 2024-11-29 02:20:32 +00:00
David Kohler
f6fbd60eca Merge pull request #112 from jwdeveloper/develop-1.8.11
Develop 1.8.11
2024-11-28 21:18:46 -05:00
kohlerpop1
437335f784 Should be _session_id not just session_id. Maybe this will fix stream disconnections! 2024-11-25 20:11:23 -05:00
kohlerpop1
84b0a3aaf4 Add equals and hashCode to picture for easier comparison. 2024-11-24 00:18:34 -05:00
kohlerpop1
14bf9c8c9b Removal of blank spaces and unused imports/dependencies
Optimize picture download memory usage and add option to convert to unsigned url
Convert response data classes to final and add toString with `@Data`
Made sending requests dynamic by allowing passing of BodyHandler to class
2024-11-22 22:31:23 -05:00
GitHub Action
2dc3001e7b Update version in pom.xml 2024-11-10 02:04:46 +00:00
David Kohler
29a81f4cd6 Merge pull request #111 from Naimadx123/master
Downgrade protobuf-java version from 4.28.3 to 4.26.1 in pom.xml files.
2024-11-09 21:03:09 -05:00
Naimadx123
70fd174a95 Downgrade protobuf-java version from 4.28.3 to 4.26.1 in pom.xml files. 2024-11-09 23:10:24 +01:00
GitHub Action
3e23e5b939 Update version in pom.xml 2024-11-09 21:34:57 +00:00
kohlerpop1
733e72f814 Update version in pom! 2024-11-09 16:32:42 -05:00
kohlerpop1
838728d47d Update version in pom! 2024-11-09 16:30:11 -05:00
David Kohler
fd6158410a Update pom.xml 2024-11-09 16:27:19 -05:00
David Kohler
6c56a96ba8 Merge pull request #110 from Naimadx123/master
Copyright year update and jitpack.yml maven version update
2024-11-09 16:19:45 -05:00
Naimad
bb5659574c Merge branch 'jwdeveloper:master' into master 2024-11-09 22:14:45 +01:00
Naimadx123
286da42e54 Copyright year update and jitpack.yml maven version update 2024-11-09 22:14:09 +01:00
GitHub Action
3d0b9ddcc0 Update version in pom.xml 2024-11-09 17:04:46 +00:00
David Kohler
354c072833 Merge pull request #109 from Naimadx123/master
Refactor protobuf import from GeneratedMessageV3 to GeneratedMessage
2024-11-09 12:02:51 -05:00
Naimadx123
f85f24a5c8 Refactor protobuf import from GeneratedMessageV3 to GeneratedMessage 2024-11-09 17:20:04 +01:00
Jacek W
2550a462f9 Merge pull request #108 from Naimadx123/master
Update protobuf-java version and apply updated copyright licenses to …
2024-11-09 14:39:22 +01:00
Naimadx123
eb7b977d62 Update header path in pom.xml to use relative path for license.txt 2024-11-09 14:16:37 +01:00
Naimadx123
1c2c701be0 Update protobuf-java version and apply updated copyright licenses to all Java files. 2024-11-08 22:08:53 +01:00
GitHub Action
a2303f1fde Update version in pom.xml 2024-10-28 00:34:41 +00:00
Jacek W
a8ac0f6fff Update maven-publish.yml 2024-10-28 01:32:58 +01:00
David Kohler
732eda3d22 Merge pull request #106 from jwdeveloper/develop-1.8.6
Develop 1.8.6
2024-10-27 20:28:59 -04:00
kohlerpop1
358954984b Deprecate the usage of github gifts json! 2024-10-18 14:14:36 -04:00
kohlerpop1
acb13ea58a Removal of examples using Deprecated TikTokEventListener pt 2! 2024-10-17 21:51:07 -04:00
kohlerpop1
e8129862d1 Removal of examples using Deprecated TikTokEventListener! 2024-10-17 21:48:42 -04:00
kohlerpop1
88e36e7e90 Add settings as parameter to TikTokLiveRecorderStartedEvent! 2024-10-17 21:10:08 -04:00
kohlerpop1
eef9d43d01 Added TikTokLiveRecorderEndedEvent and updated RecorderListener to use CompletableFuture and a cancellation token! 2024-10-17 16:53:00 -04:00
kohlerpop1
75f3896a86 Merge branch 'master' into develop-1.8.6 2024-10-11 14:18:38 -04:00
Jacek W
e679ff23b7 Update README.md 2024-10-11 19:27:58 +02:00
kohlerpop1
e6211e69c5 Removed implements TikTokEventListener from TikTokEventListenerBase
Added current viewers to TikTokRoomInfoEventHandler
2024-10-09 18:06:28 -04:00
kohlerpop1
1b3ee24aea Add STREAM_SUSPENDED proto and use it to fire stream ended event! 2024-10-08 21:41:04 -04:00
GitHub Action
c9309ee2cf Update version in pom.xml 2024-09-02 14:51:14 +00:00
Jacek W
a28df44cee Merge pull request #101 from kMagic142/master
replaced asList() method call to old fashioned iteration
2024-09-02 16:49:29 +02:00
kMagic142
ee866762a3 replaced asList() method call to old fashioned iteration to avoid gson errors 2024-09-01 02:30:15 +03:00
GitHub Action
3cb7c83ef4 Update version in pom.xml 2024-08-23 07:25:27 +00:00
Jacek W
bf755bcb89 Merge pull request #98 from lulajax/fix-issue-97
adjust the position of the followingCount and followers
2024-08-23 09:23:49 +02:00
lujunjie
20bb05e527 adjust the position of the followingCount and followers 2024-08-23 15:13:53 +08:00
Jacek W
d5a3213ad8 Update README.md 2024-08-20 20:47:17 +02:00
Jacek W
7e496373ef Update README.md 2024-08-20 20:47:00 +02:00
GitHub Action
1f3c1c7d41 Update version in pom.xml 2024-07-31 02:47:35 +00:00
David Kohler
c160259863 Merge pull request #94 from jwdeveloper/develop-1.8.5
Develop 1.8.5
2024-07-30 22:45:49 -04:00
kohlerpop1
fb458e7e7d Rename pinging-task to heartbeat-task! 2024-07-30 20:36:45 -04:00
kohlerpop1
5f5ada312a Renamed PingTask to HeartbeatTask to reflect discovered byte array of TikTok's custom heartbeat value 2024-07-30 16:09:50 -04:00
GitHub Action
cb20c3dd3a Update version in pom.xml 2024-07-27 23:20:36 +00:00
David Kohler
bf42f65b3d Merge pull request #93 from jwdeveloper/develop-1.8.4
Added User instance to LiveUserDataMapper Response to access the retrieved user
2024-07-27 19:18:58 -04:00
kohlerpop1
05e18ef8e0 Added User instance to LiveUserDataMapper Response to access the retrieved user. 2024-07-27 13:02:31 -04:00
GitHub Action
0f6ee58d7f Update version in pom.xml 2024-07-21 17:03:47 +00:00
Jacek W
511759960d Merge pull request #91 from jwdeveloper/develop-1.8.3
- fix tests
2024-07-21 19:02:02 +02:00
JW
617d1c381a - fix tests 2024-07-21 19:01:11 +02:00
Jacek W
6f8b4698cd Merge pull request #90 from jwdeveloper/develop-1.8.3
Develop 1.8.3
2024-07-21 18:56:48 +02:00
JW
2bc1993ea5 - Create of methods for more events
- User.name was empty in testing event
- Add `onConnecting` to builder
2024-07-21 12:08:27 +02:00
kohlerpop1
3d4a517adb Removal of TikTokRoomDataResponseEvent.java as its included in TikTokPreConnectionEvent.java
Added ListUser#toString
Changed TikTokLiveHttpClient.getStartingPayload and TikTokLiveHttpClient.getByteResponse to protected
Altered DownloadData to be dynamic to declare request values or append them instead!
2024-07-18 17:41:27 -04:00
GitHub Action
ee0b559758 Update version in pom.xml 2024-07-06 15:26:51 +00:00
GitHub Action
1c9573dc39 Update version in pom.xml 2024-07-06 15:13:34 +00:00
Jacek W
5b17c33236 Merge pull request #89 from jwdeveloper/develop-1.8.2
Develop 1.8.2
2024-07-06 17:12:01 +02:00
kohlerpop1
b59373254c Make TikTokLinkMicBattleEvent.is1v1 and is2v2 dynamic based upon team instance
Moved Team1v1 and Team2v2 totalPoints to Team for universal access
2024-07-05 16:21:42 -04:00
jacek.wolniewicz
5524d9f8c4 -- tests improvement 2024-07-05 13:23:56 +02:00
jacek.wolniewicz
aa56f8eaea -- tests improvement 2024-07-05 13:21:59 +02:00
jacek.wolniewicz
e40bde8e7c - clean up code
- rename module Example to examples
2024-07-04 17:40:22 +02:00
jacek.wolniewicz
b769eb9c1f Merge remote-tracking branch 'origin/develop-1.8.2' into develop-1.8.2 2024-07-04 11:52:26 +02:00
jacek.wolniewicz
3e555a502a - add comments next to magic numbers 2024-07-04 11:51:45 +02:00
kohlerpop1
316868818b Renamed Priority.priorityValue to value to follow enum standards
Clarified message in TikTokEventListener
2024-07-03 21:04:44 -04:00
jacek.wolniewicz
36475c2cf6 - change method name from onMapping, to mappings 2024-07-04 00:00:26 +02:00
jacek.wolniewicz
2dbe81278c Merge branch 'refs/heads/master' into develop-1.8.2 2024-07-03 23:45:11 +02:00
jacek.wolniewicz
91fc32b20b Improvement on the ListenersManager 2024-07-03 23:43:23 +02:00
jacek.wolniewicz
fa855fa3aa Improvement on the ListenersManager 2024-07-03 23:40:48 +02:00
jacek.wolniewicz
cfea12dacc Remove descrabble 2024-07-03 22:37:40 +02:00
Jacek W
16cd819aaf Merge pull request #88 from jwdeveloper/develop-1.8.1
Develop 1.8.1
2024-07-03 22:30:18 +02:00
jacek.wolniewicz
290a4970fd Improvement of Listener 2024-07-03 22:29:11 +02:00
jacek.wolniewicz
660cb287e9 Improvement of Listener 2024-07-03 22:27:15 +02:00
kohlerpop1
f5de7720cd Created TikTokLiveUnknownHostException for use inside of TikTokLiveClient! 2024-07-03 14:24:37 -04:00
kohlerpop1
f986efd2d5 Only fetch gifts if no exceptions are thrown to prevent spam to TikTok 2024-07-02 22:08:02 -04:00
kohlerpop1
1054453451 Change parameter names for clarification! 2024-07-02 17:50:37 -04:00
kohlerpop1
7005f58edd Fixed spelling mistake! 2024-07-01 17:38:02 -04:00
jacek.wolniewicz
63672fe9eb - updating customizaton example 2024-07-01 23:32:33 +02:00
jacek.wolniewicz
fed9de3fd0 Due to convention, interfaces should not have TikTok name inside, but they should have prefix Live instead
- rename TikTokMapper to LiveMapper
- rename TikTokLiveMapperHelper to LiveMapperHelper

Create interface:
LiveEventsHandler for TikTokLiveEventHandler
LiveMessagesHandler for TikTokLiveMessageHandler
2024-07-01 23:28:38 +02:00
kohlerpop1
b223651a8f Fixed injection type issue. 2024-07-01 17:22:23 -04:00
kohlerpop1
8d715d4f50 Added javadocs for clarity
Optimized methods in TikTokGiftEventHandler and TikTokGenericEventMapper
2024-07-01 17:02:08 -04:00
jacek.wolniewicz
1736236ccf Due to convention, interfaces should not have TikTok name inside, but they should have prefix Live instead
- rename TikTokMapper to LiveMapper
- rename TikTokLiveMapperHelper to LiveMapperHelper

Create interface:
LiveEventsHandler for TikTokLiveEventHandler
LiveMessagesHandler for TikTokLiveMessageHandler
2024-07-01 22:19:07 +02:00
jacek.wolniewicz
85d99ce4f1 TikTokLive client sevices customization 2024-07-01 21:57:07 +02:00
jacek.wolniewicz
87727070e9 Move all events documentation to the 'EventsBuilder' 2024-07-01 21:33:04 +02:00
jacek.wolniewicz
71f744cf49 Merge remote-tracking branch 'origin/develop-1.8.1' into develop-1.8.1 2024-07-01 21:26:10 +02:00
jacek.wolniewicz
046d5f1756 Simplify adding events to TikTok Builder,
checkout `EventsBuilder`
2024-07-01 21:25:30 +02:00
kohlerpop1
c36b0f1f62 Fixed spelling mistake! 2024-07-01 15:04:05 -04:00
GitHub Action
a2082ebee3 Update version in pom.xml 2024-07-01 00:35:28 +00:00
David Kohler
412c72c119 MINOR 2024-06-30 20:33:51 -04:00
GitHub Action
6728fd9963 Update version in pom.xml 2024-07-01 00:32:46 +00:00
David Kohler
47493d4955 MINOR - Develop 1.8
Develop 1.8
2024-06-30 20:30:54 -04:00
jacek.wolniewicz
4d4317d96c Clean up code 2024-06-30 07:28:50 +02:00
jacek.wolniewicz
b1954a708c Fix issue: no events where triggered 2024-06-30 06:59:26 +02:00
kohlerpop1
14317337e9 Optimized TikTokLiveEventHandler 2024-06-29 23:57:53 -04:00
kohlerpop1
947c9c49a2 Improve addProxy(String addressPort) in ProxyClientSettings
Added @param action description and return values
Optimized methods in TikTokLiveMapper
Optimized Thread in TikTokWebSocketPingingTask
Optimized TikTokLiveEventHandler and TikTokLiveMessageHandler methods
2024-06-29 23:28:49 -04:00
jacek.wolniewicz
f2bd07377b Introduce dependecy injection container
- TikTokLiveClientBuilder this class has been higly modify to support DI container
2024-06-29 23:23:48 +02:00
jacek.wolniewicz
3f268f3a1a Introduce dependecy injection container
- TikTokLiveClientBuilder this class has been higly modify to support DI container
2024-06-29 23:12:24 +02:00
jacek.wolniewicz
55fcf83870 Introduce dependecy injection container
- TikTokLiveClientBuilder this class has been higly modify to support DI container
2024-06-29 23:07:50 +02:00
jacek.wolniewicz
8d3828cca8 Introduce dependecy injection container
- TikTokLiveClientBuilder this class has been higly modify to support DI container
2024-06-29 23:04:53 +02:00
jacek.wolniewicz
1c88491b8c Merge branch 'refs/heads/dev-dependecy-injection' into develop-1.7.3
# Conflicts:
#	API/src/main/java/io/github/jwdeveloper/tiktok/data/settings/ProxyClientSettings.java
#	Client/src/main/java/io/github/jwdeveloper/tiktok/TikTokLiveClientBuilder.java
2024-06-29 22:57:56 +02:00
jacek.wolniewicz
47b050d0ba Introduce dependecy injection container
- TikTokLiveClientBuilder this class has been higly modify to support DI container
2024-06-29 22:52:39 +02:00
kohlerpop1
cfef082d3b Updated ProxyData exceptions to include previous exception to finish stacktrace
Updated LiveUserData.Request to throw an IllegalArgumentException when a null or blank username is provided
Updated HttpClientSettings to use setProxyClientSettings instead of direct access
Fixed ProxyRotation bug starting at index 1 instead of 0 and made methods default to synchronized in case concurrency is used in implementors code
Changed HttpClient#toUrl to toUri
Added @Getter to HttpClientFactory for liveClientSettings
Added consumer to TikTokLive#requests so that way proxies can be used when calling the fetch methods
Changed LiveUserData.Response#startTime to clarify the variable name
2024-06-28 23:07:10 -04:00
GitHub Action
34ddc74189 Update version in pom.xml 2024-06-24 14:16:40 +00:00
Jacek W
9a66d240bc Merge pull request #85 from jwdeveloper/develop-1.7.2
Develop 1.7.2
2024-06-24 08:38:22 +02:00
kohlerpop1
d825803187 Added while loop condition so it does not exit when getConnectionState returns Disconnected and stopOnDisconnect is false! 2024-06-23 23:06:05 -04:00
kohlerpop1
77c9cd6b52 Converted Consumer to BiConsumer to also accept liveClient! 2024-06-20 16:51:42 -04:00
kohlerpop1
0329d3cfeb Removed useless imports and altered logger message! 2024-06-18 22:01:47 -04:00
kohlerpop1
26659bb37d Removed not needed/used RecorderSettings#startOnConnected 2024-06-18 15:36:03 -04:00
kohlerpop1
0b9852c4d4 Moved ActionResult#message to top of toJson() for easier reading
Change Recording settings to accept an output file instead of directory and filename
2024-06-18 15:21:05 -04:00
GitHub Action
31618a16ba Update version in pom.xml 2024-06-07 10:55:14 +00:00
GitHub Action
243791f6b8 Update version in pom.xml 2024-06-02 20:11:19 +00:00
David Kohler
4f74a0f1b7 MINOR 2024-06-02 16:09:45 -04:00
GitHub Action
d1eec34fca Update version in pom.xml 2024-06-02 20:07:58 +00:00
David Kohler
82196ef8e3 MINOR: Merge pull request #84 from jwdeveloper/develop-1.6.4
Develop 1.6.4
2024-06-02 16:06:24 -04:00
kohlerpop1
8685d96ccf Moved roomId declaration to RoomInfoEvent as it is always null during onConnecting event!
Made other improvements for readability and altered createdAt field.
2024-06-01 22:36:43 -04:00
kohlerpop1
69f1d5b5c2 Fixed proto file type names, created TikTokEventListenerBase with all events, created ListUser with additional information, and created all events for TikTokLink individual events 2024-06-01 22:18:43 -04:00
kohlerpop1
6f322b2a46 Fixed custom listener manager checks. Previous implementation allowed incorrect parameter types! 2024-05-29 15:38:06 -04:00
kohlerpop1
73c4c09ea1 Moved ActionResult message above content to make it easier to read in json print out!
Added status code 420 for IP cloudflare block
2024-05-29 14:11:27 -04:00
kohlerpop1
95e357af92 Updated HTTP response code messages
General optimization of classes and removal of no longer needed classes
Removed unused imports
2024-05-29 14:00:20 -04:00
Jacek W
6b31ec7d80 Merge pull request #80 from htliang128/master
Update of Socks Proxy adding headers
2024-05-26 22:46:43 +02:00
htliang128
919554bbc8 Update of Socks Proxy adding headers 2024-05-25 12:22:31 +08:00
htliang128
bd0a1f0d01 Update of Socks Proxy adding headers 2024-05-25 12:20:57 +08:00
htliang128
f48479a92c Update of Socks Proxy adding headers 2024-05-25 12:17:46 +08:00
GitHub Action
68a86f3dbd Update version in pom.xml 2024-05-24 01:34:38 +00:00
David Kohler
c3a7a27948 Merge pull request #78 from jwdeveloper/develop-1.6.3
Develop-1.6.3
2024-05-23 21:31:48 -04:00
kohlerpop1
af52e15a45 Removal of shared cookie parameter cookie in TikTokWebSocketClient!
Privatized objects in HttpClientSettings so getters are used!
2024-05-23 21:29:03 -04:00
GitHub Action
5577df7c9c Update version in pom.xml 2024-05-23 22:45:49 +00:00
David Kohler
2c68fe3421 Merge pull request #77 from jwdeveloper/develop-1.6.2
Develop 1.6.2
2024-05-23 18:42:15 -04:00
260 changed files with 6452 additions and 4220 deletions

View File

@@ -46,14 +46,14 @@ jobs:
run: mkdir staging && cp Client/target/Client-${{steps.version.outputs.version_tag}}-all.jar staging
- name: 5 set up a cache for maven
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{runner.os}}-m2-${{hashFiles('**/pom.xml')}}
restore-keys: ${{runner.os}}-m2
- name: 7 Create Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: ${{ steps.version.outputs.version_tag }}
path: staging

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<version>1.6.1-Release</version>
<version>1.10.2-Release</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>API</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.24.1</version>
<version>4.26.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -51,6 +51,7 @@
</goals>
<configuration>
<includeMavenTypes>direct</includeMavenTypes>
<protocVersion>4.26.1</protocVersion>
<inputDirectories>
<include>src/main/proto</include>
</inputDirectories>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,18 +20,22 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.models;
package io.github.jwdeveloper.tiktok.annotations;
import lombok.Value;
/**
ORDER -
* HIGHEST 1st,
* HIGH 2nd,
* NORMAL 3rd,
* LOW 4th,
* LOWEST 5th
*/
public enum Priority {
LOWEST(2), LOW(1), NORMAL(0), HIGH(-1), HIGHEST(-2);
@Value
public class EnumValue
{
public int value;
public String name;
public final int value;
public static EnumValue Map(Enum<?> _enum)
{
return new EnumValue(_enum.ordinal() ,_enum.name());
Priority(int value) {
this.value = value;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -28,5 +28,14 @@ import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.RUNTIME)
public @interface TikTokEventObserver
{
/**
* When more than one method listen for certain Event, you can specify the method priority
* @see Priority
*/
Priority priority() default Priority.NORMAL;
/**
* When true, action is invoked on a thread, from the threads pool
*/
boolean async() default false;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -50,16 +50,12 @@ public class ProxyData
return new ProxyData(address, port);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Port must be a valid integer!");
throw new IllegalArgumentException("Port must be a valid integer!", e);
} catch (UnknownHostException e) {
throw new IllegalArgumentException("Address must be valid IPv4, IPv6, or domain name!");
throw new IllegalArgumentException("Address must be valid IPv4, IPv6, or domain name!", e);
}
}
public ProxyData clone() {
return new ProxyData(address, port);
}
public InetSocketAddress toSocketAddress() {
return new InetSocketAddress(address, port);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -38,8 +38,7 @@ public class TikTokBarrageEvent extends TikTokHeaderEvent {
private final Picture rightIcon;
private final String eventName;
private final int duration;
private BarrageParam barrageParam;
private final BarrageParam barrageParam;
public TikTokBarrageEvent(WebcastBarrageMessage msg) {
super(msg.getCommon());
@@ -49,6 +48,5 @@ public class TikTokBarrageEvent extends TikTokHeaderEvent {
rightIcon = Picture.map(msg.getRightIcon());
duration = msg.getDuration();
barrageParam = BarrageParam.map(msg);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,25 +22,36 @@
*/
package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastCaptionMessage;
import lombok.Value;
import java.util.*;
@Value
@EventMeta(eventType = EventType.Message)
public class TikTokCaptionEvent extends TikTokHeaderEvent {
Long captionTimeStamp;
String iSOLanguage;
String text;
List<CaptionContent> contents;
public TikTokCaptionEvent(WebcastCaptionMessage msg) {
super(msg.getCommon());
captionTimeStamp = msg.getTimeStamp();
iSOLanguage = msg.getCaptionData().getLanguage();
text = msg.getCaptionData().getText();
super(msg.getCommon());
captionTimeStamp = msg.getTimestampMs();
contents = new ArrayList<>();
for (WebcastCaptionMessage.CaptionContent captionContent : msg.getContentList())
contents.add(new CaptionContent(captionContent));
}
}
@Value
public static class CaptionContent {
String iSOLanguage;
String text;
public CaptionContent(WebcastCaptionMessage.CaptionContent captionContent) {
this.iSOLanguage = captionContent.getLang();
this.text = captionContent.getContent();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -32,15 +32,13 @@ import lombok.Getter;
import java.util.List;
/**
* Triggered every time a new chat comment arrives.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokCommentEvent extends TikTokHeaderEvent {
private final User user;
private final String text;
private final String getUserLanguage;
private final String userLanguage;
private final User mentionedUser;
private final List<Picture> pictures;
private final boolean visibleToSender;
@@ -50,7 +48,7 @@ public class TikTokCommentEvent extends TikTokHeaderEvent {
user = User.map(msg.getUser(), msg.getUserIdentity());
text = msg.getContent();
visibleToSender = msg.getVisibleToSender();
getUserLanguage = msg.getContentLanguage();
userLanguage = msg.getContentLanguage();
mentionedUser = User.map(msg.getAtUser());
pictures = msg.getEmotesListList().stream().map(e -> Picture.map(e.getEmote().getImage())).toList();
}
@@ -60,10 +58,11 @@ public class TikTokCommentEvent extends TikTokHeaderEvent {
var builder = WebcastChatMessage.newBuilder();
builder.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setNickname(userName)
.setUsername(userName)
.build());
builder.setContentLanguage("en");
builder.setVisibleToSender(true);
builder.setContent(message);
return new TikTokCommentEvent(builder.build());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -25,11 +25,13 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
/**
* Triggered when the connection is successfully established.
*/
@EventMeta(eventType = EventType.Control)
public class TikTokConnectedEvent extends TikTokLiveClientEvent
{
public static TikTokConnectedEvent of()
{
return new TikTokConnectedEvent();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -30,14 +30,10 @@ import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokDetectEvent extends TikTokHeaderEvent {
String language;
private final String language;
public TikTokDetectEvent(WebcastMsgDetectMessage msg) {
super(msg.getCommon());
language = msg.getFromRegion();
}
}
public TikTokDetectEvent(WebcastMsgDetectMessage msg) {
super(msg.getCommon());
language = msg.getFromRegion();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,18 +26,18 @@ import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
import lombok.Getter;
/**
* Triggered when the connection gets disconnected. In that case you can call connect() again to have a reconnect logic.
* Note that you should wait a little bit before attempting a reconnect to to avoid being rate-limited.
*/
@Getter
@EventMeta(eventType = EventType.Control)
public class TikTokDisconnectedEvent extends TikTokLiveClientEvent {
@Getter private final String reason;
private final String reason;
public TikTokDisconnectedEvent(String reason) {
this.reason = reason.isBlank() ? "None" : reason;
}
public TikTokDisconnectedEvent() {
this("None");
public static TikTokDisconnectedEvent of(String reason)
{
return new TikTokDisconnectedEvent(reason);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -36,9 +36,9 @@ import lombok.Value;
@Value
@EventMeta(eventType = EventType.Message)
public class TikTokEnvelopeEvent extends TikTokHeaderEvent {
User user;
public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) {
super(msg.getCommon());
user = User.map(msg.getEnvelopeInfo());
}
}
User user;
public TikTokEnvelopeEvent(WebcastEnvelopeMessage msg) {
super(msg.getCommon());
user = User.map(msg.getEnvelopeInfo());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -25,16 +25,18 @@ package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
import io.github.jwdeveloper.tiktok.exceptions.TikTokLiveException;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* General error event. You should handle this.
*/
@Getter
@AllArgsConstructor
@EventMeta(eventType = EventType.Control)
public class TikTokErrorEvent extends TikTokLiveClientEvent
{
public class TikTokErrorEvent extends TikTokLiveClientEvent {
private final Throwable exception;
public static TikTokErrorEvent of(String message) {
return new TikTokErrorEvent(new TikTokLiveException(message));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -47,9 +47,9 @@ public class TikTokGoalUpdateEvent extends TikTokHeaderEvent {
goalId = msg.getGoal().getId();
description = msg.getGoal().getDescription();
users = msg.getGoal()
.getContributorsListList()
.stream()
.map(u -> new User(u.getUserId(), u.getDisplayId(), Picture.map(u.getAvatar())))
.toList();
.getContributorsList()
.stream()
.map(u -> new User(u.getUserId(), u.getDisplayId(), Picture.map(u.getAvatar())))
.toList();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -34,9 +34,10 @@ import java.util.List;
@EventMeta(eventType = EventType.Message)
public class TikTokIMDeleteEvent extends TikTokHeaderEvent {
List<Long> userIds;
private final List<Long> msgIds, userIds;
public TikTokIMDeleteEvent(WebcastImDeleteMessage msg) {
super(msg.getCommon());
this.msgIds = msg.getDeleteMsgIdsListList();
this.userIds = msg.getDeleteUserIdsListList();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,8 +22,7 @@
*/
package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastInRoomBannerMessage;
import lombok.Getter;
@@ -31,10 +30,10 @@ import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokInRoomBannerEvent extends TikTokHeaderEvent {
private final String json;
private final String json;
public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) {
super(msg.getHeader());
json = msg.getJson();
}
}
public TikTokInRoomBannerEvent(WebcastInRoomBannerMessage msg) {
super(msg.getHeader());
json = msg.getExtraMap().toString();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -33,11 +33,7 @@ import lombok.Getter;
@EventMeta(eventType = EventType.Message)
public class TikTokLinkLayerEvent extends TikTokHeaderEvent {
public TikTokLinkLayerEvent(WebcastLinkLayerMessage msg) {
super(msg.getCommon());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,16 +22,14 @@
*/
package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.LinkMicArmy;
import io.github.jwdeveloper.tiktok.data.models.Picture;
import io.github.jwdeveloper.tiktok.messages.enums.LinkMicBattleStatus;
import io.github.jwdeveloper.tiktok.data.models.*;
import io.github.jwdeveloper.tiktok.messages.enums.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicArmies;
import lombok.Getter;
import java.util.List;
import java.util.*;
/**
* Triggered every time a battle participant receives points. Contains the current status of the battle and the army that suported the group.
@@ -47,13 +45,28 @@ public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent {
private final Picture picture;
private final List<LinkMicArmy> armies;
private final Map<Long, LinkMicArmy> armies;
private final BattleType battleType;
public TikTokLinkMicArmiesEvent(WebcastLinkMicArmies msg) {
super(msg.getCommon());
battleId = msg.getId();
armies = msg.getBattleItemsList().stream().map(LinkMicArmy::new).toList();
picture = Picture.map(msg.getImage());
finished = msg.getBattleStatus() == LinkMicBattleStatus.ARMY_FINISHED;
battleId = msg.getBattleId();
armies = new HashMap<>();
picture = Picture.map(msg.getGifIconImage());
finished = msg.getTriggerReason() == TriggerReason.TRIGGER_REASON_BATTLE_END;
battleType = msg.getBattleSettings().getBattleType();
switch (battleType) {
case BATTLE_TYPE_NORMAL_BATTLE -> // 1v1 | Fields present - armies
msg.getArmiesMap().forEach((aLong, userArmies) -> armies.put(aLong, new LinkMicArmy(userArmies)));
case BATTLE_TYPE_TEAM_BATTLE -> // 2v2 | Fields present - team_armies
msg.getTeamArmiesList().forEach(teamArmy -> armies.put(teamArmy.getTeamId(), new LinkMicArmy(teamArmy.getUserArmies())));
case BATTLE_TYPE_INDIVIDUAL_BATTLE -> // 1v1v1 or 1v1v1v1 | Fields present - team_armies
msg.getTeamArmiesList().forEach(teamArmy -> armies.put(teamArmy.getTeamId(), new LinkMicArmy(teamArmy.getUserArmies())));
case BATTLE_TYPE_1_V_N -> { // 1 vs Many | Have no data for this yet
// Most complicated and uncommon battle type - When more data is collected, this will be updated.
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,12 +24,15 @@ package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.battles.*;
import io.github.jwdeveloper.tiktok.messages.enums.LinkMicBattleStatus;
import io.github.jwdeveloper.tiktok.data.models.battles.Team;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.data.*;
import io.github.jwdeveloper.tiktok.messages.enums.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
import lombok.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Collectors;
/**
* Triggered every time a battle starts & ends
@@ -43,41 +46,118 @@ public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent
true if battle is finished otherwise false
*/
private final boolean finished;
@Getter(AccessLevel.NONE)
private final boolean oneVsOne;
private final List<Team> teams;
private final BattleType battleType;
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
super(msg.getCommon());
battleId = msg.getId();
finished = msg.getBattleStatus() == LinkMicBattleStatus.BATTLE_FINISHED;
battleId = msg.getBattleId();
finished = msg.getAction() == BattleAction.BATTLE_ACTION_FINISH;
battleType = msg.getBattleSetting().getBattleType();
teams = new ArrayList<>();
if (msg.getHostTeamCount() == 2) { // 1v1 battle
teams.add(new Team1v1(msg.getHostTeam(0), msg));
teams.add(new Team1v1(msg.getHostTeam(1), msg));
oneVsOne = true;
} else { // 2v2 battle
if (isFinished()) {
teams.add(new Team2v2(msg.getHostData2V2List().stream().filter(data -> data.getTeamNumber() == 1).findFirst().orElse(null), msg));
teams.add(new Team2v2(msg.getHostData2V2List().stream().filter(data -> data.getTeamNumber() == 2).findFirst().orElse(null), msg));
} else {
teams.add(new Team2v2(msg.getHostTeam(0), msg.getHostTeam(1), msg));
teams.add(new Team2v2(msg.getHostTeam(2), msg.getHostTeam(3), msg));
switch (battleType) {
case BATTLE_TYPE_NORMAL_BATTLE -> { // 1v1 | Fields present - anchor_info, battle_combos
for (Long userId : msg.getAnchorInfoMap().keySet())
teams.add(new Team(msg.getAnchorInfoOrThrow(userId), msg.getBattleCombosOrThrow(userId)));
if (finished) { // Additional fields present - battle_result, armies
for (Team team : teams) {
Long userId = team.getHosts().get(0).getId();
team.setTotalPoints((int) msg.getBattleResultOrThrow(userId).getScore());
team.setViewers(msg.getArmiesOrThrow(userId).getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
}
}
}
case BATTLE_TYPE_TEAM_BATTLE -> { // 2v2 | Fields present - anchor_info
if (finished) { // Additional fields present - team_battle_result, team_armies
for (BattleTeamUserArmies army : msg.getTeamArmiesList()) {
Team team = new Team(army.getTeamId(), army.getTeamUsersList().stream()
.map(BattleTeamUser::getUserId).map(userId -> new User(msg.getAnchorInfoOrThrow(userId).getUser())).toList());
team.setTotalPoints((int) army.getTeamTotalScore());
team.setViewers(army.getUserArmies().getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
teams.add(team);
}
} else { // Additional fields present - team_users
for (WebcastLinkMicBattle.TeamUsersInfo teamUsersInfo : msg.getTeamUsersList())
teams.add(new Team(teamUsersInfo.getTeamId(), teamUsersInfo.getUserIdsList().stream()
.map(userId -> new User(msg.getAnchorInfoOrThrow(userId).getUser())).toList()));
}
}
case BATTLE_TYPE_INDIVIDUAL_BATTLE -> { // 1v1v1 or 1v1v1v1 | Fields present - anchor_info
teams.addAll(msg.getAnchorInfoMap().values().stream().map(Team::new).toList());
if (finished) { // Additional fields present - team_battle_result, team_armies
for (Team team : teams) {
Long userId = team.getHosts().get(0).getId();
BattleTeamUserArmies army = msg.getTeamArmiesList().stream().filter(btua -> btua.getTeamId() == userId).findFirst().orElseThrow();
team.setTotalPoints((int) army.getTeamTotalScore());
team.setViewers(army.getUserArmies().getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore())));
}
}
}
case BATTLE_TYPE_1_V_N -> { // 1 vs Many | Have no data for this yet
// Most complicated and uncommon battle type - When more data is collected, this will be updated.
}
oneVsOne = false;
}
// Info:
// - msg.getDetailsList() & msg.getViewerTeamList() both only have content when battle is finished
// - msg.getDetailsCount() & msg.getViewerTeamCount() always is 2 only when battle is finished
// - msg.getHostTeamCount() always is 2 for 1v1 or 4 for 2v2
}
/** 1 host vs 1 host */
public boolean is1v1() {
return oneVsOne;
return battleType == BattleType.BATTLE_TYPE_NORMAL_BATTLE;
}
/** 2 hosts vs 2 hosts*/
public boolean is2v2() {
return !oneVsOne;
return battleType == BattleType.BATTLE_TYPE_TEAM_BATTLE;
}
/** Up to four users battling each other all on separate teams */
public boolean isIndividual() {
return battleType == BattleType.BATTLE_TYPE_INDIVIDUAL_BATTLE;
}
/** 1 host vs N hosts | N max value unknown */
public boolean isMultiTeam() {
return battleType == BattleType.BATTLE_TYPE_1_V_N;
}
public boolean isTie() {
return isFinished() && isTeamsTie();
}
private boolean isTeamsTie() {
int referencePoints = teams.get(0).getTotalPoints();
return teams.stream().allMatch(team -> team.getTotalPoints() == referencePoints);
}
/**
* @param battleHostName name of host to search
* @return Team instance containing name of host or null if no team found */
public Team getTeam(String battleHostName) {
List<Team> list = getTeams(battleHostName);
return list.isEmpty() ? null : list.get(0);
}
/**
* @param battleHostName name of host to search
* @return Team instances not containing name of host */
public List<Team> getOpponentTeams(String battleHostName) {
List<Team> list = getTeams(battleHostName);
return list.isEmpty() ? null : list;
}
/**
* @param battleHostName name of host to search
* @return {@link List<Team>} with host team first, then opponent teams
* <p> If host is in neither or teams is empty, returns empty
* <p> Otherwise always teams.length in length;
*/
public List<Team> getTeams(String battleHostName) {
if (teams.isEmpty() || teams.stream().noneMatch(team -> team.contains(battleHostName)))
return Collections.EMPTY_LIST;
Team hostTeam = teams.stream().filter(team -> team.contains(battleHostName)).findFirst().orElseThrow();
List<Team> opponentTeams = teams.stream().filter(team -> !team.contains(battleHostName)).toList();
List<Team> teams = new ArrayList<>();
teams.add(hostTeam);
teams.addAll(opponentTeams);
return teams;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -32,10 +32,8 @@ import lombok.Getter;
@EventMeta(eventType = EventType.Message)
public class TikTokLinkMicMethodEvent extends TikTokHeaderEvent {
public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) {
super(msg.getCommon());
public TikTokLinkMicMethodEvent(WebcastLinkMicMethod msg) {
super(msg.getCommon());
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,11 +24,14 @@ package io.github.jwdeveloper.tiktok.data.events;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
import io.github.jwdeveloper.tiktok.data.events.control.TikTokConnectingEvent;
/**
* Triggered when the live stream gets terminated by the host. Will also trigger the TikTokDisconnectedEvent event.
*/
@EventMeta(eventType = EventType.Message)
public class TikTokLiveEndedEvent extends TikTokEvent {
public static TikTokLiveEndedEvent of() {
return new TikTokLiveEndedEvent();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -29,9 +29,7 @@ import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastQuestionNewMessage;
import lombok.Getter;
/*
Triggered every time someone asks a new question via the question feature.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokQuestionEvent extends TikTokHeaderEvent {
@@ -42,9 +40,9 @@ public class TikTokQuestionEvent extends TikTokHeaderEvent {
public TikTokQuestionEvent(WebcastQuestionNewMessage msg) {
super(msg.getCommon());
var data = msg.getDetails();
questionId = data.getId();
text = data.getText();
time = data.getTimeStamp();
questionId = data.getQuestionId();
text = data.getContent();
time = data.getCreateTime();
user = User.map(data.getUser());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -32,15 +32,14 @@ import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokRankTextEvent extends TikTokHeaderEvent {
private final String eventType;
private final String eventType;
private final String label;
private final String label;
public TikTokRankTextEvent(WebcastRankTextMessage msg) {
super(msg.getCommon());
var text = Text.map(msg.getSelfGetBadgeMsg());
label = text.getPattern();
eventType = text.getKey();
}
}
public TikTokRankTextEvent(WebcastRankTextMessage msg) {
super(msg.getCommon());
var text = Text.map(msg.getSelfGetBadgeMsg());
label = text.getPattern();
eventType = text.getKey();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -33,13 +33,11 @@ import lombok.Getter;
@EventMeta(eventType = EventType.Message)
public class TikTokRankUpdateEvent extends TikTokHeaderEvent {
public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) {
super(msg.getCommon());
public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) {
super(msg.getCommon());
}
}
public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) {
super(msg.getCommon());
}
}
public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) {
super(msg.getCommon());
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -32,25 +32,24 @@ import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokShopEvent extends TikTokHeaderEvent {
private final String title;
private final String title;
private final String price;
private final String price;
private final Picture picture;
private final Picture picture;
private final String shopUrl;
private final String shopUrl;
private final String shopName;
private final String shopName;
//Not working
public TikTokShopEvent(WebcastOecLiveShoppingMessage msg) {
super(msg.getCommon());
var data = msg.getShopData();
title = data.getTitle();
price = data.getPriceString();
picture = new Picture(data.getImageUrl());
shopUrl = data.getShopUrl();
shopName = data.getShopName();
}
}
//Not working
public TikTokShopEvent(WebcastOecLiveShoppingMessage msg) {
super(msg.getCommon());
var data = msg.getShopData();
title = data.getTitle();
price = data.getPriceString();
picture = new Picture(data.getImageUrl());
shopUrl = data.getShopUrl();
shopName = data.getShopName();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -31,9 +31,7 @@ import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSubNotifyMessage;
import lombok.Getter;
/**
* Triggers when a user creates a subscription.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokSubscribeEvent extends TikTokHeaderEvent {
@@ -55,8 +53,9 @@ public class TikTokSubscribeEvent extends TikTokHeaderEvent {
public static TikTokSubscribeEvent of(String userName) {
return new TikTokSubscribeEvent(WebcastMemberMessage.newBuilder()
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setUsername(userName)
.setNickname(userName)
.build())
.build());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -35,4 +35,4 @@ public class TikTokUnhandledMemberEvent extends TikTokUnhandledEvent<WebcastMemb
public TikTokUnhandledMemberEvent(WebcastMemberMessage data) {
super(data);
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,9 +26,6 @@ package io.github.jwdeveloper.tiktok.data.events.common;
import io.github.jwdeveloper.tiktok.utils.JsonUtil;
import lombok.Getter;
/**
* Base class for all events
*/
@Getter
public abstract class TikTokEvent {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,7 +22,7 @@
*/
package io.github.jwdeveloper.tiktok.data.events.common;
import io.github.jwdeveloper.tiktok.messages.data.Common;
import io.github.jwdeveloper.tiktok.messages.data.*;
import lombok.Getter;
@Getter
@@ -31,7 +31,7 @@ public class TikTokHeaderEvent extends TikTokEvent {
private final long roomId;
private final long timeStamp;
public TikTokHeaderEvent(Common header) {
public TikTokHeaderEvent(CommonMessageData header) {
this(header.getMsgId(), header.getRoomId(), header.getCreateTime());
}
@@ -46,4 +46,4 @@ public class TikTokHeaderEvent extends TikTokEvent {
roomId = 0;
timeStamp = 0;
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -31,7 +31,9 @@ import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
* Triggered when client is connecting to live is successfully established.
*/
@EventMeta(eventType = EventType.Control)
public class TikTokConnectingEvent extends TikTokLiveClientEvent
{
public class TikTokConnectingEvent extends TikTokLiveClientEvent {
public static TikTokConnectingEvent of() {
return new TikTokConnectingEvent();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -27,18 +27,23 @@ import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
import io.github.jwdeveloper.tiktok.data.requests.*;
import lombok.*;
/**
* Triggered before the connection is established.
*/
@Getter
@EventMeta(eventType = EventType.Control)
public class TikTokPreConnectionEvent extends TikTokLiveClientEvent
{
@Getter private final LiveUserData.Response userData;
@Getter private final LiveData.Response roomData;
@Getter @Setter boolean cancelConnection = false;
private final LiveUserData.Response userData;
private final LiveData.Response roomData;
@Setter boolean cancelConnection = false;
@Setter String reason = "TikTokPreConnectionEvent cancelled connection!";
public TikTokPreConnectionEvent(LiveUserData.Response userData, LiveData.Response liveData) {
this.userData = userData;
this.roomData = liveData;
}
public void setCancelConnection(boolean cancelConnection, String reason) {
this.cancelConnection = cancelConnection;
this.reason = reason;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -29,20 +29,6 @@ import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
import lombok.Getter;
/**
* Triggered every time gift is sent
*
* @see GiftComboStateType it has 3 states
*
* <p>Example when user sends gift with combo</p>
* <p>>Combo: 1 -> comboState = GiftSendType.Begin</p>
* <p>Combo: 4 -> comboState = GiftSendType.Active</p>
* <p>Combo: 8 -> comboState = GiftSendType.Active</p>
* <p>Combo: 12 -> comboState = GiftSendType.Finsihed</p>
* <p>
* Remember if comboState is Finsihed both TikTokGiftComboEvent and TikTokGiftEvent event gets triggered
*/
@EventMeta(eventType = EventType.Message)
@Getter
public class TikTokGiftComboEvent extends TikTokGiftEvent {
@@ -55,12 +41,9 @@ public class TikTokGiftComboEvent extends TikTokGiftEvent {
public static TikTokGiftComboEvent of(Gift gift, int combo, GiftComboStateType comboState) {
return new TikTokGiftComboEvent(
gift,
new User(0L, "Test", new Picture("")),
WebcastGiftMessage
.newBuilder()
.setComboCount(combo)
.build(),
comboState);
gift,
new User(0L, "Test", new Picture("")),
WebcastGiftMessage.newBuilder().setComboCount(combo).build(),
comboState);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,7 +22,6 @@
*/
package io.github.jwdeveloper.tiktok.data.events.gift;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.Picture;
@@ -31,12 +30,6 @@ import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
import lombok.Getter;
/**
* Triggered when user sends gifts that has
* no combo (most of expensive gifts)
* or if combo has finished
*/
@EventMeta(eventType = EventType.Message)
@Getter
public class TikTokGiftEvent extends TikTokHeaderEvent {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkAcceptNoticeEvent extends TikTokLinkEvent {
private final long fromUserId, fromRoomId, toUserId;
public TikTokLinkAcceptNoticeEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasAcceptNoticeContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Accept Notice Content!");
var content = msg.getAcceptNoticeContent();
this.fromUserId = content.getFromUserId();
this.fromRoomId = content.getFromRoomId();
this.toUserId = content.getToUserId();
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkApplyEvent extends TikTokLinkEvent {
public TikTokLinkApplyEvent(WebcastLinkMessage msg) {
super(msg);
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkCancelEvent extends TikTokLinkEvent {
private final long fromUserId, toUserId, cancelType, actionId;
public TikTokLinkCancelEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasCancelContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Cancel Content!");
var content = msg.getCancelContent();
this.fromUserId = content.getFromUserId();
this.toUserId = content.getToUserId();
this.cancelType = content.getCancelType();
this.actionId = content.getActionId();
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkCloseEvent extends TikTokLinkEvent {
public TikTokLinkCloseEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasCloseContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Close Content!");
// Proto Empty
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkCohostListChangeEvent extends TikTokLinkEvent {
public TikTokLinkCohostListChangeEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasCohostListChangeContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Cohost List Change Content!");
// Proto Empty
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkCreateEvent extends TikTokLinkEvent {
private final long hostId, roomId, linkType;
public TikTokLinkCreateEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasCreateContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Create Content!");
var content = msg.getCreateContent();
this.hostId = content.getOwnerId();
this.roomId = content.getOwnerRoomId();
this.linkType = content.getLinkType();
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.users.ListUser;
import io.github.jwdeveloper.tiktok.messages.enums.LinkmicMultiLiveEnum;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkEnterEvent extends TikTokLinkEvent {
private final List<ListUser> listUsers;
private final LinkmicMultiLiveEnum anchorMultiLiveEnum;
public TikTokLinkEnterEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasEnterContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Enter Content!");
var content = msg.getEnterContent();
this.listUsers = content.getLinkedUsersListList().stream().map(ListUser::map).toList();
this.anchorMultiLiveEnum = content.getAnchorMultiLiveEnum();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,24 +20,24 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events;
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkEvent extends TikTokHeaderEvent {
private final String extra, transferExtra;
private final long expireTimestamp;
public TikTokLinkEvent(WebcastLinkMessage msg) {
super(msg.getCommon());
this.extra = msg.getExtra();
this.expireTimestamp = msg.getExpireTimestamp();
this.transferExtra = msg.getTransferExtra();
}
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkInviteEvent extends TikTokLinkEvent {
private final long roomId;
private final User inviter;
public TikTokLinkInviteEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasInviteContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Invite Content!");
var content = msg.getInviteContent();
this.roomId = content.getFromRoomId();
this.inviter = User.map(content.getFromUser());
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkKickOutEvent extends TikTokLinkEvent {
private final long fromUserId;
private final KickOutReason kickOutReason;
public TikTokLinkKickOutEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasKickOutContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Kick Out Content!");
var content = msg.getKickOutContent();
this.fromUserId = content.getFromUserId();
this.kickOutReason = KickOutReason.values()[content.getKickoutReasonValue()];
}
public enum KickOutReason {
KICKOUT_REASON_UNKNOWN,
KICKOUT_REASON_FIRST_FRAME_TIMEOUT,
KICKOUT_REASON_BY_HOST,
KICKOUT_REASON_RTC_LOST_CONNECTION,
KICKOUT_REASON_BY_PUNISH,
KICKOUT_REASON_BY_ADMIN,
KICKOUT_REASON_HOST_REMOVE_ALL_GUESTS
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkLeaveEvent extends TikTokLinkEvent {
private final long userId, sendLeaveUid, leaveReason;
private final String linkmicIdStr;
public TikTokLinkLeaveEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasLeaveContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Leave Content!");
var content = msg.getLeaveContent();
this.userId = content.getUserId();
this.linkmicIdStr = content.getLinkmicIdStr();
this.sendLeaveUid = content.getSendLeaveUid();
this.leaveReason = content.getLeaveReason();
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkLinkedListChangeEvent extends TikTokLinkEvent {
public TikTokLinkLinkedListChangeEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasLinkedListChangeContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Linked List Change Content!");
// Proto Empty
}
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.users.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
import java.util.List;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkListChangeEvent extends TikTokLinkEvent {
private final List<ListUser> linkedUsers, appliedUsers, connectingUsers;
public TikTokLinkListChangeEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasListChangeContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with List Change Content!");
var content = msg.getListChangeContent();
this.linkedUsers = content.getLinkedUsersList().stream().map(ListUser::map).toList();
this.appliedUsers = content.getAppliedUsersList().stream().map(ListUser::map).toList();
this.connectingUsers = content.getConnectingUsersList().stream().map(ListUser::map).toList();
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.enums.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkMediaChangeEvent extends TikTokLinkEvent {
private final GuestMicCameraManageOp op;
private final long toUserId;
private final long anchorId;
private final long roomId;
private final GuestMicCameraChangeScene changeScene;
public TikTokLinkMediaChangeEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasMediaChangeContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Media Change Content!");
var content = msg.getMediaChangeContent();
this.op = content.getOp();
this.toUserId = content.getToUserId();
this.anchorId = content.getAnchorId();
this.roomId = content.getRoomId();
this.changeScene = content.getChangeScene();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -20,24 +20,20 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events;
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import lombok.Data;
@Data
@Getter
@EventMeta(eventType = EventType.Message)
public class CustomEvent extends TikTokHeaderEvent {
private final User user;
private final String title;
public class TikTokLinkMicIdxUpdateEvent extends TikTokLinkEvent {
public CustomEvent(User user, String title) {
this.user = user;
this.title = title;
public TikTokLinkMicIdxUpdateEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasMicIdxUpdateContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Mic Idx Update Content!");
// Proto Empty
}
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.enums.MuteStatus;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkMuteEvent extends TikTokLinkEvent {
private final long userId;
private final MuteStatus status;
public TikTokLinkMuteEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasMuteContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Mute Content!");
var content = msg.getMuteContent();
this.userId = content.getUserId();
this.status = content.getStatus();
}
public boolean isMuted() {
return status == MuteStatus.MUTE_STATUS_MUTE;
}
}

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkRandomMatchEvent extends TikTokLinkEvent {
private final User user;
private final long roomId, inviteType, innerChannelId;
private final String matchId;
public TikTokLinkRandomMatchEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasRandomMatchContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Random Match Content!");
var content = msg.getRandomMatchContent();
this.user = User.map(content.getUser());
this.roomId = content.getRoomId();
this.inviteType = content.getInviteType();
this.matchId = content.getMatchId();
this.innerChannelId = content.getInnerChannelId();
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkReplyEvent extends TikTokLinkEvent {
private final long roomId;
private final User fromUser, toUser;
public TikTokLinkReplyEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasReplyContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Reply Content!");
var content = msg.getReplyContent();
this.roomId = content.getFromRoomId();
this.fromUser = User.map(content.getFromUser());
this.toUser = User.map(content.getToUser());
}
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkSysKickOutEvent extends TikTokLinkEvent {
private final long userId;
private final String linkmicIdStr;
public TikTokLinkSysKickOutEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasSysKickOutContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Sys Kick Out Content!");
var content = msg.getSysKickOutContent();
this.userId = content.getUserId();
this.linkmicIdStr = content.getLinkmicIdStr();
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkUpdateUserEvent extends TikTokLinkEvent {
private final long fromUserId, toUserId;
public TikTokLinkUpdateUserEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasUpdateUserContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with Update User Content!");
var content = msg.getUpdateUserContent();
this.fromUserId = content.getFromUserId();
this.toUserId = content.getToUserId();
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkUpdateUserSettingEvent extends TikTokLinkEvent {
public TikTokLinkUpdateUserSettingEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasUpdateUserSettingContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Update User Setting Content!");
// Proto Empty
}
}

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.models.Text;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkUserToastEvent extends TikTokLinkEvent {
private final long userId, roomId;
private final Text displayText;
public TikTokLinkUserToastEvent(WebcastLinkMessage msg) {
super(msg);
if (!msg.hasUserToastContent())
throw new IllegalArgumentException("Expected WebcastLinkMessage with User Toast Content!");
var content = msg.getUserToastContent();
this.userId = content.getUserId();
this.roomId = content.getRoomId();
this.displayText = Text.map(content.getDisplayText());
}
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.data.events.link;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
import lombok.Getter;
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLinkWaitListChangeEvent extends TikTokLinkEvent {
public TikTokLinkWaitListChangeEvent(WebcastLinkMessage msg) {
super(msg);
// if (!msg.hasWaitingListChangeContent())
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Waiting List Change Content!");
// Proto Empty
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -30,13 +30,11 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/*
Triggered when LiveRoomInfo got updated such as likes, viewers, ranking ....
*/
@Getter
@AllArgsConstructor
@EventMeta(eventType = EventType.Message)
public class TikTokRoomInfoEvent extends TikTokEvent
{
LiveRoomInfo roomInfo;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -33,15 +33,13 @@ import lombok.Getter;
@EventMeta(eventType = EventType.Message)
public class TikTokRoomPinEvent extends TikTokHeaderEvent
{
private final TikTokCommentEvent pinnedMessage;
private final long timestamp;
private TikTokCommentEvent pinnedMessage;
private long timestamp;
public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent)
{
super(msg.getCommon());
this.timestamp = msg.getTimestamp();
this.pinnedMessage = commentEvent;
}
}
public TikTokRoomPinEvent(WebcastRoomPinMessage msg, TikTokCommentEvent commentEvent)
{
super(msg.getCommon());
this.timestamp = msg.getPinTime();
this.pinnedMessage = commentEvent;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,35 +24,30 @@ package io.github.jwdeveloper.tiktok.data.events.social;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.TikTokSubscribeEvent;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Value;
/**
* Triggers when a user follows the streamer. Based on social event.
*/
@Value
@EventMeta(eventType = EventType.Message)
public class TikTokFollowEvent extends TikTokHeaderEvent
{
User user;
int totalFollowers;
public class TikTokFollowEvent extends TikTokHeaderEvent {
User user;
int totalFollowers;
public TikTokFollowEvent(WebcastSocialMessage msg) {
super(msg.getCommon());
user = User.map(msg.getUser());
totalFollowers = msg.getFollowCount();
}
public TikTokFollowEvent(WebcastSocialMessage msg) {
super(msg.getCommon());
user = User.map(msg.getUser());
totalFollowers = msg.getFollowCount();
}
public static TikTokFollowEvent of(String userName)
{
public static TikTokFollowEvent of(String userName) {
return new TikTokFollowEvent(WebcastSocialMessage.newBuilder()
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setUsername(userName)
.setNickname(userName)
.build())
.build());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -26,7 +26,6 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLikeMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastMemberMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
@@ -53,8 +52,9 @@ public class TikTokJoinEvent extends TikTokHeaderEvent {
{
return new TikTokJoinEvent(WebcastMemberMessage.newBuilder()
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setUsername(userName)
.setNickname(userName)
.build())
.build());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -31,9 +31,7 @@ import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
/**
* Triggered when a viewer sends likes to the streamer. For streams with many viewers, this event is not always triggered by TikTok.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokLikeEvent extends TikTokHeaderEvent
@@ -64,8 +62,9 @@ public class TikTokLikeEvent extends TikTokHeaderEvent
.setCount(likes)
.setTotal(likes)
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setUsername(userName)
.setNickname(userName)
.build())
.build());
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,32 +22,37 @@
*/
package io.github.jwdeveloper.tiktok.data.events.social;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
import lombok.Getter;
/**
* Triggers when a user shares the stream. Based on social event.
*/
@Getter
@EventMeta(eventType = EventType.Message)
public class TikTokShareEvent extends TikTokHeaderEvent {
private final User user;
private final int totalShares;
private final User user;
private final int totalShares;
public TikTokShareEvent(WebcastSocialMessage msg, Integer amount) {
super(msg.getCommon());
user = User.map(msg.getUser());
this.totalShares = amount;
}
public TikTokShareEvent(WebcastSocialMessage msg, Integer amount) {
super(msg.getCommon());
user = User.map(msg.getUser());
this.totalShares = amount;
}
public TikTokShareEvent(WebcastSocialMessage msg) {
super(msg.getCommon());
user = User.map(msg.getUser());
totalShares = 1;
}
public TikTokShareEvent(WebcastSocialMessage msg) {
super(msg.getCommon());
user = User.map(msg.getUser());
totalShares = 1;
}
}
public static TikTokShareEvent of(String userName, int shaders) {
return new TikTokShareEvent(WebcastSocialMessage.newBuilder()
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
.setUsername(userName)
.setNickname(userName)
.build())
.build(), shaders);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,23 +22,14 @@
*/
package io.github.jwdeveloper.tiktok.data.events.websocket;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.dto.MessageMetaData;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Value;
import java.time.Duration;
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
import lombok.*;
/**
* Triggered every time TikTok sends data. Data incoming as protobuf message.
* You can deserialize the binary object depending on the use case.
*/
@Getter
@AllArgsConstructor
@EventMeta(eventType = EventType.Debug)
@@ -50,7 +41,7 @@ public class TikTokWebsocketMessageEvent extends TikTokEvent {
* message.payload - Bytes array that contains actual data of message.
* Example of parsing, WebcastGiftMessage giftMessage = WebcastGiftMessage.parseFrom(message.getPayload());
*/
private WebcastResponse.Message message;
private ProtoMessageFetchResult.BaseProtoMessage message;
/*
* TikTokLiveJava event that was created from TikTok message data
@@ -64,4 +55,4 @@ public class TikTokWebsocketMessageEvent extends TikTokEvent {
private MessageMetaData metaData;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -22,17 +22,15 @@
*/
package io.github.jwdeveloper.tiktok.data.events.websocket;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.annotations.*;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import lombok.AllArgsConstructor;
import lombok.Getter;
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
import lombok.*;
@Getter
@AllArgsConstructor
@EventMeta(eventType = EventType.Debug)
public class TikTokWebsocketResponseEvent extends TikTokEvent
{
private WebcastResponse response;
}
private ProtoMessageFetchResult response;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -25,23 +25,19 @@ package io.github.jwdeveloper.tiktok.data.events.websocket;
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
import io.github.jwdeveloper.tiktok.annotations.EventType;
import io.github.jwdeveloper.tiktok.data.events.common.TikTokUnhandledEvent;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
import io.github.jwdeveloper.tiktok.messages.webcast.ProtoMessageFetchResult;
import lombok.Getter;
/**
* Triggered every time a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case.
*/
@Getter
@EventMeta(eventType = EventType.Debug)
public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent<WebcastResponse.Message>
public class TikTokWebsocketUnhandledMessageEvent extends TikTokUnhandledEvent<ProtoMessageFetchResult.BaseProtoMessage>
{
public TikTokWebsocketUnhandledMessageEvent(WebcastResponse.Message data) {
public TikTokWebsocketUnhandledMessageEvent(ProtoMessageFetchResult.BaseProtoMessage data) {
super(data);
}
public WebcastResponse.Message getMessage()
public ProtoMessageFetchResult.BaseProtoMessage getMessage()
{
return this.getData();
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -23,27 +23,21 @@
package io.github.jwdeveloper.tiktok.data.models;
import io.github.jwdeveloper.tiktok.data.models.users.User;
import io.github.jwdeveloper.tiktok.messages.data.LinkMicArmiesItems;
import io.github.jwdeveloper.tiktok.messages.data.BattleUserArmies;
import lombok.Value;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Value
public class LinkMicArmy {
Long armyId;
List<Army> armies;
int totalPoints;
Map<User, Integer> armies;
public LinkMicArmy(LinkMicArmiesItems army) {
armyId = army.getHostUserId();
armies = army.getBattleGroupsList()
.stream()
.map(x -> new Army(x.getUsersList().stream().map(User::map).toList(), x.getPoints()))
.toList();
}
@Value
public static class Army {
List<User> Users;
Integer Points;
public LinkMicArmy(BattleUserArmies userArmies) {
armyId = Long.parseLong(userArmies.getAnchorIdStr());
totalPoints = (int) userArmies.getHostScore();
armies = userArmies.getUserArmyList().stream().collect(Collectors.toMap(User::new, bua -> (int) bua.getScore()));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -30,6 +30,7 @@ import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
public class Picture {
@@ -85,8 +86,7 @@ public class Picture {
throw new TikTokLiveException("Unable map downloaded image", e);
}
var bais = new ByteArrayInputStream(baos.toByteArray());
try {
try (var bais = new ByteArrayInputStream(baos.toByteArray())) {
return ImageIO.read(bais);
} catch (IOException e) {
throw new TikTokLiveException("Unable map downloaded image bytes to Image", e);
@@ -97,8 +97,25 @@ public class Picture {
return new Picture("");
}
public Picture asUnsigned() {
if (link == null || link.isEmpty())
return this;
// p16-sign-va.tiktokcdn.com -> p16-va.tiktokcdn.com || p16-sign.tiktokcdn.com -> p16.tiktokcdn.com
return new Picture(link.replace("-sign-", "-").replace("-sign.", "."));
}
@Override
public String toString() {
return "Picture{link='" + link + "', image=" + image + "}";
}
@Override
public final boolean equals(Object o) {
return o == this || o instanceof Picture picture && picture.link != null && picture.link.equals(link);
}
@Override
public int hashCode() {
return Objects.hashCode(link);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -25,7 +25,7 @@ package io.github.jwdeveloper.tiktok.data.models.badges;
public class Badge {
public static Badge map(io.github.jwdeveloper.tiktok.messages.data.BadgeStruct badge) {
return switch (badge.getDisplayType()) {
return switch (badge.getBadgeDisplayType()) {
case BADGEDISPLAYTYPE_TEXT -> new TextBadge(badge.getText());
case BADGEDISPLAYTYPE_IMAGE -> new PictureBadge(badge.getImage());
case BADGEDISPLAYTYPE_STRING -> new StringBadge(badge.getStr());

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
* Copyright (c) 2023-2024 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the

Some files were not shown because too many files have changed in this diff Show More