English | 中文
🌟 This project has now become a Kotlin Multiplatform library.
A Kotlin Multiplatform library for parsing KeyFC pages into structured data classes.
- Index (archiver)
- Forum (archiver)
- Topic (archiver)
- Login
- Search
- User center
- Notification
- Inbox
- My topics
- My posts
- My favourites
This library is not yet published to a public Maven repository. Only the first version is available on JitPack, which is JVM and Android only.
To use it, you need to build and publish it to your local Maven repository.
First clone this repository:
git clone https://github.com/huaium/keyfc-api.gitBuild and publish the library to local Maven repository:
./gradlew :library:clean :library:publishToMavenLocal -x checkSwitch to your project, and add the following content to settings.gradle.kts at the beginning of repositories:
dependencyResolutionManagement {
repositories {
mavenLocal()
// other repositories...
}
}Then add the dependency to build.gradle.kts in your module:
dependencies {
implementation("net.keyfc:api:<tag>")
}Let's say you want to fetch data from the forum page with ID 52:
val result: Result<ForumPage> =
// Run in a coroutine scope, required by login and fetchForum
runBlocking {
KeyfcClient()
// Assume you've got username and password as String
.apply { login(username, password) }
.use { it.fetchForum("52") }
}
result.fold(
onSuccess = { forumPage ->
// Do something with the forum page
},
onFailure = { exception ->
// Handle the exception
}
)For more, see example.
Please refer to LICENSE.