Skip to content

A Kotlin Multiplatform library for parsing KeyFC pages into structured data classes.

License

Notifications You must be signed in to change notification settings

huaium/keyfc-api

Repository files navigation

keyfc-api

GitHub Tag

English | 中文

🌟 This project has now become a Kotlin Multiplatform library.

A Kotlin Multiplatform library for parsing KeyFC pages into structured data classes.

Supported

Installation

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.git

Build and publish the library to local Maven repository:

./gradlew :library:clean :library:publishToMavenLocal -x check

Switch 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>")
}

Example

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.

License

Please refer to LICENSE.

About

A Kotlin Multiplatform library for parsing KeyFC pages into structured data classes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages