Skip to content

Commit

Permalink
Version 7.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Miatello committed Jul 8, 2024
1 parent ebbce8d commit 46c68b7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Full API documentation of Telegram Bot API
https://core.telegram.org/bots/api

**Library API version 7.7.2**
**Library API version 7.7.3**

This library has 3 modules:
- Module [:dataclass:](#how-to-use-dataclass-module)
Expand Down Expand Up @@ -45,7 +45,7 @@ This module contains only 1 file: [TelegramModels.kt](dataclass/src/commonMain/k
Add this in your `build.gradle.ktx` file:
```kotlin
// `data class` with Kotlinx/Serialization
implementation("com.github.omarmiatello.telegram:dataclass:7.7.2")
implementation("com.github.omarmiatello.telegram:dataclass:7.7.3")
```

### Example 1 - Ktor 3.0 server
Expand Down Expand Up @@ -117,7 +117,7 @@ See [https://github.com/omarmiatello/github-actions-kotlin-script-template](http
#!/usr/bin/env kotlin
@file:Repository("https://repo.maven.apache.org/maven2")
@file:DependsOn("com.github.omarmiatello.kotlin-script-toolbox:zero-setup:0.0.3")
@file:DependsOn("com.github.omarmiatello.telegram:client-jvm:7.7.2")
@file:DependsOn("com.github.omarmiatello.telegram:client-jvm:7.7.3")
@file:DependsOn("io.ktor:ktor-client-okhttp-jvm:3.0.0") // required for com.github.omarmiatello.telegram:client

import com.github.omarmiatello.kotlinscripttoolbox.core.launchKotlinScriptToolbox
Expand Down Expand Up @@ -265,7 +265,7 @@ This module contains only 2 file: [TelegramModels.kt](dataclass/src/commonMain/k
Add this in your `build.gradle.ktx` file:
```kotlin
// `data class` with Kotlinx/Serialization + Ktor client
implementation("com.github.omarmiatello.telegram:client:7.7.2")
implementation("com.github.omarmiatello.telegram:client:7.7.3")
```

### Send a message to a user/group/channel
Expand Down Expand Up @@ -331,13 +331,13 @@ NOTE: Not for beginner. Guide [here](docs/dataclass-only.md).
Add this in your `build.gradle.ktx` file:
```kotlin
// alternative, contains: `data class` with Kotlinx/Serialization + Ktor client
implementation("com.github.omarmiatello.telegram:client:7.7.2")
implementation("com.github.omarmiatello.telegram:client:7.7.3")

// alternative, contains only: `data class` with Kotlinx/Serialization
implementation("com.github.omarmiatello.telegram:dataclass:7.7.2")
implementation("com.github.omarmiatello.telegram:dataclass:7.7.3")

// alternative, contains only: `data class` (for plain Java/Kotlin project)
implementation("com.github.omarmiatello.telegram:dataclass-only:7.7.2")
implementation("com.github.omarmiatello.telegram:dataclass-only:7.7.3")
```

## License
Expand Down
2 changes: 1 addition & 1 deletion client/src/commonMain/kotlin/TelegramClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.Json
class TelegramClient(apiKey: String, private val httpClient: HttpClient = HttpClient()) {
private val basePath = "https://api.telegram.org/bot$apiKey"
private val json = Json { ignoreUnknownKeys = true; prettyPrint = true; encodeDefaults = false }
private val json = Json { ignoreUnknownKeys = true; prettyPrint = true; encodeDefaults = false; isLenient = true }

private suspend fun <T> telegramGet(path: String, response: KSerializer<T>): TelegramResponse<T> {
val responseString: String = httpClient.get(path).body()
Expand Down
9 changes: 4 additions & 5 deletions dataclass/src/commonMain/kotlin/TelegramModels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
import kotlin.jvm.JvmInline

private val json = Json {
ignoreUnknownKeys = true
prettyPrint = true
encodeDefaults = false
}
private val json = Json { ignoreUnknownKeys = true; prettyPrint = true; encodeDefaults = false; isLenient = true; }

sealed class TelegramModel {
abstract fun toJson(): String
Expand Down Expand Up @@ -70,12 +66,15 @@ value class ChatId(val stringValue: String) {
@Serializable
@JvmInline
value class MessageId(val longValue: Long)

@Serializable
@JvmInline
value class BusinessConnectionId(val stringValue: String)

@Serializable
@JvmInline
value class MessageThreadId(val longValue: Long)

@Serializable
@JvmInline
value class MessageEffectId(val stringValue: String)
Expand Down
2 changes: 1 addition & 1 deletion docs/dataclass-only.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Contains a simple list of data class

Add this in your root `build.gradle.ktx` file:
```kotlin
implementation("com.github.omarmiatello.telegram:dataclass-only:7.7.2")
implementation("com.github.omarmiatello.telegram:dataclass-only:7.7.3")
```

### Example
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.github.omarmiatello.telegram
version=7.7.2
version=7.7.3

pomUrl=https://github.com/omarmiatello/telegram
pomScmUrl=https://github.com/omarmiatello/telegram
Expand Down

0 comments on commit 46c68b7

Please sign in to comment.