Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot API v8.0 #408

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
testImplementation 'junit:junit:4.13.1'
testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.1.13'
testImplementation 'org.reflections:reflections:0.9.12'
testImplementation 'org.jetbrains.kotlin:kotlin-reflect'
}

jar {
Expand Down
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
)

This file was deleted.

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 library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt
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 library/src/main/java/com/pengrad/telegrambot/model/gift/Gifts.kt
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()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.pengrad.telegrambot.model.User;
import com.pengrad.telegrambot.model.chatbackground.BackgroundFillFreeformGradient;
import com.pengrad.telegrambot.model.gift.Gift;
import com.pengrad.telegrambot.model.paidmedia.PaidMedia;

import java.util.Arrays;
Expand All @@ -15,6 +16,8 @@ public class TransactionPartnerUser extends TransactionPartner {
private String invoice_payload;
private PaidMedia[] paid_media;
private String paid_media_payload;
private Integer subscription_period;
private Gift gift;

public TransactionPartnerUser() {
super(TYPE);
Expand All @@ -36,6 +39,14 @@ public String paidMediaPayload() {
return paid_media_payload;
}

public Integer subscriptionPeriod() {
return subscription_period;
}

public Gift gift() {
return gift;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -45,12 +56,22 @@ public boolean equals(Object o) {
return Objects.equals(user, that.user)
&& Objects.equals(invoice_payload, that.invoice_payload)
&& Objects.deepEquals(paid_media, that.paid_media)
&& Objects.equals(paid_media_payload, that.paid_media_payload);
&& Objects.equals(paid_media_payload, that.paid_media_payload)
&& Objects.equals(subscription_period, that.subscription_period)
&& Objects.equals(gift, that.gift);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), user, invoice_payload, Arrays.hashCode(paid_media));
return Objects.hash(
super.hashCode(),
user,
invoice_payload,
Arrays.hashCode(paid_media),
paid_media_payload,
subscription_period,
gift
);
}

@Override
Expand All @@ -60,6 +81,8 @@ public String toString() {
", invoice_payload='" + invoice_payload + '\'' +
", paid_media=" + Arrays.toString(paid_media) +
", paid_media_payload='" + paid_media_payload + '\'' +
", subscription_period='" + subscription_period + '\'' +
", gift=" + gift +
'}';
}
}

This file was deleted.

Loading
Loading