nl.reinkrul.nuts.network.Contact Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-client Show documentation
Show all versions of java-client Show documentation
Java client library for using the Nuts Node's REST API.
/*
* Nuts Network API spec
* API specification for RPC services available at the nuts-network
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package nl.reinkrul.nuts.network;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.time.OffsetDateTime;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* Describes the contact information of a node.
*/
@JsonPropertyOrder({
Contact.JSON_PROPERTY_ADDRESS,
Contact.JSON_PROPERTY_DID,
Contact.JSON_PROPERTY_ATTEMPTS,
Contact.JSON_PROPERTY_LAST_ATTEMPT
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-05-12T15:13:44.607072+02:00[Europe/Amsterdam]")
public class Contact {
public static final String JSON_PROPERTY_ADDRESS = "address";
private String address;
public static final String JSON_PROPERTY_DID = "did";
private String did;
public static final String JSON_PROPERTY_ATTEMPTS = "attempts";
private Integer attempts;
public static final String JSON_PROPERTY_LAST_ATTEMPT = "lastAttempt";
private OffsetDateTime lastAttempt;
public Contact() {
}
public Contact address(String address) {
this.address = address;
return this;
}
/**
* Address of the node.
* @return address
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_ADDRESS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getAddress() {
return address;
}
@JsonProperty(JSON_PROPERTY_ADDRESS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setAddress(String address) {
this.address = address;
}
public Contact did(String did) {
this.did = did;
return this;
}
/**
* DID of the node.
* @return did
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_DID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getDid() {
return did;
}
@JsonProperty(JSON_PROPERTY_DID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setDid(String did) {
this.did = did;
}
public Contact attempts(Integer attempts) {
this.attempts = attempts;
return this;
}
/**
* Number of connection attempts since the node has (re-)started. It is reset to 0 when the connection succeeds.
* @return attempts
**/
@javax.annotation.Nonnull
@JsonProperty(JSON_PROPERTY_ATTEMPTS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public Integer getAttempts() {
return attempts;
}
@JsonProperty(JSON_PROPERTY_ATTEMPTS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public void setAttempts(Integer attempts) {
this.attempts = attempts;
}
public Contact lastAttempt(OffsetDateTime lastAttempt) {
this.lastAttempt = lastAttempt;
return this;
}
/**
* Timestamp of the last attempt to contact the address.
* @return lastAttempt
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_LAST_ATTEMPT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public OffsetDateTime getLastAttempt() {
return lastAttempt;
}
@JsonProperty(JSON_PROPERTY_LAST_ATTEMPT)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setLastAttempt(OffsetDateTime lastAttempt) {
this.lastAttempt = lastAttempt;
}
/**
* Return true if this Contact object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Contact contact = (Contact) o;
return Objects.equals(this.address, contact.address) &&
Objects.equals(this.did, contact.did) &&
Objects.equals(this.attempts, contact.attempts) &&
Objects.equals(this.lastAttempt, contact.lastAttempt);
}
@Override
public int hashCode() {
return Objects.hash(address, did, attempts, lastAttempt);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Contact {\n");
sb.append(" address: ").append(toIndentedString(address)).append("\n");
sb.append(" did: ").append(toIndentedString(did)).append("\n");
sb.append(" attempts: ").append(toIndentedString(attempts)).append("\n");
sb.append(" lastAttempt: ").append(toIndentedString(lastAttempt)).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 ");
}
/**
* Convert the instance into URL query string.
*
* @return URL query string
*/
public String toUrlQueryString() {
return toUrlQueryString(null);
}
/**
* Convert the instance into URL query string.
*
* @param prefix prefix of the query string
* @return URL query string
*/
public String toUrlQueryString(String prefix) {
String suffix = "";
String containerSuffix = "";
String containerPrefix = "";
if (prefix == null) {
// style=form, explode=true, e.g. /pet?name=cat&type=manx
prefix = "";
} else {
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
prefix = prefix + "[";
suffix = "]";
containerSuffix = "]";
containerPrefix = "[";
}
StringJoiner joiner = new StringJoiner("&");
// add `address` to the URL query string
if (getAddress() != null) {
joiner.add(String.format("%saddress%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAddress()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `did` to the URL query string
if (getDid() != null) {
joiner.add(String.format("%sdid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDid()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `attempts` to the URL query string
if (getAttempts() != null) {
joiner.add(String.format("%sattempts%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getAttempts()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
// add `lastAttempt` to the URL query string
if (getLastAttempt() != null) {
joiner.add(String.format("%slastAttempt%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getLastAttempt()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
}
return joiner.toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy