com.sinch.sdk.domains.conversation.models.v1.credentials.TelegramCredentialsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sinch-sdk-java Show documentation
Show all versions of sinch-sdk-java Show documentation
SDK providing a Java API for the Sinch REST APIs.
package com.sinch.sdk.domains.conversation.models.v1.credentials;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.sinch.sdk.core.models.OptionalValue;
import java.util.Objects;
@JsonPropertyOrder({TelegramCredentialsImpl.JSON_PROPERTY_TOKEN})
@JsonFilter("uninitializedFilter")
@JsonInclude(value = JsonInclude.Include.CUSTOM)
public class TelegramCredentialsImpl implements TelegramCredentials, ChannelCredentials {
private static final long serialVersionUID = 1L;
public static final String JSON_PROPERTY_TOKEN = "token";
private OptionalValue token;
public TelegramCredentialsImpl() {}
protected TelegramCredentialsImpl(OptionalValue token) {
this.token = token;
}
@JsonIgnore
public String getToken() {
return token.orElse(null);
}
@JsonProperty(JSON_PROPERTY_TOKEN)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public OptionalValue token() {
return token;
}
/** Return true if this Telegram_Credentials object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TelegramCredentialsImpl telegramCredentials = (TelegramCredentialsImpl) o;
return Objects.equals(this.token, telegramCredentials.token);
}
@Override
public int hashCode() {
return Objects.hash(token);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TelegramCredentialsImpl {\n");
sb.append(" token: ").append(toIndentedString("***")).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
@JsonPOJOBuilder(withPrefix = "set")
static class Builder implements TelegramCredentials.Builder {
OptionalValue token = OptionalValue.empty();
@JsonProperty(JSON_PROPERTY_TOKEN)
public Builder setToken(String token) {
this.token = OptionalValue.of(token);
return this;
}
public TelegramCredentials build() {
return new TelegramCredentialsImpl(token);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy