001/*
002 * Jupyter Server API
003 * Server API
004 *
005 * The version of the OpenAPI document: 5
006 *
007 *
008 * NOTE: This class is auto generated by OpenAPI Generator
009 * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
010 * the class manually.
011 */
012
013package ganymede.jupyter.notebook.model;
014
015import com.fasterxml.jackson.annotation.JsonCreator;
016import com.fasterxml.jackson.annotation.JsonInclude;
017import com.fasterxml.jackson.annotation.JsonProperty;
018import com.fasterxml.jackson.annotation.JsonPropertyOrder;
019import com.fasterxml.jackson.annotation.JsonTypeName;
020import com.fasterxml.jackson.annotation.JsonValue;
021import java.net.URLEncoder;
022import java.nio.charset.StandardCharsets;
023import java.util.Arrays;
024import java.util.HashMap;
025import java.util.Map;
026import java.util.Objects;
027import java.util.StringJoiner;
028
029/**
030 * ApiContentsPathPostRequest
031 */
032@JsonPropertyOrder({ApiContentsPathPostRequest.JSON_PROPERTY_COPY_FROM,
033                    ApiContentsPathPostRequest.JSON_PROPERTY_EXT,
034                    ApiContentsPathPostRequest.JSON_PROPERTY_TYPE})
035@javax.annotation.
036Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen",
037          comments = "Generator version: 7.6.0")
038public class ApiContentsPathPostRequest {
039  public static final String JSON_PROPERTY_COPY_FROM = "copy_from";
040  private String copyFrom;
041
042  public static final String JSON_PROPERTY_EXT = "ext";
043  private String ext;
044
045  public static final String JSON_PROPERTY_TYPE = "type";
046  private String type;
047
048  public ApiContentsPathPostRequest() {}
049
050  public ApiContentsPathPostRequest copyFrom(String copyFrom) {
051    this.copyFrom = copyFrom;
052    return this;
053  }
054
055  /**
056   * Get copyFrom
057   * @return copyFrom
058   **/
059  @javax.annotation.Nullable
060  @JsonProperty(JSON_PROPERTY_COPY_FROM)
061  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
062
063  public String getCopyFrom() {
064    return copyFrom;
065  }
066
067  @JsonProperty(JSON_PROPERTY_COPY_FROM)
068  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
069  public void setCopyFrom(String copyFrom) {
070    this.copyFrom = copyFrom;
071  }
072
073  public ApiContentsPathPostRequest ext(String ext) {
074    this.ext = ext;
075    return this;
076  }
077
078  /**
079   * Get ext
080   * @return ext
081   **/
082  @javax.annotation.Nullable
083  @JsonProperty(JSON_PROPERTY_EXT)
084  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
085
086  public String getExt() {
087    return ext;
088  }
089
090  @JsonProperty(JSON_PROPERTY_EXT)
091  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
092  public void setExt(String ext) {
093    this.ext = ext;
094  }
095
096  public ApiContentsPathPostRequest type(String type) {
097    this.type = type;
098    return this;
099  }
100
101  /**
102   * Get type
103   * @return type
104   **/
105  @javax.annotation.Nullable
106  @JsonProperty(JSON_PROPERTY_TYPE)
107  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
108
109  public String getType() {
110    return type;
111  }
112
113  @JsonProperty(JSON_PROPERTY_TYPE)
114  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
115  public void setType(String type) {
116    this.type = type;
117  }
118
119  /**
120   * Return true if this _api_contents__path__post_request object is equal to o.
121   */
122  @Override
123  public boolean equals(Object o) {
124    if (this == o) {
125      return true;
126    }
127    if (o == null || getClass() != o.getClass()) {
128      return false;
129    }
130    ApiContentsPathPostRequest apiContentsPathPostRequest =
131        (ApiContentsPathPostRequest)o;
132    return Objects.equals(this.copyFrom, apiContentsPathPostRequest.copyFrom) &&
133        Objects.equals(this.ext, apiContentsPathPostRequest.ext) &&
134        Objects.equals(this.type, apiContentsPathPostRequest.type);
135  }
136
137  @Override
138  public int hashCode() {
139    return Objects.hash(copyFrom, ext, type);
140  }
141
142  @Override
143  public String toString() {
144    StringBuilder sb = new StringBuilder();
145    sb.append("class ApiContentsPathPostRequest {\n");
146    sb.append("    copyFrom: ").append(toIndentedString(copyFrom)).append("\n");
147    sb.append("    ext: ").append(toIndentedString(ext)).append("\n");
148    sb.append("    type: ").append(toIndentedString(type)).append("\n");
149    sb.append("}");
150    return sb.toString();
151  }
152
153  /**
154   * Convert the given object to string with each line indented by 4 spaces
155   * (except the first line).
156   */
157  private String toIndentedString(Object o) {
158    if (o == null) {
159      return "null";
160    }
161    return o.toString().replace("\n", "\n    ");
162  }
163
164  /**
165   * Convert the instance into URL query string.
166   *
167   * @return URL query string
168   */
169  public String toUrlQueryString() { return toUrlQueryString(null); }
170
171  /**
172   * Convert the instance into URL query string.
173   *
174   * @param prefix prefix of the query string
175   * @return URL query string
176   */
177  public String toUrlQueryString(String prefix) {
178    String suffix = "";
179    String containerSuffix = "";
180    String containerPrefix = "";
181    if (prefix == null) {
182      // style=form, explode=true, e.g. /pet?name=cat&type=manx
183      prefix = "";
184    } else {
185      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
186      prefix = prefix + "[";
187      suffix = "]";
188      containerSuffix = "]";
189      containerPrefix = "[";
190    }
191
192    StringJoiner joiner = new StringJoiner("&");
193
194    // add `copy_from` to the URL query string
195    if (getCopyFrom() != null) {
196      joiner.add(String.format(
197          "%scopy_from%s=%s", prefix, suffix,
198          URLEncoder
199              .encode(String.valueOf(getCopyFrom()), StandardCharsets.UTF_8)
200              .replaceAll("\\+", "%20")));
201    }
202
203    // add `ext` to the URL query string
204    if (getExt() != null) {
205      joiner.add(String.format(
206          "%sext%s=%s", prefix, suffix,
207          URLEncoder.encode(String.valueOf(getExt()), StandardCharsets.UTF_8)
208              .replaceAll("\\+", "%20")));
209    }
210
211    // add `type` to the URL query string
212    if (getType() != null) {
213      joiner.add(String.format(
214          "%stype%s=%s", prefix, suffix,
215          URLEncoder.encode(String.valueOf(getType()), StandardCharsets.UTF_8)
216              .replaceAll("\\+", "%20")));
217    }
218
219    return joiner.toString();
220  }
221}