org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputVenueMessageContent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of telegrambots-meta Show documentation
Show all versions of telegrambots-meta Show documentation
Easy to use library to create Telegram Bots
package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @version 1.0
* Represents the content of a venue message to be sent as the result of an inline query.
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them.
*/
public class InputVenueMessageContent implements InputMessageContent {
private static final String LATITUDE_FIELD = "latitude";
private static final String LONGITUDE_FIELD = "longitude";
private static final String TITLE_FIELD = "title";
private static final String ADDRESS_FIELD = "address";
private static final String FOURSQUAREID_FIELD = "foursquare_id";
private static final String FOURSQUARETYPE_FIELD = "foursquare_type";
@JsonProperty(LATITUDE_FIELD)
private Float latitude; ///< Latitude of the venue in degrees
@JsonProperty(LONGITUDE_FIELD)
private Float longitude; ///< Longitude of the venue in degrees
@JsonProperty(TITLE_FIELD)
private String title; ///< Name of the venue
@JsonProperty(ADDRESS_FIELD)
private String address; ///< Address of the venue
@JsonProperty(FOURSQUAREID_FIELD)
private String foursquareId; ///< Optional. Foursquare identifier of the venue, if known
@JsonProperty(FOURSQUARETYPE_FIELD)
private String foursquareType; ///< Optional. Foursquare type of the venue, if known.
public InputVenueMessageContent() {
super();
}
public Float getLatitude() {
return latitude;
}
public InputVenueMessageContent setLatitude(Float latitude) {
this.latitude = latitude;
return this;
}
public Float getLongitude() {
return longitude;
}
public InputVenueMessageContent setLongitude(Float longitude) {
this.longitude = longitude;
return this;
}
public String getTitle() {
return title;
}
public InputVenueMessageContent setTitle(String title) {
this.title = title;
return this;
}
public String getAddress() {
return address;
}
public InputVenueMessageContent setAddress(String address) {
this.address = address;
return this;
}
public String getFoursquareId() {
return foursquareId;
}
public InputVenueMessageContent setFoursquareId(String foursquareId) {
this.foursquareId = foursquareId;
return this;
}
public String getFoursquareType() {
return foursquareType;
}
public InputVenueMessageContent setFoursquareType(String foursquareType) {
this.foursquareType = foursquareType;
return this;
}
@Override
public void validate() throws TelegramApiValidationException {
if (latitude == null) {
throw new TelegramApiValidationException("Latitude parameter can't be empty", this);
}
if (longitude == null) {
throw new TelegramApiValidationException("Longitude parameter can't be empty", this);
}
if (title == null || title.isEmpty()) {
throw new TelegramApiValidationException("Title parameter can't be empty", this);
}
if (address == null || address.isEmpty()) {
throw new TelegramApiValidationException("Address parameter can't be empty", this);
}
}
@Override
public String toString() {
return "InputVenueMessageContent{" +
"latitude=" + latitude +
", longitude=" + longitude +
", title='" + title + '\'' +
", address='" + address + '\'' +
", foursquareId='" + foursquareId + '\'' +
", foursquareType='" + foursquareType + '\'' +
'}';
}
}