Penicillin

Full-featured Twitter API wrapper for Kotlin.

License

License

GroupId

GroupId

jp.nephy
ArtifactId

ArtifactId

penicillin
Last Version

Last Version

4.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

Penicillin
Full-featured Twitter API wrapper for Kotlin.
Project URL

Project URL

https://github.com/NephyProject/Penicillin
Source Code Management

Source Code Management

https://github.com/NephyProject/Penicillin

Download penicillin

How to add to project

<!-- https://jarcasting.com/artifacts/jp.nephy/penicillin/ -->
<dependency>
    <groupId>jp.nephy</groupId>
    <artifactId>penicillin</artifactId>
    <version>4.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/jp.nephy/penicillin/
implementation 'jp.nephy:penicillin:4.0.4'
// https://jarcasting.com/artifacts/jp.nephy/penicillin/
implementation ("jp.nephy:penicillin:4.0.4")
'jp.nephy:penicillin:jar:4.0.4'
<dependency org="jp.nephy" name="penicillin" rev="4.0.4">
  <artifact name="penicillin" type="jar" />
</dependency>
@Grapes(
@Grab(group='jp.nephy', module='penicillin', version='4.0.4')
)
libraryDependencies += "jp.nephy" % "penicillin" % "4.0.4"
[jp.nephy/penicillin "4.0.4"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Penicillin: Modern powerful Twitter API wrapper for Kotlin Multiplatform

Kotlin stable dev license issues pull requests

  • Supports JVM, Android (API level >= 24), JS (Both browsers and NodeJS).
  • Supports all the public Twitter API endpoints.
  • Supports the following authenticating methods: OAuth 1.0a, OAuth 2.0
  • Supports some private Twitter API endpoints such as Poll Tweets.
  • Endpoint's parameters are resolved as Kotlin "Typed-safe Named Parameter".
  • Penicillin has model classes. So responses are easy to use.
  • API's execution supports classical blocking function .complete(), suspend function .execute(), deferred operation .executeAsync() and callback style .queue {}.
  • Cursor APIs such as friends/list have methods named .next, .untilLast(). It makes paging easy.

Documentations are available at docs.starry.blue.

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

More examples of Penicillin can be found at Wiki. Please feel free to create new issue if you have any questions.

Get Started

Latest Penicillin version is Stable or Dev.

Stable releases are available at Bintray. EAP builds are also available (Dev Repository). Every commit is published as EAP build.

You may choose preferred Ktor HttpClient Engine. We recommend using Apache or CIO engine on JVM.
Full engine list is available at https://ktor.io/clients/http-client/engines.html.

Gradle

build.gradle.kts:

val ktorVersion: String = "1.5.0"

repositories {
    mavenCentral()
    jcenter()
    maven(url = "https://kotlin.bintray.com/kotlinx")
    
    maven(url = "https://dl.bintray.com/starry-blue-sky/stable")
    // or dev repository if EAP builds preferred
    // maven(url = "https://dl.bintray.com/starry-blue-sky/dev")
}

kotlin {
    sourceSets {
        named("commonMain") {
            dependencies {
                implementation("blue.starry:penicillin:$PenicillinVersion")
            }
        }

        // Not needed anymore: Penicillin 6.0.0+
        named("jvmMain") {
        }
        named("jsMain") {
        }
    }
}

Compatibility

Currently, Penicillin works on JVM (Java 8), Android (API level >= 24) or JS (both browsers and NodeJS).

In the future, Penicillin is plan to support Kotlin/Native. It brings the benefits of reuse for Kotlin code and saves you from wasting time.
For example, if you only write Kotlin code once, it can be compiled for JVM, JavaScript, iOS, Android, Windows, macOS and so on.

In Android development, we confirmed that Penicillin works only on API level 24 or greater. It's caused by Ktor-side restriction. Detail information is here.

Contributing

License

Penicillin is provided under the MIT license.

Copyright (c) 2017-2020 StarryBlueSky.

Versions

Version
4.0.4
4.0.3
4.0.2
4.0.1
4.0.0-eap-1
4.0.0
3.3.4
3.3.3
3.3.2
3.3.1
3.3.0
3.2.3
3.2.2
3.2.1
3.2.0
3.1.0
3.1.0-rc-2
3.1.0-rc-1
3.0.22
3.0.21
3.0.20
3.0.19
3.0.18
3.0.17
3.0.16
3.0.15
3.0.14
3.0.13
3.0.12
3.0.11
3.0.10
3.0.9
3.0.8
3.0.7
3.0.6
3.0.5
3.0.4
3.0.3
3.0.2
3.0.1
3.0.0
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.4.1
1.4.0
1.3.1
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0