Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 1 month ago
JSON representation

Mixin bot SDK for Java/Kotlin

Awesome Lists containing this project

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