001package com.box.sdkgen.schemas.realtimeserver;
002
003import com.box.sdkgen.internal.NullableFieldTracker;
004import com.box.sdkgen.internal.SerializableObject;
005import com.fasterxml.jackson.annotation.JsonFilter;
006import com.fasterxml.jackson.annotation.JsonProperty;
007import java.util.Objects;
008
009/** A real-time server that can be used for long polling user events. */
010@JsonFilter("nullablePropertyFilter")
011public class RealtimeServer extends SerializableObject {
012
013  /** The value will always be `realtime_server`. */
014  protected String type;
015
016  /** The URL for the server. */
017  protected String url;
018
019  /** The time in minutes for which this server is available. */
020  protected String ttl;
021
022  /**
023   * The maximum number of retries this server will allow before a new long poll should be started
024   * by getting a [new list of server](https://developer.box.com/reference/options-events).
025   */
026  @JsonProperty("max_retries")
027  protected String maxRetries;
028
029  /**
030   * The maximum number of seconds without a response after which you should retry the long poll
031   * connection.
032   *
033   * <p>This helps to overcome network issues where the long poll looks to be working but no
034   * packages are coming through.
035   */
036  @JsonProperty("retry_timeout")
037  protected Long retryTimeout;
038
039  public RealtimeServer() {
040    super();
041  }
042
043  protected RealtimeServer(Builder builder) {
044    super();
045    this.type = builder.type;
046    this.url = builder.url;
047    this.ttl = builder.ttl;
048    this.maxRetries = builder.maxRetries;
049    this.retryTimeout = builder.retryTimeout;
050    markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
051  }
052
053  public String getType() {
054    return type;
055  }
056
057  public String getUrl() {
058    return url;
059  }
060
061  public String getTtl() {
062    return ttl;
063  }
064
065  public String getMaxRetries() {
066    return maxRetries;
067  }
068
069  public Long getRetryTimeout() {
070    return retryTimeout;
071  }
072
073  @Override
074  public boolean equals(Object o) {
075    if (this == o) {
076      return true;
077    }
078    if (o == null || getClass() != o.getClass()) {
079      return false;
080    }
081    RealtimeServer casted = (RealtimeServer) o;
082    return Objects.equals(type, casted.type)
083        && Objects.equals(url, casted.url)
084        && Objects.equals(ttl, casted.ttl)
085        && Objects.equals(maxRetries, casted.maxRetries)
086        && Objects.equals(retryTimeout, casted.retryTimeout);
087  }
088
089  @Override
090  public int hashCode() {
091    return Objects.hash(type, url, ttl, maxRetries, retryTimeout);
092  }
093
094  @Override
095  public String toString() {
096    return "RealtimeServer{"
097        + "type='"
098        + type
099        + '\''
100        + ", "
101        + "url='"
102        + url
103        + '\''
104        + ", "
105        + "ttl='"
106        + ttl
107        + '\''
108        + ", "
109        + "maxRetries='"
110        + maxRetries
111        + '\''
112        + ", "
113        + "retryTimeout='"
114        + retryTimeout
115        + '\''
116        + "}";
117  }
118
119  public static class Builder extends NullableFieldTracker {
120
121    protected String type;
122
123    protected String url;
124
125    protected String ttl;
126
127    protected String maxRetries;
128
129    protected Long retryTimeout;
130
131    public Builder type(String type) {
132      this.type = type;
133      return this;
134    }
135
136    public Builder url(String url) {
137      this.url = url;
138      return this;
139    }
140
141    public Builder ttl(String ttl) {
142      this.ttl = ttl;
143      return this;
144    }
145
146    public Builder maxRetries(String maxRetries) {
147      this.maxRetries = maxRetries;
148      return this;
149    }
150
151    public Builder retryTimeout(Long retryTimeout) {
152      this.retryTimeout = retryTimeout;
153      return this;
154    }
155
156    public RealtimeServer build() {
157      return new RealtimeServer(this);
158    }
159  }
160}