mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Compare commits
414 Commits
1.0.0-Rele
...
develop-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e3e247b73b | ||
|
|
9abc1a399d | ||
|
|
85cba9fff2 | ||
|
|
b7977469a0 | ||
|
|
8910c6a491 | ||
|
|
57ff1f1385 | ||
|
|
aa1ef1f170 | ||
|
|
834dfa0939 | ||
|
|
ab97affc73 | ||
|
|
c8120d89b2 | ||
|
|
d325dffdac | ||
|
|
dac688e9d6 | ||
|
|
92c9724108 | ||
|
|
f7bef6bb31 | ||
|
|
d8661fa2e3 | ||
|
|
fc02239d48 | ||
|
|
77eeedc15c | ||
|
|
54b0216bf3 | ||
|
|
4443fbe554 | ||
|
|
a6188d8bb0 | ||
|
|
81fd7dc85c | ||
|
|
7e59099793 | ||
|
|
dd2f311539 | ||
|
|
ba69f5f5eb | ||
|
|
e9a91f5741 | ||
|
|
053bb5e3dc | ||
|
|
906796dc23 | ||
|
|
162092c638 | ||
|
|
a72d134796 | ||
|
|
75f6368f2c | ||
|
|
b9eb0eba93 | ||
|
|
50d6d6e515 | ||
|
|
42f9fe360b | ||
|
|
dff226740c | ||
|
|
951d30e6a7 | ||
|
|
1df912b722 | ||
|
|
4aec20cc35 | ||
|
|
d877d38db6 | ||
|
|
db199e9a64 | ||
|
|
1c56cf35f0 | ||
|
|
225cb2df11 | ||
|
|
1cc8a5af1b | ||
|
|
edefd0c1fd | ||
|
|
07a28e2632 | ||
|
|
cc811f6c0a | ||
|
|
735bdfbb10 | ||
|
|
28ef3562b6 | ||
|
|
3b6b381e31 | ||
|
|
86a79d687e | ||
|
|
65a651d4b8 | ||
|
|
8bda5d789c | ||
|
|
81fb2b4576 | ||
|
|
64b2e74d2b | ||
|
|
8a1f3255d0 | ||
|
|
03892390fa | ||
|
|
71602d5513 | ||
|
|
20db7cb773 | ||
|
|
3fda7fe446 | ||
|
|
8fcbb4b20f | ||
|
|
d90ab60e52 | ||
|
|
33f9862758 | ||
|
|
d74c294323 | ||
|
|
31f0e4210d | ||
|
|
2e22da1fbe | ||
|
|
4b4874d33e | ||
|
|
9c7b24f33e | ||
|
|
7476a11ae0 | ||
|
|
125e421ea9 | ||
|
|
5d84e28bdb | ||
|
|
a9003f4296 | ||
|
|
8cd640f8eb | ||
|
|
ca741ed931 | ||
|
|
96872e27b5 | ||
|
|
f6fbd60eca | ||
|
|
437335f784 | ||
|
|
84b0a3aaf4 | ||
|
|
14bf9c8c9b | ||
|
|
2dc3001e7b | ||
|
|
29a81f4cd6 | ||
|
|
70fd174a95 | ||
|
|
3e23e5b939 | ||
|
|
733e72f814 | ||
|
|
838728d47d | ||
|
|
fd6158410a | ||
|
|
6c56a96ba8 | ||
|
|
bb5659574c | ||
|
|
286da42e54 | ||
|
|
3d0b9ddcc0 | ||
|
|
354c072833 | ||
|
|
f85f24a5c8 | ||
|
|
2550a462f9 | ||
|
|
eb7b977d62 | ||
|
|
1c2c701be0 | ||
|
|
a2303f1fde | ||
|
|
a8ac0f6fff | ||
|
|
732eda3d22 | ||
|
|
358954984b | ||
|
|
acb13ea58a | ||
|
|
e8129862d1 | ||
|
|
88e36e7e90 | ||
|
|
eef9d43d01 | ||
|
|
75f3896a86 | ||
|
|
e679ff23b7 | ||
|
|
e6211e69c5 | ||
|
|
1b3ee24aea | ||
|
|
c9309ee2cf | ||
|
|
a28df44cee | ||
|
|
ee866762a3 | ||
|
|
3cb7c83ef4 | ||
|
|
bf755bcb89 | ||
|
|
20bb05e527 | ||
|
|
d5a3213ad8 | ||
|
|
7e496373ef | ||
|
|
1f3c1c7d41 | ||
|
|
c160259863 | ||
|
|
fb458e7e7d | ||
|
|
5f5ada312a | ||
|
|
cb20c3dd3a | ||
|
|
bf42f65b3d | ||
|
|
05e18ef8e0 | ||
|
|
0f6ee58d7f | ||
|
|
511759960d | ||
|
|
617d1c381a | ||
|
|
6f8b4698cd | ||
|
|
2bc1993ea5 | ||
|
|
3d4a517adb | ||
|
|
ee0b559758 | ||
|
|
1c9573dc39 | ||
|
|
5b17c33236 | ||
|
|
b59373254c | ||
|
|
5524d9f8c4 | ||
|
|
aa56f8eaea | ||
|
|
e40bde8e7c | ||
|
|
b769eb9c1f | ||
|
|
3e555a502a | ||
|
|
316868818b | ||
|
|
36475c2cf6 | ||
|
|
2dbe81278c | ||
|
|
91fc32b20b | ||
|
|
fa855fa3aa | ||
|
|
cfea12dacc | ||
|
|
16cd819aaf | ||
|
|
290a4970fd | ||
|
|
660cb287e9 | ||
|
|
f5de7720cd | ||
|
|
f986efd2d5 | ||
|
|
1054453451 | ||
|
|
7005f58edd | ||
|
|
63672fe9eb | ||
|
|
fed9de3fd0 | ||
|
|
b223651a8f | ||
|
|
8d715d4f50 | ||
|
|
1736236ccf | ||
|
|
85d99ce4f1 | ||
|
|
87727070e9 | ||
|
|
71f744cf49 | ||
|
|
046d5f1756 | ||
|
|
c36b0f1f62 | ||
|
|
a2082ebee3 | ||
|
|
412c72c119 | ||
|
|
6728fd9963 | ||
|
|
47493d4955 | ||
|
|
4d4317d96c | ||
|
|
b1954a708c | ||
|
|
14317337e9 | ||
|
|
947c9c49a2 | ||
|
|
f2bd07377b | ||
|
|
3f268f3a1a | ||
|
|
55fcf83870 | ||
|
|
8d3828cca8 | ||
|
|
1c88491b8c | ||
|
|
47b050d0ba | ||
|
|
cfef082d3b | ||
|
|
34ddc74189 | ||
|
|
9a66d240bc | ||
|
|
d825803187 | ||
|
|
77c9cd6b52 | ||
|
|
0329d3cfeb | ||
|
|
26659bb37d | ||
|
|
0b9852c4d4 | ||
|
|
31618a16ba | ||
|
|
243791f6b8 | ||
|
|
4f74a0f1b7 | ||
|
|
d1eec34fca | ||
|
|
82196ef8e3 | ||
|
|
8685d96ccf | ||
|
|
69f1d5b5c2 | ||
|
|
6f322b2a46 | ||
|
|
73c4c09ea1 | ||
|
|
95e357af92 | ||
|
|
6b31ec7d80 | ||
|
|
919554bbc8 | ||
|
|
bd0a1f0d01 | ||
|
|
f48479a92c | ||
|
|
68a86f3dbd | ||
|
|
c3a7a27948 | ||
|
|
af52e15a45 | ||
|
|
5577df7c9c | ||
|
|
2c68fe3421 | ||
|
|
5abfd95c89 | ||
|
|
5c715bfd52 | ||
|
|
b153afb332 | ||
|
|
d2ea00bcae | ||
|
|
4297af1349 | ||
|
|
d09c90ef54 | ||
|
|
9c96c8899a | ||
|
|
301df6392d | ||
|
|
fb9fc04ee5 | ||
|
|
43a8ba4225 | ||
|
|
dffccf1f0b | ||
|
|
6dcccccb78 | ||
|
|
0d467d79c3 | ||
|
|
33c98508c0 | ||
|
|
67948b14cc | ||
|
|
22e11a7822 | ||
|
|
4545503441 | ||
|
|
498d34a90b | ||
|
|
103ed7e3ed | ||
|
|
67e70c34bc | ||
|
|
786c24d267 | ||
|
|
966d2f65d8 | ||
|
|
7ba7143f5a | ||
|
|
92fde03f2b | ||
|
|
e058290118 | ||
|
|
d25741b229 | ||
|
|
560a8d7c3b | ||
|
|
6178bc25cf | ||
|
|
48d1138754 | ||
|
|
a5320db820 | ||
|
|
4e1ab35a60 | ||
|
|
cef4972f37 | ||
|
|
713c90a271 | ||
|
|
71853db5cc | ||
|
|
ef90d4cd58 | ||
|
|
dad4048bc0 | ||
|
|
9ba049d37a | ||
|
|
f7d657371b | ||
|
|
eea691a5aa | ||
|
|
a249ac0cdd | ||
|
|
b82c7184b3 | ||
|
|
29631ac468 | ||
|
|
15c642297c | ||
|
|
d3004d76c1 | ||
|
|
3ae73072ff | ||
|
|
9c5f97157a | ||
|
|
ea847bb883 | ||
|
|
45bac053b9 | ||
|
|
8cb647f27a | ||
|
|
ffbd67eef4 | ||
|
|
e923f3fad7 | ||
|
|
faa1185b97 | ||
|
|
ead954dd27 | ||
|
|
e37b30ff12 | ||
|
|
7a5c00d99a | ||
|
|
407f51fa73 | ||
|
|
8581df7f49 | ||
|
|
3e52523644 | ||
|
|
3387986ced | ||
|
|
0fcac60cbe | ||
|
|
63dd8c20ac | ||
|
|
b809bb6cda | ||
|
|
a68eaba5a1 | ||
|
|
0252b9a42f | ||
|
|
1b2a8bad93 | ||
|
|
6b22154c82 | ||
|
|
965816e846 | ||
|
|
6b6e82cd93 | ||
|
|
c93c3144ff | ||
|
|
12c64e1c67 | ||
|
|
5794ff2a57 | ||
|
|
d471e87dd7 | ||
|
|
c89bcad894 | ||
|
|
c9a84c39df | ||
|
|
c1105f1324 | ||
|
|
243ce9bc94 | ||
|
|
4f141edb1a | ||
|
|
359a1508c7 | ||
|
|
bbfa7b410b | ||
|
|
6da40927d0 | ||
|
|
4d97fd9157 | ||
|
|
1ba51476d1 | ||
|
|
9ee5c89f64 | ||
|
|
ffabf098c0 | ||
|
|
7468fc2385 | ||
|
|
abbb557881 | ||
|
|
19c513afe6 | ||
|
|
283024a1d4 | ||
|
|
a0ac9e6d79 | ||
|
|
2385d1e75e | ||
|
|
c9c7f62d4a | ||
|
|
35ef95096d | ||
|
|
46bcfd6eb8 | ||
|
|
38b66395cb | ||
|
|
46e75dec1a | ||
|
|
749cfcf4a6 | ||
|
|
039f2b6a0b | ||
|
|
1a1860e35d | ||
|
|
8a4248daa3 | ||
|
|
ff5310f5bf | ||
|
|
9ddec45740 | ||
|
|
8a7b9e801b | ||
|
|
7b4590d0a1 | ||
|
|
2555edd86f | ||
|
|
a805844522 | ||
|
|
9da96b4417 | ||
|
|
12cf9e641b | ||
|
|
6bfa0b7745 | ||
|
|
cf9b882391 | ||
|
|
913d473442 | ||
|
|
72092bb56b | ||
|
|
b6247feb32 | ||
|
|
0dd952a7fb | ||
|
|
af4f2b4510 | ||
|
|
2c12b71e99 | ||
|
|
bc3386d21e | ||
|
|
4801de58cb | ||
|
|
548a585e90 | ||
|
|
2667f04a1c | ||
|
|
0a857594ea | ||
|
|
b0593ba95c | ||
|
|
c23faffcde | ||
|
|
f7a92d5015 | ||
|
|
6a42da9ecb | ||
|
|
1308b86567 | ||
|
|
20ba88c0ac | ||
|
|
77533ea4be | ||
|
|
3231924f8f | ||
|
|
ea525470e2 | ||
|
|
b0bf4ac606 | ||
|
|
0b9f1570d0 | ||
|
|
7a4c7fecbd | ||
|
|
0ae9068858 | ||
|
|
8905958207 | ||
|
|
c12f3cc4dc | ||
|
|
7402899f52 | ||
|
|
1b8b150d61 | ||
|
|
b2305b7bed | ||
|
|
7b911838a2 | ||
|
|
e44cb71869 | ||
|
|
af8c689417 | ||
|
|
81ac92fb33 | ||
|
|
34a78b5435 | ||
|
|
534cb7906d | ||
|
|
0bb8edfe5c | ||
|
|
4979c1b27a | ||
|
|
f7c8ffdaa5 | ||
|
|
c1fda687d3 | ||
|
|
05c49c4545 | ||
|
|
7d36f36cee | ||
|
|
f8a716429d | ||
|
|
fee805f0ea | ||
|
|
1733102aff | ||
|
|
89f54d5976 | ||
|
|
39055b5f3a | ||
|
|
cd9e9ead85 | ||
|
|
5a2d2d23f0 | ||
|
|
3eed982d6b | ||
|
|
385560de3a | ||
|
|
2e37b6627b | ||
|
|
c4f0d63b43 | ||
|
|
15550ed703 | ||
|
|
c7d84218f2 | ||
|
|
1ecd192539 | ||
|
|
d6c0d50ac3 | ||
|
|
b4997da0a8 | ||
|
|
82990665b8 | ||
|
|
155b47977d | ||
|
|
3e262773a4 | ||
|
|
89fbeb848b | ||
|
|
aa99c5929b | ||
|
|
4dd866c6cc | ||
|
|
0d384f0fdc | ||
|
|
3832db111e | ||
|
|
46d5f15d3f | ||
|
|
4f3ec1c6d9 | ||
|
|
31075e5f09 | ||
|
|
33a3f7afb8 | ||
|
|
6c888c5d5b | ||
|
|
214aa3b1ff | ||
|
|
3f2c9083d5 | ||
|
|
450014759c | ||
|
|
790f568244 | ||
|
|
e3e0d8a88e | ||
|
|
e0136d0f3b | ||
|
|
dd5ccbfb7f | ||
|
|
110a4fab4c | ||
|
|
69a2a6a338 | ||
|
|
530551763c | ||
|
|
ca1827853a | ||
|
|
ea8c740faa | ||
|
|
1977cbe8dc | ||
|
|
c3a48c4d70 | ||
|
|
2c51844fd9 | ||
|
|
8ff4236452 | ||
|
|
7817aeb652 | ||
|
|
4c122ab754 | ||
|
|
519c22de8e | ||
|
|
6d268c42f1 | ||
|
|
788653484f | ||
|
|
6cebbf891d | ||
|
|
cc32648988 | ||
|
|
4c797724d3 | ||
|
|
6941107db8 | ||
|
|
ed70799cd9 | ||
|
|
e12b0901f7 | ||
|
|
563e9618e2 | ||
|
|
82112f0140 | ||
|
|
77e30de5e1 | ||
|
|
a2b10ba7f6 | ||
|
|
957e38a5d2 | ||
|
|
5e77b3f57f | ||
|
|
690b9eb272 | ||
|
|
fc91991c2c | ||
|
|
0f735a7876 |
4
.github/workflows/maven-publish.yml
vendored
4
.github/workflows/maven-publish.yml
vendored
@@ -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
|
||||
|
||||
310
.gitignore
vendored
310
.gitignore
vendored
@@ -1,61 +1,86 @@
|
||||
# Project exclude paths
|
||||
/API/target/
|
||||
/Client/target/
|
||||
*.db
|
||||
backend-infrastructure/.aws-sam
|
||||
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
|
||||
.db
|
||||
# Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
|
||||
*.db
|
||||
### Linux ###
|
||||
*~
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
|
||||
### OSX ###
|
||||
*.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
### PyCharm ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
# User-specific stuff:
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
.idea/dictionaries
|
||||
.idea/
|
||||
|
||||
# AWS User-specific
|
||||
.idea/**/aws.xml
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
# Sensitive or high-churn files:
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.xml
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
# Gradle:
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
cmake-build-debug/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
# Mongo Explorer plugin:
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
## File-based project format:
|
||||
*.iws
|
||||
|
||||
## Plugin-specific files:
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
/out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
@@ -66,8 +91,8 @@ atlassian-ide-plugin.xml
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# SonarLint plugin
|
||||
.idea/sonarlint/
|
||||
# Ruby plugin and RubyMine
|
||||
/.rakeTasks
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
@@ -75,69 +100,150 @@ crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
### PyCharm Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
/.idea/.gitignore
|
||||
/.idea/.name
|
||||
/.idea/compiler.xml
|
||||
/TestApplication/target/classes/io/github/jwdeveloper/tiktok/ConfigurationExample.class
|
||||
/TestApplication/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
|
||||
/TestApplication/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
|
||||
/Tools/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
|
||||
/Tools/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
|
||||
/Tools-EventsCollector/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
|
||||
/Tools-ReadmeGenerator/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
|
||||
/Tools-ReadmeGenerator/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
|
||||
/.idea/encodings.xml
|
||||
/Tools-ReadmeGenerator/target/classes/io/github/jwdeveloper/tiktok/EventsListGenerator$EventTypeComparator.class
|
||||
/Tools-ReadmeGenerator/target/classes/io/github/jwdeveloper/tiktok/EventsListGenerator.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/tables/ExceptionInfoModel.class
|
||||
/Tools/target/classes/io/github/jwdeveloper/tiktok/utils/FilesUtility.class
|
||||
/TestApplication/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
|
||||
/TestApplication/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
|
||||
/Tools/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
|
||||
/Tools/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
|
||||
/Tools-EventsCollector/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
|
||||
/Tools-ReadmeGenerator/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
|
||||
/Tools-ReadmeGenerator/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
|
||||
/.idea/jarRepositories.xml
|
||||
/TestApplication/target/classes/io/github/jwdeveloper/tiktok/ListenerExample$CustomListener.class
|
||||
/TestApplication/target/classes/io/github/jwdeveloper/tiktok/ListenerExample.class
|
||||
/Tools-ReadmeGenerator/target/classes/io/github/jwdeveloper/tiktok/LiveClientMethodsGenerator.class
|
||||
/TestApplication/target/classes/io/github/jwdeveloper/tiktok/Main.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/Main.class
|
||||
/Tools-ReadmeGenerator/target/classes/io/github/jwdeveloper/tiktok/Main.class
|
||||
/.idea/misc.xml
|
||||
/Tools-ReadmeGenerator/src/main/resources/output.md
|
||||
/Tools-ReadmeGenerator/target/classes/output.md
|
||||
/TestApplication/target/maven-archiver/pom.properties
|
||||
/Tools/target/maven-archiver/pom.properties
|
||||
/Tools-EventsCollector/target/maven-archiver/pom.properties
|
||||
/Tools-ReadmeGenerator/target/maven-archiver/pom.properties
|
||||
/.idea/inspectionProfiles/Project_Default.xml
|
||||
/Tools/target/classes/io/github/jwdeveloper/tiktok/protocol/ProtocolGenerator.class
|
||||
/Tools-ReadmeGenerator/target/classes/io/github/jwdeveloper/tiktok/ReadmeGenerator.class
|
||||
/TestApplication/target/classes/io/github/jwdeveloper/tiktok/SimpleExample.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/db/SqlConsts.class
|
||||
/Tools-ReadmeGenerator/target/classes/template.md
|
||||
/Tools/target/classes/io/github/jwdeveloper/tiktok/utils/TemplateUtility.class
|
||||
/TestApplication/target/TestApplication-0.0.18-Release.jar
|
||||
/TestApplication/target/TestApplication-0.0.18-Release-all.jar
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/db/TikTokDatabase.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/tables/TikTokErrorModel$TikTokErrorModelBuilder.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/tables/TikTokErrorModel.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/db/TikTokErrorModelDAO.class
|
||||
/target/TikTokLiveJava-0.0.18-Release-all.pom
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/tables/TikTokMessageModel$TikTokMessageModelBuilder.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/tables/TikTokMessageModel.class
|
||||
/Tools-EventsCollector/target/classes/io/github/jwdeveloper/tiktok/tools/collector/db/TikTokMessageModelDAO.class
|
||||
/Tools/target/Tools-0.0.18-Release.jar
|
||||
/Tools/target/Tools-0.0.18-Release-all.jar
|
||||
/Tools-EventsCollector/target/Tools-EventsCollector-0.0.18-Release.jar
|
||||
/Tools-EventsCollector/target/Tools-EventsCollector-0.0.18-Release-all.jar
|
||||
/Tools-ReadmeGenerator/target/Tools-ReadmeGenerator-0.0.18-Release.jar
|
||||
/Tools-ReadmeGenerator/target/Tools-ReadmeGenerator-0.0.18-Release-all.jar
|
||||
/.idea/vcs.xml
|
||||
*.iml
|
||||
modules.xml
|
||||
.idea/misc.xml
|
||||
*.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
.idea/sonarlint
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
.pytest_cache/
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule.*
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
|
||||
### VisualStudioCode ###
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
.history
|
||||
|
||||
### Windows ###
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
**/target/
|
||||
# Build folder
|
||||
|
||||
*/build/*
|
||||
|
||||
# End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode
|
||||
/python-app-backend/samconfig.toml
|
||||
/java-app-backend/BackendFunction/dependency-reduced-pom.xml
|
||||
3
.idea/protoeditor.xml
generated
3
.idea/protoeditor.xml
generated
@@ -64,6 +64,9 @@
|
||||
<ImportPathEntry>
|
||||
<option name="location" value="file://$PROJECT_DIR$/API/src/main/proto" />
|
||||
</ImportPathEntry>
|
||||
<ImportPathEntry>
|
||||
<option name="location" value="file://$USER_HOME$/AppData/Local/JetBrains/IntelliJIdea2022.3/protoeditor" />
|
||||
</ImportPathEntry>
|
||||
</list>
|
||||
</option>
|
||||
<option name="descriptorPath" value="google/protobuf/descriptor.proto" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>TikTokLiveJava</artifactId>
|
||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||
<version>0.0.25-Release</version>
|
||||
<version>1.11.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>
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Data
|
||||
public class ClientSettings {
|
||||
/**
|
||||
* Timeout for Connections
|
||||
*/
|
||||
private Duration timeout;
|
||||
|
||||
/**
|
||||
* ISO-Language for Client
|
||||
*/
|
||||
|
||||
private String clientLanguage;
|
||||
|
||||
/**
|
||||
* Whether to Retry if Connection Fails
|
||||
*/
|
||||
private boolean retryOnConnectionFailure;
|
||||
|
||||
|
||||
/**
|
||||
* Before retrying connect, wait for select amount of time
|
||||
*/
|
||||
private Duration retryConnectionTimeout;
|
||||
|
||||
/**
|
||||
* Whether to handle Events received from Room when Connecting
|
||||
*/
|
||||
private boolean handleExistingEvents;
|
||||
|
||||
/**
|
||||
* Whether to print Logs to Console
|
||||
*/
|
||||
|
||||
private boolean printToConsole;
|
||||
/**
|
||||
* LoggingLevel for Logs
|
||||
*/
|
||||
private Level logLevel;
|
||||
|
||||
|
||||
/**
|
||||
* Optional: Use it if you need to change TikTok live hostname in builder
|
||||
*/
|
||||
private String hostName;
|
||||
|
||||
|
||||
/**
|
||||
* Parameters used in requests to TikTok api
|
||||
*/
|
||||
private Map<String, Object> clientParameters;
|
||||
|
||||
|
||||
/*
|
||||
* Optional: Sometimes not every messages from chat are send to TikTokLiveJava to fix this issue you can set sessionId
|
||||
* documentation how to obtain sessionId https://github.com/isaackogan/TikTok-Live-Connector#send-chat-messages
|
||||
*/
|
||||
private String sessionId;
|
||||
|
||||
/*
|
||||
* Optional: By default roomID is fetched before connect to live, but you can set it manually
|
||||
*
|
||||
*/
|
||||
private String roomId;
|
||||
|
||||
}
|
||||
|
||||
@@ -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,3 +30,6 @@ public @interface EventMeta
|
||||
{
|
||||
EventType eventType();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,14 +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.utils;
|
||||
package io.github.jwdeveloper.tiktok.annotations;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface JsonIgnore {
|
||||
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;
|
||||
}
|
||||
@@ -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,17 @@
|
||||
* 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.tools.collector.tables;
|
||||
package io.github.jwdeveloper.tiktok.data.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Value;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@Data
|
||||
public class TikTokResponseModel
|
||||
@AllArgsConstructor
|
||||
public class MessageMetaData
|
||||
{
|
||||
private Integer id;
|
||||
|
||||
private String hostName;
|
||||
|
||||
private String response;
|
||||
|
||||
private String createdAt;
|
||||
private Duration handlingTime;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.dto;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.net.*;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class ProxyData
|
||||
{
|
||||
private final String address;
|
||||
private final int port;
|
||||
|
||||
public static ProxyData map(String string) {
|
||||
if (string == null || string.isBlank())
|
||||
throw new IllegalArgumentException("Provided address cannot be null or empty!");
|
||||
int portIndex = string.lastIndexOf(':');
|
||||
try {
|
||||
String address = string.substring(0, portIndex);
|
||||
int port = Integer.parseInt(string.substring(portIndex+1));
|
||||
|
||||
// Port validation
|
||||
if (port < 0 || port > 65535)
|
||||
throw new IndexOutOfBoundsException("Port out of range: "+port);
|
||||
|
||||
// IP Validation
|
||||
InetAddress res = InetAddress.getByName(address);
|
||||
|
||||
return new ProxyData(address, port);
|
||||
} catch (NumberFormatException e) {
|
||||
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!", e);
|
||||
}
|
||||
}
|
||||
|
||||
public InetSocketAddress toSocketAddress() {
|
||||
return new InetSocketAddress(address, port);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,26 +32,37 @@ 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;
|
||||
|
||||
public TikTokCommentEvent(WebcastChatMessage msg) {
|
||||
super(msg.getCommon());
|
||||
user = User.map(msg.getUser());
|
||||
user = User.map(msg.getUser(), msg.getUserIdentity());
|
||||
text = msg.getContent();
|
||||
visibleToSender = msg.getVisibleToSender();
|
||||
getUserLanguage = msg.getContentLanguage();
|
||||
mentionedUser = User.map(msg.getAtUser(),msg.getUserIdentity());
|
||||
userLanguage = msg.getContentLanguage();
|
||||
mentionedUser = User.map(msg.getAtUser());
|
||||
pictures = msg.getEmotesListList().stream().map(e -> Picture.map(e.getEmote().getImage())).toList();
|
||||
}
|
||||
|
||||
|
||||
public static TikTokCommentEvent of(String userName, String message) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
public TikTokDetectEvent(WebcastMsgDetectMessage msg) {
|
||||
super(msg.getCommon());
|
||||
language = msg.getFromRegion();
|
||||
}
|
||||
|
||||
|
||||
private final String language;
|
||||
|
||||
public TikTokDetectEvent(WebcastMsgDetectMessage msg) {
|
||||
super(msg.getCommon());
|
||||
language = msg.getFromRegion();
|
||||
}
|
||||
}
|
||||
@@ -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,28 @@ package io.github.jwdeveloper.tiktok.data.events;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
public static int UNKNOWN_CLOSE_CODE = -1;
|
||||
|
||||
/** Valid CloseFrame code or -1 for unknown */
|
||||
private final int code;
|
||||
private final String reason;
|
||||
|
||||
public TikTokDisconnectedEvent(int code, String reason) {
|
||||
this.code = code;
|
||||
this.reason = reason.isBlank() ? "None" : reason;
|
||||
}
|
||||
|
||||
public TikTokDisconnectedEvent(String reason) {
|
||||
this(UNKNOWN_CLOSE_CODE, reason);
|
||||
}
|
||||
|
||||
public boolean isUnknownCloseCode() {
|
||||
return this.code == UNKNOWN_CLOSE_CODE;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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.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.
|
||||
@@ -40,18 +38,35 @@ import java.util.List;
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMicArmiesEvent extends TikTokHeaderEvent {
|
||||
private final Long battleId;
|
||||
|
||||
private final Integer battleStatus;
|
||||
/**
|
||||
true if battle is finished otherwise false
|
||||
*/
|
||||
private final boolean finished;
|
||||
|
||||
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());
|
||||
battleStatus = msg.getBattleStatus();
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,29 +22,142 @@
|
||||
*/
|
||||
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.LinkMicBattleTeam;
|
||||
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.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Triggered every time a battle starts.
|
||||
* Triggered every time a battle starts & ends
|
||||
*/
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent {
|
||||
private final Long battleId;
|
||||
private final List<LinkMicBattleTeam> team1;
|
||||
private final List<LinkMicBattleTeam> team2;
|
||||
public class TikTokLinkMicBattleEvent extends TikTokHeaderEvent
|
||||
{
|
||||
private final Long battleId;
|
||||
/**
|
||||
true if battle is finished otherwise false
|
||||
*/
|
||||
private final boolean finished;
|
||||
private final List<Team> teams;
|
||||
private final BattleType battleType;
|
||||
|
||||
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
|
||||
super(msg.getCommon());
|
||||
battleId = msg.getId();
|
||||
team1 = msg.getTeams1List().stream().map(LinkMicBattleTeam::new).toList();
|
||||
team2 = msg.getTeams2List().stream().map(LinkMicBattleTeam::new).toList();
|
||||
}
|
||||
public TikTokLinkMicBattleEvent(WebcastLinkMicBattle msg) {
|
||||
super(msg.getCommon());
|
||||
battleId = msg.getBattleId();
|
||||
finished = msg.getAction() == BattleAction.BATTLE_ACTION_FINISH;
|
||||
battleType = msg.getBattleSetting().getBattleType();
|
||||
teams = new ArrayList<>();
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 1 host vs 1 host */
|
||||
public boolean is1v1() {
|
||||
return battleType == BattleType.BATTLE_TYPE_NORMAL_BATTLE;
|
||||
}
|
||||
|
||||
/** 2 hosts vs 2 hosts*/
|
||||
public boolean is2v2() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,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.messages.webcast.WebcastLinkMicBattleItemCard;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMicBattleItemCard extends TikTokHeaderEvent {
|
||||
|
||||
public TikTokLinkMicBattleItemCard(WebcastLinkMicBattleItemCard msg) {
|
||||
super(msg.getCommon());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,15 +20,13 @@
|
||||
* 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.handler;
|
||||
|
||||
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 java.util.List;
|
||||
|
||||
|
||||
public interface TikTokMessageHandler
|
||||
{
|
||||
List<TikTokEvent> handle(byte[] messagePayload) throws Exception;
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLiveUnpausedEvent extends TikTokEvent {
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
public TikTokRankTextEvent(WebcastRankTextMessage msg) {
|
||||
super(msg.getCommon());
|
||||
var text = Text.map(msg.getSelfGetBadgeMsg());
|
||||
label = text.getPattern();
|
||||
eventType = text.getKey();
|
||||
}
|
||||
private final String label;
|
||||
|
||||
public TikTokRankTextEvent(WebcastRankTextMessage msg) {
|
||||
super(msg.getCommon());
|
||||
var text = Text.map(msg.getSelfGetBadgeMsg());
|
||||
label = text.getPattern();
|
||||
eventType = text.getKey();
|
||||
}
|
||||
}
|
||||
@@ -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(WebcastRankUpdateMessage msg) {
|
||||
super(msg.getCommon());
|
||||
}
|
||||
public TikTokRankUpdateEvent(WebcastHourlyRankMessage msg) {
|
||||
super(msg.getCommon());
|
||||
}
|
||||
|
||||
public TikTokRankUpdateEvent(WebcastRankUpdateMessage msg) {
|
||||
super(msg.getCommon());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
//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();
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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,24 +26,36 @@ import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.UserAttribute;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.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 {
|
||||
private User user;
|
||||
private final User user;
|
||||
|
||||
public TikTokSubscribeEvent(WebcastMemberMessage msg) {
|
||||
super(msg.getCommon());
|
||||
|
||||
if(msg.hasUser())
|
||||
{
|
||||
user = new User(msg.getUser());
|
||||
public TikTokSubscribeEvent(WebcastMemberMessage msg) {
|
||||
super(msg.getCommon());
|
||||
user = User.map(msg.getUser());
|
||||
user.addAttribute(UserAttribute.Subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
public TikTokSubscribeEvent(WebcastSubNotifyMessage msg) {
|
||||
super(msg.getCommon());
|
||||
user = User.map(msg.getUser());
|
||||
user.addAttribute(UserAttribute.Subscriber);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.control;
|
||||
|
||||
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 client is connecting to live is successfully established.
|
||||
*/
|
||||
@EventMeta(eventType = EventType.Control)
|
||||
public class TikTokConnectingEvent extends TikTokLiveClientEvent {
|
||||
|
||||
public static TikTokConnectingEvent of() {
|
||||
return new TikTokConnectingEvent();
|
||||
}
|
||||
}
|
||||
@@ -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.control;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokLiveClientEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.requests.*;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Control)
|
||||
public class TikTokPreConnectionEvent extends TikTokLiveClientEvent
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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,36 +20,52 @@
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.room;
|
||||
package io.github.jwdeveloper.tiktok.data.events.envelop;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.RankingUser;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomUserSeqMessage;
|
||||
import lombok.Getter;
|
||||
import io.github.jwdeveloper.tiktok.data.models.Text;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import io.github.jwdeveloper.tiktok.data.models.chest.Chest;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastEnvelopeMessage;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokRoomUserInfoEvent extends TikTokHeaderEvent {
|
||||
private final int totalUsers;
|
||||
@Value
|
||||
public class TikTokChestEvent extends TikTokHeaderEvent {
|
||||
|
||||
/**
|
||||
* Only top 5 users in ranking has detailed data
|
||||
* rest has only ID
|
||||
* Chest target
|
||||
*/
|
||||
private final List<RankingUser> usersRanking;
|
||||
public TikTokRoomUserInfoEvent(WebcastRoomUserSeqMessage msg) {
|
||||
super(msg.getCommon());
|
||||
totalUsers = msg.getTotalUser();
|
||||
usersRanking = msg.getRanksListList().stream().map(RankingUser::new)
|
||||
.sorted((ru1, ru2) -> Integer.compare(ru2.getScore(), ru1.getScore()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
Chest chest;
|
||||
|
||||
/**
|
||||
* User that send a chest
|
||||
*/
|
||||
User user;
|
||||
|
||||
/**
|
||||
* Time when chest has been open
|
||||
*/
|
||||
Date openedAt;
|
||||
|
||||
public TikTokChestEvent(Chest chest, WebcastEnvelopeMessage msg) {
|
||||
super(msg.getCommon());
|
||||
this.chest = chest;
|
||||
|
||||
var text = Text.map(msg.getCommon().getDisplayText());
|
||||
var userPiece = (Text.UserTextPiece) text.getTextPieces().get(0);
|
||||
user = userPiece.getUser();
|
||||
|
||||
|
||||
var envelopInfo = msg.getEnvelopeInfo();
|
||||
|
||||
openedAt = new Date(envelopInfo.getUnpackAt());
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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,34 +22,28 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.gift;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.Gift;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.GiftSendType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.*;
|
||||
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 GiftSendType 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>
|
||||
*
|
||||
* Remember if comboState is Finsihed both TikTokGiftComboEvent and TikTokGiftEvent event gets triggered
|
||||
*/
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
@Getter
|
||||
public class TikTokGiftComboEvent extends TikTokGiftEvent {
|
||||
private final GiftSendType comboState;
|
||||
private final GiftComboStateType comboState;
|
||||
|
||||
public TikTokGiftComboEvent(Gift gift, WebcastGiftMessage msg, GiftSendType comboState) {
|
||||
super(gift, msg);
|
||||
public TikTokGiftComboEvent(Gift gift, User host, WebcastGiftMessage msg, GiftComboStateType comboState) {
|
||||
super(gift, host, msg);
|
||||
this.comboState = comboState;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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,47 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.gift;
|
||||
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.Gift;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.GiftSendType;
|
||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.*;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastGiftMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/*
|
||||
* Triggered when user sends gifts that has
|
||||
* no combo (most of expensive gifts)
|
||||
* or if combo has finished
|
||||
*/
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
@Getter
|
||||
public class TikTokGiftEvent extends TikTokHeaderEvent {
|
||||
private final Gift gift;
|
||||
private final User user;
|
||||
private final User toUser;
|
||||
private final int combo;
|
||||
public TikTokGiftEvent(Gift gift, WebcastGiftMessage msg) {
|
||||
|
||||
public TikTokGiftEvent(Gift gift, User liveHost, WebcastGiftMessage msg) {
|
||||
super(msg.getCommon());
|
||||
this.gift = gift;
|
||||
user = User.map(msg.getUser(), msg.getUserIdentity());
|
||||
if (msg.getToUser().getNickname().isEmpty()) {
|
||||
toUser = liveHost;
|
||||
} else {
|
||||
toUser = User.map(msg.getToUser());
|
||||
}
|
||||
combo = msg.getComboCount();
|
||||
}
|
||||
|
||||
public TikTokGiftEvent(Gift gift) {
|
||||
this.gift = gift;
|
||||
user = new User(0L, "sender", new Picture(""));
|
||||
toUser = new User(0L, "receiver", new Picture(""));
|
||||
combo = 1;
|
||||
}
|
||||
|
||||
|
||||
public static TikTokGiftEvent of(Gift gift) {
|
||||
return new TikTokGiftEvent(gift);
|
||||
}
|
||||
|
||||
public static TikTokGiftEvent of(String name, int id, int diamonds) {
|
||||
return TikTokGiftEvent.of(new Gift(id, name, diamonds, ""));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.http;
|
||||
|
||||
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.models.http.HttpData;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@EventMeta(eventType = EventType.Debug)
|
||||
public class TikTokHttpResponseEvent extends TikTokEvent
|
||||
{
|
||||
String url;
|
||||
|
||||
HttpData response;
|
||||
|
||||
HttpData request;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,17 +20,17 @@
|
||||
* 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.mockClient;
|
||||
package io.github.jwdeveloper.tiktok.data.events.link;
|
||||
|
||||
public class TikTokClientMock
|
||||
{
|
||||
public static TikTokMockBuilder create(String host)
|
||||
{
|
||||
return new TikTokMockBuilder(host);
|
||||
}
|
||||
import io.github.jwdeveloper.tiktok.annotations.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
public static TikTokMockBuilder create()
|
||||
{
|
||||
return create("MockHostName");
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkApplyEvent extends TikTokLinkEvent {
|
||||
|
||||
public TikTokLinkApplyEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,22 +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.models;
|
||||
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;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicBattle;
|
||||
import lombok.Value;
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkCloseEvent extends TikTokLinkEvent {
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Value
|
||||
public class LinkMicBattleTeam {
|
||||
Long teamId;
|
||||
List<User> users;
|
||||
|
||||
public LinkMicBattleTeam(WebcastLinkMicBattle.LinkMicBattleTeam team) {
|
||||
this.teamId = team.getId();
|
||||
this.users = team.getUsersList().stream().map(User::new).toList();
|
||||
public TikTokLinkCloseEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
// if (!msg.hasCloseContent())
|
||||
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Close Content!");
|
||||
// Proto Empty
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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,32 +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 token;
|
||||
|
||||
private User user;
|
||||
|
||||
private final List<User> otherUsers;
|
||||
private final String extra, transferExtra;
|
||||
private final long expireTimestamp;
|
||||
|
||||
public TikTokLinkEvent(WebcastLinkMessage msg) {
|
||||
super(msg.getCommon());
|
||||
token = msg.getToken();
|
||||
if (msg.getUser().getUser().hasUser()) {
|
||||
user = new User(msg.getUser().getUser().getUser());
|
||||
}
|
||||
otherUsers = msg.getUser().getOtherUsersList().stream().map(e -> new User(e.getUser())).toList();
|
||||
this.extra = msg.getExtra();
|
||||
this.expireTimestamp = msg.getExpireTimestamp();
|
||||
this.transferExtra = msg.getTransferExtra();
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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 TikTokLinkMicIdxUpdateEvent extends TikTokLinkEvent {
|
||||
|
||||
public TikTokLinkMicIdxUpdateEvent(WebcastLinkMessage msg) {
|
||||
super(msg);
|
||||
// if (!msg.hasMicIdxUpdateContent())
|
||||
// throw new IllegalArgumentException("Expected WebcastLinkMessage with Mic Idx Update Content!");
|
||||
// Proto Empty
|
||||
}
|
||||
}
|
||||
@@ -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,34 +20,31 @@
|
||||
* 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.tools.collector.tables;
|
||||
package io.github.jwdeveloper.tiktok.data.events.link;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
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;
|
||||
|
||||
public class ExceptionInfoModel
|
||||
{
|
||||
private String message;
|
||||
private String stackTrace;
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokLinkMuteEvent extends TikTokLinkEvent {
|
||||
|
||||
public ExceptionInfoModel(Throwable throwable) {
|
||||
this.message = throwable.getMessage();
|
||||
this.stackTrace = getStackTraceAsString(throwable);
|
||||
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 static String getStackTraceAsString(Throwable throwable) {
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
throwable.printStackTrace(pw);
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
// Getters for message and stackTrace
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getStackTrace() {
|
||||
return stackTrace;
|
||||
public boolean isMuted() {
|
||||
return status == MuteStatus.MUTE_STATUS_MUTE;
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.data.events.room;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventMeta;
|
||||
import io.github.jwdeveloper.tiktok.annotations.EventType;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokHeaderEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.data.models.users.UserAttribute;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.RoomMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLiveIntroMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastRoomMessage;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSystemMessage;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokRoomEvent extends TikTokHeaderEvent
|
||||
{
|
||||
private User hostUser;
|
||||
private String hostLanguage;
|
||||
private final String welcomeMessage;
|
||||
|
||||
public TikTokRoomEvent(WebcastRoomMessage msg) {
|
||||
super(msg.getCommon());
|
||||
welcomeMessage = msg.getContent();
|
||||
}
|
||||
|
||||
public TikTokRoomEvent(RoomMessage msg) {
|
||||
super(msg.getCommon());
|
||||
welcomeMessage = msg.getContent();
|
||||
}
|
||||
|
||||
public TikTokRoomEvent(WebcastSystemMessage msg) {
|
||||
super(msg.getCommon());
|
||||
welcomeMessage = msg.getMessage();
|
||||
}
|
||||
|
||||
public TikTokRoomEvent(WebcastLiveIntroMessage msg) {
|
||||
super(msg.getCommon());
|
||||
hostUser = User.map(msg.getHost());
|
||||
hostUser.addAttribute(UserAttribute.LiveHost);
|
||||
welcomeMessage = msg.getContent();
|
||||
hostLanguage = msg.getLanguage();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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.room;
|
||||
|
||||
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.live.LiveRoomInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokRoomInfoEvent extends TikTokEvent
|
||||
{
|
||||
LiveRoomInfo roomInfo;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,25 @@ import io.github.jwdeveloper.tiktok.data.models.users.User;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastSocialMessage;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* Triggers when a user follows the streamer. Based on social event.
|
||||
*/
|
||||
|
||||
@Value
|
||||
@EventMeta(eventType = EventType.Message)
|
||||
public class TikTokFollowEvent extends TikTokHeaderEvent
|
||||
{
|
||||
User user;
|
||||
int totalFollowers;
|
||||
public 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) {
|
||||
return new TikTokFollowEvent(WebcastSocialMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -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,4 +47,14 @@ public class TikTokJoinEvent extends TikTokHeaderEvent {
|
||||
user = User.map(msg.getUser());
|
||||
totalUsers = msg.getMemberCount();
|
||||
}
|
||||
|
||||
public static TikTokJoinEvent of(String userName)
|
||||
{
|
||||
return new TikTokJoinEvent(WebcastMemberMessage.newBuilder()
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -57,4 +55,16 @@ public class TikTokLikeEvent extends TikTokHeaderEvent
|
||||
likes = msg.getCount();
|
||||
totalLikes = msg.getTotal();
|
||||
}
|
||||
|
||||
public static TikTokLikeEvent of(String userName, int likes)
|
||||
{
|
||||
return new TikTokLikeEvent(WebcastLikeMessage.newBuilder()
|
||||
.setCount(likes)
|
||||
.setTotal(likes)
|
||||
.setUser(io.github.jwdeveloper.tiktok.messages.data.User.newBuilder()
|
||||
.setUsername(userName)
|
||||
.setNickname(userName)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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,34 +22,37 @@
|
||||
*/
|
||||
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.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 a protobuf encoded webcast message arrives. You can deserialize the binary object depending on the use case.
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
@EventMeta(eventType = EventType.Debug)
|
||||
public class TikTokWebsocketMessageEvent extends TikTokEvent
|
||||
{
|
||||
public class TikTokWebsocketMessageEvent extends TikTokEvent {
|
||||
|
||||
/*
|
||||
* Original message that is coming from TikTok
|
||||
* message.method - Name of message type, for example "WebcastGiftMessage"
|
||||
* message.payload - Bytes array that contains actual data of message.
|
||||
* Example of parsing, WebcastGiftMessage giftMessage = WebcastGiftMessage.parseFrom(message.getPayload());
|
||||
*/
|
||||
private ProtoMessageFetchResult.BaseProtoMessage message;
|
||||
|
||||
/*
|
||||
* TikTokLiveJava event that was created from TikTok message data
|
||||
* Example: TikTokGiftEvent
|
||||
*/
|
||||
private TikTokEvent event;
|
||||
|
||||
private WebcastResponse.Message message;
|
||||
/*
|
||||
* Metadata information about mapping message to event, such as time and stuff
|
||||
*/
|
||||
private MessageMetaData metaData;
|
||||
|
||||
private MetaData metaData;
|
||||
|
||||
@Value
|
||||
public static class MetaData
|
||||
{
|
||||
Duration handlingTime;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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,18 +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 ProtoMessageFetchResult.BaseProtoMessage getMessage()
|
||||
{
|
||||
return this.getData();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
}
|
||||
@@ -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,15 +28,11 @@ import lombok.Getter;
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
|
||||
public class Picture {
|
||||
|
||||
@Getter
|
||||
@@ -49,12 +45,11 @@ public class Picture {
|
||||
}
|
||||
|
||||
public static Picture map(io.github.jwdeveloper.tiktok.messages.data.Image profilePicture) {
|
||||
|
||||
var index = profilePicture.getUrlListCount() - 1;
|
||||
if (index <= 0) {
|
||||
var index = profilePicture.getUrlCount() - 1;
|
||||
if (index < 0) {
|
||||
return new Picture("");
|
||||
}
|
||||
var url = profilePicture.getUrlList(index);
|
||||
var url = profilePicture.getUrl(index);
|
||||
return new Picture(url);
|
||||
}
|
||||
|
||||
@@ -74,12 +69,11 @@ public class Picture {
|
||||
return CompletableFuture.supplyAsync(this::downloadImage);
|
||||
}
|
||||
|
||||
private BufferedImage download(String urlString)
|
||||
{
|
||||
if(urlString.isEmpty())
|
||||
{
|
||||
private BufferedImage download(String urlString) {
|
||||
if (urlString.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var baos = new ByteArrayOutputStream();
|
||||
try (var is = new URL(urlString).openStream()) {
|
||||
var byteChunk = new byte[4096];
|
||||
@@ -92,15 +86,36 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
public static Picture Empty() {
|
||||
public static Picture empty() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,6 +29,7 @@ import lombok.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Getter
|
||||
@@ -45,6 +46,12 @@ public class Text {
|
||||
this.value = computeValue();
|
||||
}
|
||||
|
||||
|
||||
public <T extends TextPiece> Optional<TextPiece> getTextPiece(Class<T> type)
|
||||
{
|
||||
return textPieces.stream().filter(e -> e.getClass().equals(type)).findFirst();
|
||||
}
|
||||
|
||||
public static Text map(io.github.jwdeveloper.tiktok.messages.data.Text input) {
|
||||
var pieces = input.getPiecesListList().stream().map(Text::mapTextPiece).toList();
|
||||
return new Text(input.getKey(), input.getDefaultPattern(), pieces);
|
||||
@@ -98,6 +105,7 @@ public class Text {
|
||||
}
|
||||
}
|
||||
|
||||
@Value
|
||||
public static class UserTextPiece extends TextPiece {
|
||||
User user;
|
||||
|
||||
|
||||
@@ -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());
|
||||
@@ -37,6 +37,4 @@ public class Badge {
|
||||
public static Badge empty() {
|
||||
return new Badge();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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,19 +24,22 @@ package io.github.jwdeveloper.tiktok.data.models.badges;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class CombineBadge extends Badge {
|
||||
private final Picture picture;
|
||||
private final String text;
|
||||
private final String subText;
|
||||
|
||||
|
||||
public CombineBadge(BadgeStruct.CombineBadge combineBadge) {
|
||||
|
||||
picture = Picture.map(combineBadge.getIcon());
|
||||
text = combineBadge.getText().getDefaultPattern();
|
||||
subText = combineBadge.getStr();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CombineBadge{picture=" + picture +", text='" + text + "', subText='" + subText + "'}";
|
||||
}
|
||||
}
|
||||
@@ -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,18 @@ package io.github.jwdeveloper.tiktok.data.models.badges;
|
||||
|
||||
import io.github.jwdeveloper.tiktok.data.models.Picture;
|
||||
import io.github.jwdeveloper.tiktok.messages.data.BadgeStruct;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class PictureBadge extends Badge {
|
||||
|
||||
private final Picture picture;
|
||||
public PictureBadge(BadgeStruct.ImageBadge imageBadge) {
|
||||
|
||||
public PictureBadge(BadgeStruct.ImageBadge imageBadge) {
|
||||
picture = Picture.map(imageBadge.getImage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PictureBadge{picture=" + picture + "}";
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user