-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #412 from pengrad/request_extension
Add API method-specific extension functions
- Loading branch information
Showing
59 changed files
with
902 additions
and
555 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
library/src/main/java/com/pengrad/telegrambot/RequestPreprocessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.pengrad.telegrambot | ||
|
||
import com.pengrad.telegrambot.request.BaseRequest | ||
import com.pengrad.telegrambot.response.BaseResponse | ||
|
||
@get:JvmName("getEmptyRequestPreprocessor") | ||
val EMPTY_REQUEST_PREPROCESSOR: RequestPreprocessor = object : RequestPreprocessor { | ||
override fun <REQ : BaseRequest<REQ, RES>, RES : BaseResponse> process(request: BaseRequest<REQ, RES>) { | ||
// do nothing | ||
} | ||
} | ||
|
||
interface RequestPreprocessor { | ||
|
||
fun <REQ : BaseRequest<REQ, RES>, RES : BaseResponse> process(request: BaseRequest<REQ, RES>) | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
library/src/main/java/com/pengrad/telegrambot/TelegramAware.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.pengrad.telegrambot | ||
|
||
import com.pengrad.telegrambot.request.BaseRequest | ||
import com.pengrad.telegrambot.response.BaseResponse | ||
|
||
interface TelegramAware { | ||
|
||
fun <REQ : BaseRequest<REQ, RES>, RES : BaseResponse> execute(request: BaseRequest<REQ, RES>): RES | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
library/src/main/java/com/pengrad/telegrambot/model/PreparedInlineMessage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.pengrad.telegrambot.model | ||
|
||
data class PreparedInlineMessage( | ||
@get:JvmName("id") val id: String, | ||
@get:JvmName("expirationDate") val expirationDate: Int | ||
) |
92 changes: 0 additions & 92 deletions
92
library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.pengrad.telegrambot.model | ||
|
||
data class SuccessfulPayment( | ||
@get:JvmName("currency") val currency: String, | ||
@get:JvmName("totalAmount") val totalAmount: Int, | ||
@get:JvmName("invoicePayload") val invoicePayload: String, | ||
@get:JvmName("subscriptionExpirationDate") val subscriptionExpirationDate: Int? = null, | ||
@get:JvmName("isRecurring") val isRecurring: Boolean? = null, | ||
@get:JvmName("isFirstRecurring") val isFirstRecurring: Boolean? = null, | ||
@get:JvmName("shippingOptionId") val shippingOptionId: String? = null, | ||
@get:JvmName("orderInfo") val orderInfo: OrderInfo? = null, | ||
@get:JvmName("telegramPaymentChargeId") val telegramPaymentChargeId: String, | ||
@get:JvmName("providerPaymentChargeId") val providerPaymentChargeId: String | ||
) |
11 changes: 11 additions & 0 deletions
11
library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.pengrad.telegrambot.model.gift | ||
|
||
import com.pengrad.telegrambot.model.Sticker | ||
|
||
data class Gift( | ||
@get:JvmName("id") val id: String, | ||
@get:JvmName("sticker") val sticker: Sticker, | ||
@get:JvmName("starCount") val starCount: Int, | ||
@get:JvmName("totalCount") val totalCount: Int, | ||
@get:JvmName("remainingCount") val remainingCount: Int | ||
) |
18 changes: 18 additions & 0 deletions
18
library/src/main/java/com/pengrad/telegrambot/model/gift/Gifts.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.pengrad.telegrambot.model.gift | ||
|
||
data class Gifts( | ||
@get:JvmName("gifts") val gifts: Array<Gift> | ||
) { | ||
override fun equals(other: Any?): Boolean { | ||
if (this === other) return true | ||
if (other !is Gifts) return false | ||
|
||
if (!gifts.contentEquals(other.gifts)) return false | ||
|
||
return true | ||
} | ||
|
||
override fun hashCode(): Int { | ||
return gifts.contentHashCode() | ||
} | ||
} |
70 changes: 0 additions & 70 deletions
70
library/src/main/java/com/pengrad/telegrambot/model/stars/StarTransaction.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
library/src/main/java/com/pengrad/telegrambot/model/stars/StarTransaction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.pengrad.telegrambot.model.stars | ||
|
||
import com.pengrad.telegrambot.model.stars.partner.TransactionPartner | ||
|
||
data class StarTransaction( | ||
@get:JvmName("id") val id: String, | ||
@get:JvmName("amount") val amount: Int, | ||
@get:JvmName("nanostarAmount") val nanostarAmount: Int? = null, | ||
@get:JvmName("date") val date: Int, | ||
@get:JvmName("source") val source: TransactionPartner? = null, | ||
@get:JvmName("receiver") val receiver: TransactionPartner? = null | ||
) |
38 changes: 0 additions & 38 deletions
38
library/src/main/java/com/pengrad/telegrambot/model/stars/StarTransactions.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.