Skip to content

Commit

Permalink
Version 7.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Omar Miatello committed Jul 7, 2024
1 parent b4bc744 commit 7fd3167
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 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.6**
**Library API version 7.7**

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.6")
implementation("com.github.omarmiatello.telegram:dataclass:7.7")
```

### 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.6")
@file:DependsOn("com.github.omarmiatello.telegram:client-jvm:7.7")
@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.6")
implementation("com.github.omarmiatello.telegram:client:7.7")
```

### 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.6")
implementation("com.github.omarmiatello.telegram:client:7.7")

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

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

## License
Expand Down
21 changes: 21 additions & 0 deletions dataclass-only/src/commonMain/kotlin/TelegramModelsOnly.kt
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ data class ChatFullInfo(
* @property pinned_message <em>Optional</em>. Specified message was pinned. Note that the Message object in this field will not contain further <em>reply_to_message</em> fields even if it itself is a reply.
* @property invoice <em>Optional</em>. Message is an invoice for a <a href="#payments">payment</a>, information about the invoice. <a href="#payments">More about payments »</a>
* @property successful_payment <em>Optional</em>. Message is a service message about a successful payment, information about the payment. <a href="#payments">More about payments »</a>
* @property refunded_payment <em>Optional</em>. Message is a service message about a refunded payment, information about the payment. <a href="#payments">More about payments »</a>
* @property users_shared <em>Optional</em>. Service message: users were shared with the bot
* @property chat_shared <em>Optional</em>. Service message: a chat was shared with the bot
* @property connected_website <em>Optional</em>. The domain name of the website on which the user has logged in. <a href="/widgets/login">More about Telegram Login »</a>
Expand Down Expand Up @@ -421,6 +422,7 @@ data class Message(
val pinned_message: MaybeInaccessibleMessage? = null,
val invoice: Invoice? = null,
val successful_payment: SuccessfulPayment? = null,
val refunded_payment: RefundedPayment? = null,
val users_shared: UsersShared? = null,
val chat_shared: ChatShared? = null,
val connected_website: String? = null,
Expand Down Expand Up @@ -3749,6 +3751,25 @@ data class SuccessfulPayment(
val order_info: OrderInfo? = null,
) : TelegramModel()

/**
* <p>This object contains basic information about a refunded payment.</p>
*
* @property currency Three-letter ISO 4217 <a href="/bots/payments#supported-currencies">currency</a> code, or “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>. Currently, always “XTR”
* @property total_amount Total refunded price in the <em>smallest units</em> of the currency (integer, <strong>not</strong> float/double). For example, for a price of <code>US$ 1.45</code>, <code>total_amount = 145</code>. See the <em>exp</em> parameter in <a href="/bots/payments/currencies.json">currencies.json</a>, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
* @property invoice_payload Bot-specified invoice payload
* @property telegram_payment_charge_id Telegram payment identifier
* @property provider_payment_charge_id <em>Optional</em>. Provider payment identifier
*
* @constructor Creates a [RefundedPayment].
* */
data class RefundedPayment(
val currency: String,
val total_amount: Long,
val invoice_payload: String,
val telegram_payment_charge_id: String,
val provider_payment_charge_id: String? = null,
) : TelegramModel()

/**
* <p>This object contains information about an incoming shipping query.</p>
*
Expand Down
28 changes: 28 additions & 0 deletions dataclass/src/commonMain/kotlin/TelegramModels.kt
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ data class ChatFullInfo(
* @property pinned_message <em>Optional</em>. Specified message was pinned. Note that the Message object in this field will not contain further <em>reply_to_message</em> fields even if it itself is a reply.
* @property invoice <em>Optional</em>. Message is an invoice for a <a href="#payments">payment</a>, information about the invoice. <a href="#payments">More about payments »</a>
* @property successful_payment <em>Optional</em>. Message is a service message about a successful payment, information about the payment. <a href="#payments">More about payments »</a>
* @property refunded_payment <em>Optional</em>. Message is a service message about a refunded payment, information about the payment. <a href="#payments">More about payments »</a>
* @property users_shared <em>Optional</em>. Service message: users were shared with the bot
* @property chat_shared <em>Optional</em>. Service message: a chat was shared with the bot
* @property connected_website <em>Optional</em>. The domain name of the website on which the user has logged in. <a href="/widgets/login">More about Telegram Login »</a>
Expand Down Expand Up @@ -909,6 +910,7 @@ data class Message(
val pinned_message: @Contextual MaybeInaccessibleMessage? = null,
val invoice: Invoice? = null,
val successful_payment: SuccessfulPayment? = null,
val refunded_payment: RefundedPayment? = null,
val users_shared: UsersShared? = null,
val chat_shared: ChatShared? = null,
val connected_website: String? = null,
Expand Down Expand Up @@ -5391,6 +5393,32 @@ data class SuccessfulPayment(
}
}

/**
* <p>This object contains basic information about a refunded payment.</p>
*
* @property currency Three-letter ISO 4217 <a href="/bots/payments#supported-currencies">currency</a> code, or “XTR” for payments in <a href="https://t.me/BotNews/90">Telegram Stars</a>. Currently, always “XTR”
* @property total_amount Total refunded price in the <em>smallest units</em> of the currency (integer, <strong>not</strong> float/double). For example, for a price of <code>US$ 1.45</code>, <code>total_amount = 145</code>. See the <em>exp</em> parameter in <a href="/bots/payments/currencies.json">currencies.json</a>, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
* @property invoice_payload Bot-specified invoice payload
* @property telegram_payment_charge_id Telegram payment identifier
* @property provider_payment_charge_id <em>Optional</em>. Provider payment identifier
*
* @constructor Creates a [RefundedPayment].
* */
@Serializable
data class RefundedPayment(
val currency: String,
val total_amount: Long,
val invoice_payload: String,
val telegram_payment_charge_id: String,
val provider_payment_charge_id: String? = null,
) : TelegramModel() {
override fun toJson() = json.encodeToString(serializer(), this)

companion object {
fun fromJson(string: String) = json.decodeFromString(serializer(), string)
}
}

/**
* <p>This object contains information about an incoming shipping query.</p>
*
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.6")
implementation("com.github.omarmiatello.telegram:dataclass-only:7.7")
```

### 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.6
version=7.7

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

0 comments on commit 7fd3167

Please sign in to comment.