Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MixinNetwork/bot-api-kotlin-client
Mixin bot SDK for Java/Kotlin
https://github.com/MixinNetwork/bot-api-kotlin-client
kotlin
Last synced: 4 months ago
JSON representation
Mixin bot SDK for Java/Kotlin
- Host: GitHub
- URL: https://github.com/MixinNetwork/bot-api-kotlin-client
- Owner: MixinNetwork
- License: apache-2.0
- Created: 2020-08-25T14:32:38.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-01-29T08:23:44.000Z (about 1 year ago)
- Last Synced: 2024-02-17T12:38:38.680Z (12 months ago)
- Topics: kotlin
- Language: Kotlin
- Homepage:
- Size: 12.4 MB
- Stars: 4
- Watchers: 10
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mixin - Kotlin SDK
README
# bot-api-kotlin-client
The [Mixin Network](https://mixin.one/) based wallet allows for the rapid construction of decentralized wallets, decentralized on-chain exchanges, and other products.# Installation
## gradle
Add it in your root build.gradle at the end of repositories:
```
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Add the dependency
```
dependencies {
implementation 'com.github.MixinNetwork:bot-api-kotlin-client:v1.0.0'
}
```## maven
Add the JitPack repository to your build file
```
jitpack.io
https://jitpack.io
```
Add the dependency
```com.github.MixinNetwork
bot-api-kotlin-client
v1.0.0```
## Send and Receive Messages
```kotlin
fun main(): Unit = runBlocking {
val job = launch {
val keyPair = newKeyPairFromPrivateKey(Config.privateKey.base64Decode())
val blazeClient = BlazeClient.Builder()
.configSafeUser(Config.userId, Config.sessionId, keyPair.privateKey)
.enableDebug()
.enableParseData()
.enableAutoAck()
.blazeHandler(MyBlazeHandler())
.build()
blazeClient.start()
}
job.join()
}private class MyBlazeHandler : BlazeHandler {
override fun onMessage(webSocket: WebSocket, blazeMsg: BlazeMsg): Boolean {
println(blazeMsg)
blazeMsg.data?.let { data ->
sendTextMsg(webSocket, data.conversionId, data.userId, "read")
}
return true
}
}
```# Licence
[WTFPL](http://www.wtfpl.net/txt/copying/)