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.RequestInformation.
*/
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
public class Request {
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_METHOD = "method";
@SerializedName(SERIALIZED_NAME_METHOD)
private String method;
public static final String SERIALIZED_NAME_URL = "url";
@SerializedName(SERIALIZED_NAME_URL)
private String url;
public static final String SERIALIZED_NAME_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private List links;
public Request() {
}
public Request headers(Map> headers) {
this.headers = headers;
return this;
}
public Request 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 Request 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.Request.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 Request 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 Request 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 Request 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 Request method(String method) {
this.method = method;
return this;
}
/**
* Method called by the request
* @return method
**/
@jakarta.annotation.Nullable
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Request url(String url) {
this.url = url;
return this;
}
/**
* URL of the request
* @return url
**/
@jakarta.annotation.Nullable
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Request links(List links) {
this.links = links;
return this;
}
public Request 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;
}
Request request = (Request) o;
return Objects.equals(this.headers, request.headers) &&
Objects.equals(this.contentLength, request.contentLength) &&
Objects.equals(this.contentType, request.contentType) &&
Objects.equals(this.body, request.body) &&
Objects.equals(this.bodyWasTruncated, request.bodyWasTruncated) &&
Objects.equals(this.method, request.method) &&
Objects.equals(this.url, request.url) &&
Objects.equals(this.links, request.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, method, url, 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 Request {\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(" method: ").append(toIndentedString(method)).append("\n");
sb.append(" url: ").append(toIndentedString(url)).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("method");
openapiFields.add("url");
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 Request
*/
public static void validateJsonElement(JsonElement jsonElement) throws IOException {
if (jsonElement == null) {
if (!Request.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null
throw new IllegalArgumentException(String.format("The required field(s) %s in Request is not found in the empty JSON string", Request.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("method") != null && !jsonObj.get("method").isJsonNull()) && !jsonObj.get("method").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString()));
}
if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) {
throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").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 (!Request.class.isAssignableFrom(type.getRawType())) {
return null; // this class only serializes 'Request' and its subtypes
}
final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class);
final TypeAdapter thisAdapter
= gson.getDelegateAdapter(this, TypeToken.get(Request.class));
return (TypeAdapter) new TypeAdapter() {
@Override
public void write(JsonWriter out, Request value) throws IOException {
JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject();
elementAdapter.write(out, obj);
}
@Override
public Request read(JsonReader in) throws IOException {
JsonElement jsonElement = elementAdapter.read(in);
validateJsonElement(jsonElement);
return thisAdapter.fromJsonTree(jsonElement);
}
}.nullSafe();
}
}
/**
* Create an instance of Request given an JSON string
*
* @param jsonString JSON string
* @return An instance of Request
* @throws IOException if the JSON string is invalid with respect to Request
*/
public static Request fromJson(String jsonString) throws IOException {
return JSON.getGson().fromJson(jsonString, Request.class);
}
/**
* Convert an instance of Request to an JSON string
*
* @return JSON string
*/
public String toJson() {
return JSON.getGson().toJson(this);
}
}