Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* FINBOURNE Insights API
*
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.finbourne.insights.model;
import java.util.Objects;
import com.finbourne.insights.model.Link;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.openapitools.jackson.nullable.JsonNullable;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import com.finbourne.insights.JSON;
/**
* DTO of Finbourne.AspNetCore.Http.TrackingEntry.ResponseInformation.
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Response {
public static final String SERIALIZED_NAME_HEADERS = "headers";
@SerializedName(SERIALIZED_NAME_HEADERS)
private Map> headers;
public static final String SERIALIZED_NAME_CONTENT_LENGTH = "contentLength";
@SerializedName(SERIALIZED_NAME_CONTENT_LENGTH)
private Long contentLength;
public static final String SERIALIZED_NAME_CONTENT_TYPE = "contentType";
@SerializedName(SERIALIZED_NAME_CONTENT_TYPE)
private String contentType;
public static final String SERIALIZED_NAME_BODY = "body";
@SerializedName(SERIALIZED_NAME_BODY)
private String body;
public static final String SERIALIZED_NAME_BODY_WAS_TRUNCATED = "bodyWasTruncated";
@SerializedName(SERIALIZED_NAME_BODY_WAS_TRUNCATED)
private Boolean bodyWasTruncated;
public static final String SERIALIZED_NAME_STATUS_CODE = "statusCode";
@SerializedName(SERIALIZED_NAME_STATUS_CODE)
private Integer statusCode;
public static final String SERIALIZED_NAME_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private List links;
public Response() {
}
public Response headers(Map> headers) {
this.headers = headers;
return this;
}
public Response putHeadersItem(String key, List headersItem) {
if (this.headers == null) {
this.headers = new HashMap<>();
}
this.headers.put(key, headersItem);
return this;
}
/**
* The headers
* @return headers
**/
@jakarta.annotation.Nullable
public Map> getHeaders() {
return headers;
}
public void setHeaders(Map> headers) {
this.headers = headers;
}
public Response contentLength(Long contentLength) {
this.contentLength = contentLength;
return this;
}
/**
* The actual length of the body, which may be larger than the data recorded in Finbourne.Insights.WebApi.Dtos.Response.Body (e.g. if actual Body is large, or not convertible to a string)
* @return contentLength
**/
@jakarta.annotation.Nullable
public Long getContentLength() {
return contentLength;
}
public void setContentLength(Long contentLength) {
this.contentLength = contentLength;
}
public Response contentType(String contentType) {
this.contentType = contentType;
return this;
}
/**
* The content type
* @return contentType
**/
@jakarta.annotation.Nullable
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public Response body(String body) {
this.body = body;
return this;
}
/**
* The recorded content.
* @return body
**/
@jakarta.annotation.Nullable
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public Response bodyWasTruncated(Boolean bodyWasTruncated) {
this.bodyWasTruncated = bodyWasTruncated;
return this;
}
/**
* Determines if the recorded body was truncated.
* @return bodyWasTruncated
**/
@jakarta.annotation.Nullable
public Boolean getBodyWasTruncated() {
return bodyWasTruncated;
}
public void setBodyWasTruncated(Boolean bodyWasTruncated) {
this.bodyWasTruncated = bodyWasTruncated;
}
public Response statusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
/**
* Http Status Code of the request.
* @return statusCode
**/
@jakarta.annotation.Nullable
public Integer getStatusCode() {
return statusCode;
}
public void setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
}
public Response links(List links) {
this.links = links;
return this;
}
public Response addLinksItem(Link linksItem) {
if (this.links == null) {
this.links = new ArrayList<>();
}
this.links.add(linksItem);
return this;
}
/**
* Get links
* @return links
**/
@jakarta.annotation.Nullable
public List getLinks() {
return links;
}
public void setLinks(List links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Response response = (Response) o;
return Objects.equals(this.headers, response.headers) &&
Objects.equals(this.contentLength, response.contentLength) &&
Objects.equals(this.contentType, response.contentType) &&
Objects.equals(this.body, response.body) &&
Objects.equals(this.bodyWasTruncated, response.bodyWasTruncated) &&
Objects.equals(this.statusCode, response.statusCode) &&
Objects.equals(this.links, response.links);
}
private static boolean equalsNullable(JsonNullable a, JsonNullable b) {
return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get()));
}
@Override
public int hashCode() {
return Objects.hash(headers, contentLength, contentType, body, bodyWasTruncated, statusCode, links);
}
private static int hashCodeNullable(JsonNullable a) {
if (a == null) {
return 1;
}
return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Response {\n");
sb.append(" headers: ").append(toIndentedString(headers)).append("\n");
sb.append(" contentLength: ").append(toIndentedString(contentLength)).append("\n");
sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n");
sb.append(" body: ").append(toIndentedString(body)).append("\n");
sb.append(" bodyWasTruncated: ").append(toIndentedString(bodyWasTruncated)).append("\n");
sb.append(" statusCode: ").append(toIndentedString(statusCode)).append("\n");
sb.append(" links: ").append(toIndentedString(links)).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 ");
}
public static HashSet openapiFields;
public static HashSet openapiRequiredFields;
static {
// a set of all properties/fields (JSON key names)
openapiFields = new HashSet();
openapiFields.add("headers");
openapiFields.add("contentLength");
openapiFields.add("contentType");
openapiFields.add("body");
openapiFields.add("bodyWasTruncated");
openapiFields.add("statusCode");
openapiFields.add("links");
// a set of required properties/fields (JSON key names)
openapiRequiredFields = new HashSet();
}
/**
* Validates the JSON Element and throws an exception if issues found
*
* @param jsonElement JSON Element
* @throws IOException if the JSON Element is invalid with respect to Response
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Response.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Response is not found in the empty JSON string", Response.openapiRequiredFields.toString()));
}
}
JsonObject jsonObj = jsonElement.getAsJsonObject();
if ((jsonObj.get("contentType") != null && !jsonObj.get("contentType").isJsonNull()) && !jsonObj.get("contentType").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `contentType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentType").toString()));
}
if ((jsonObj.get("body") != null && !jsonObj.get("body").isJsonNull()) && !jsonObj.get("body").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `body` to be a primitive type in the JSON string but got `%s`", jsonObj.get("body").toString()));
}
if (jsonObj.get("links") != null && !jsonObj.get("links").isJsonNull()) {
JsonArray jsonArraylinks = jsonObj.getAsJsonArray("links");
if (jsonArraylinks != null) {
// ensure the json data is an array
if (!jsonObj.get("links").isJsonArray()) {
throw new IllegalArgumentException(String.format("Expected the field `links` to be an array in the JSON string but got `%s`", jsonObj.get("links").toString()));
}
// validate the optional field `links` (array)
for (int i = 0; i < jsonArraylinks.size(); i++) {
Link.validateJsonElement(jsonArraylinks.get(i));
};
}
}
}
public static class CustomTypeAdapterFactory implements TypeAdapterFactory {
@SuppressWarnings("unchecked")
@Override
public TypeAdapter create(Gson gson, TypeToken type) {
if (!Response.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Response' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Response.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, Response value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Response read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Response given an JSON string
*
* @param jsonString JSON string
* @return An instance of Response
* @throws IOException if the JSON string is invalid with respect to Response
*/
public static Response fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Response.class);
}
/**
* Convert an instance of Response to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}