johnjacobkenny / Penicillin

Modern powerful Twitter API wrapper for Kotlin Multiplatform. #PureKotlin

Home Page:https://starrybluesky.github.io/Penicillin/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Penicillin: Modern powerful Twitter API wrapper for Kotlin Multiplatform

Kotlin GitHub release (latest by date) GitHub Workflow Status license issues pull requests

  • Supports Java 8 or later, Android (API level 24 or higher), JavaScript target.
  • Supports all of Twitter's v1.1 public APIs and some v2 public and private APIs.
  • All endpoint parameters can be represented by named parameters.
  • There are model classes for response JSON, which can be accessed type-safely.
  • Paging APIs can be handled by Flow.

Documentation is available at GitHub Pages.

Quick Example

suspend fun main() {
    // Creates new ApiClient
    PenicillinClient {
        account {
            application("ConsumerKey", "ConsumerSecret")
            token("AccessToken", "AccessToken Secret")
        }
    }.use { client ->
        // Retrieves user timeline from @realdonaldtrump up to 100.
        client.timeline.userTimeline(screenName = "realdonaldtrump", count = 100).execute().forEach { status ->
            // Prints status text.
            println(status.text)
        }
    }
}

Other examples can be found at Wiki. If you have any questions, please let us know at Issue.

Get Started

Penicillin is now available in the Maven Central since version 6.1.0. The previous Bintray repository is no longer available.

GitHub release (latest by date)

Gradle

build.gradle.kts:

dependencies {
    implementation("blue.starry:penicillin:$PenicillinVersion")
    
    // Choose your favorite engine from https://ktor.io/clients/http-client/engines.html
    // The version should match the version of Ktor that Penicillin is using.
    implementation("io.ktor:ktor-client-apache:$KtorVersion")
    implementation("io.ktor:ktor-client-cio:$KtorVersion")
}

License

Penicillin is provided under the MIT license.

Copyright (c) 2017-2021 StarryBlueSky.

About

Modern powerful Twitter API wrapper for Kotlin Multiplatform. #PureKotlin

https://starrybluesky.github.io/Penicillin/

License:MIT License


Languages

Language:Kotlin 100.0%