Skip to content

Commit

Permalink
Merge pull request #388 from mircoianese/api_v7.5
Browse files Browse the repository at this point in the history
BOT API v7.5
  • Loading branch information
pengrad authored Jul 8, 2024
2 parents c3a5449 + 691b0ee commit f501d8b
Show file tree
Hide file tree
Showing 35 changed files with 603 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public Boolean canDeleteMessages() {
/**
* @deprecated Use canManageVideoChats() instead
*/
@Deprecated
public Boolean canManageVoiceChats() {
return canManageVideoChats();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class BusinessConnection {

private String id;
private User user;
private Integer user_chat_id;
private Long user_chat_id;
private Integer date;
private Boolean can_reply;
private Boolean is_enabled;
Expand All @@ -21,7 +21,7 @@ public User user() {
return user;
}

public Integer userChatId() {
public Long userChatId() {
return user_chat_id;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ public class MessageOrigin implements Serializable {
protected String type;
protected Integer date;

public MessageOrigin(String type) {
this.type = type;
}

public String type() {
return type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ public class MessageOriginChannel extends MessageOrigin {

private String author_signature;

public MessageOriginChannel() {
super(MESSAGE_ORIGIN_TYPE);
}

public Chat chat() {
return chat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public class MessageOriginChat extends MessageOrigin {
private Chat sender_chat;
private String author_signature;

public MessageOriginChat() {
super(MESSAGE_ORIGIN_TYPE);
}
public Chat senderChat() {
return sender_chat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ public class MessageOriginHiddenUser extends MessageOrigin {

private String sender_user_name;

public MessageOriginHiddenUser() {
super(MESSAGE_ORIGIN_TYPE);
}

public String senderUserName() {
return sender_user_name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public class MessageOriginUser extends MessageOrigin {

private User sender_user;

public MessageOriginUser() {
super(MESSAGE_ORIGIN_TYPE);
}
public User senderUser() {
return sender_user;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public InputInvoiceMessageContent(String title, String description, String paylo
* Backward compatibility: API 7.4, parameter "provider_token" became optional
* @deprecated Use constrcutor without 'provider_token' instead
*/
@Deprecated
public InputInvoiceMessageContent(String title, String description, String payload, String providerToken, String currency, LabeledPrice[] prices) {
this.title = title;
this.description = description;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.pengrad.telegrambot.model.stars;

import com.pengrad.telegrambot.model.stars.partner.TransactionPartner;

import java.io.Serializable;
import java.util.Objects;

public class StarTransaction implements Serializable {

private final static long serialVersionUID = 0L;

private String id;
private Integer amount;
private Integer date;

private TransactionPartner source;

private TransactionPartner receiver;


public String id() {
return id;
}

public Integer amount() {
return amount;
}

public Integer date() {
return date;
}

public TransactionPartner source() {
return source;
}

public TransactionPartner receiver() {
return receiver;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

StarTransaction that = (StarTransaction) o;
return Objects.equals(id, that.id) &&
Objects.equals(amount, that.amount) &&
Objects.equals(date, that.date) &&
Objects.equals(source, that.source) &&
Objects.equals(receiver, that.receiver);
}

@Override
public int hashCode() {
return Objects.hash(id, amount, date, source, receiver);
}

@Override
public String toString() {
return "StarTransaction{" +
"id='" + id + "'," +
"amount='" + amount + "'," +
"date='" + date + "'," +
"source='" + source + "'," +
"receiver='" + receiver + "'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.pengrad.telegrambot.model.stars;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

public class StarTransactions implements Serializable {

private final static long serialVersionUID = 0L;

private StarTransaction[] transactions;

public StarTransaction[] transactions() {
return transactions;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

StarTransactions that = (StarTransactions) o;
return Arrays.equals(transactions, that.transactions);
}

@Override
public int hashCode() {
return Arrays.hashCode(transactions);
}

@Override
public String toString() {
return "StarTransactions{" +
"transactions='" + Arrays.toString(transactions) + "'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.pengrad.telegrambot.model.stars.partner;

import java.io.Serializable;
import java.util.Objects;

public abstract class TransactionPartner implements Serializable {

private final static long serialVersionUID = 0L;

private String type;

public TransactionPartner(String type) {
this.type = type;
}

public String type() {
return type;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;

TransactionPartner that = (TransactionPartner) o;
return Objects.equals(type, that.type);
}

@Override
public int hashCode() {
return Objects.hash(type);
}

@Override
public String toString() {
return "TransactionPartner{" +
"type='" + type + "'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.pengrad.telegrambot.model.stars.partner;

import com.pengrad.telegrambot.model.stars.withdrawal.RevenueWithdrawalState;

import java.util.Objects;

public class TransactionPartnerFragment extends TransactionPartner {

public final static String TYPE = "fragment";

private RevenueWithdrawalState withdrawal_state;

public TransactionPartnerFragment() {
super(TYPE);
}

public RevenueWithdrawalState withdrawalState() {
return withdrawal_state;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TransactionPartnerFragment that = (TransactionPartnerFragment) o;
return Objects.equals(type(), that.type()) &&
Objects.equals(withdrawal_state, that.withdrawal_state);
}

@Override
public int hashCode() {
return Objects.hash(type(), withdrawal_state);
}

@Override
public String toString() {
return "TransactionPartnerFragment{" +
"type='" + type() + "\'," +
", withdrawal_state=" + withdrawal_state + "\'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.pengrad.telegrambot.model.stars.partner;

import java.util.Objects;

public class TransactionPartnerOther extends TransactionPartner {

public final static String TYPE = "other";

public TransactionPartnerOther() {
super(TYPE);
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TransactionPartnerOther that = (TransactionPartnerOther) o;
return Objects.equals(type(), that.type());
}

@Override
public int hashCode() {
return Objects.hash(type());
}

@Override
public String toString() {
return "TransactionPartnerOther{" +
"type='" + type() + "\'" +
'}';
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.pengrad.telegrambot.model.stars.partner;

import java.util.Objects;

public class TransactionPartnerTelegramAds extends TransactionPartner {

public final static String TYPE = "telegram_ads";

public TransactionPartnerTelegramAds() {
super(TYPE);
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TransactionPartnerTelegramAds that = (TransactionPartnerTelegramAds) o;
return Objects.equals(type(), that.type());
}

@Override
public int hashCode() {
return Objects.hash(type());
}

@Override
public String toString() {
return "TransactionPartnerTelegramAds{" +
"type='" + type() + "\'" +
'}';
}

}
Loading

0 comments on commit f501d8b

Please sign in to comment.