index
int64
repo_id
string
file_path
string
content
string
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/ProgressResponseBody.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client; import okhttp3.MediaType; import okhttp3.ResponseBody; import java.io.IOException; import okio.Buffer; import okio.BufferedSource; import okio.ForwardingSource; import okio.Okio; import okio.Source; public class ProgressResponseBody extends ResponseBody { private final ResponseBody responseBody; private final ApiCallback callback; private BufferedSource bufferedSource; public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { this.responseBody = responseBody; this.callback = callback; } @Override public MediaType contentType() { return responseBody.contentType(); } @Override public long contentLength() { return responseBody.contentLength(); } @Override public BufferedSource source() { if (bufferedSource == null) { bufferedSource = Okio.buffer(source(responseBody.source())); } return bufferedSource; } private Source source(Source source) { return new ForwardingSource(source) { long totalBytesRead = 0L; @Override public long read(Buffer sink, long byteCount) throws IOException { long bytesRead = super.read(sink, byteCount); // read() returns the number of bytes read, or -1 if this source is exhausted. totalBytesRead += bytesRead != -1 ? bytesRead : 0; callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); return bytesRead; } }; } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/ServerConfiguration.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client; import java.util.Map; /** * Representing a Server configuration. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ServerConfiguration { public String URL; public String description; public Map<String, ServerVariable> variables; /** * @param URL A URL to the target host. * @param description A description of the host designated by the URL. * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ public ServerConfiguration(String URL, String description, Map<String, ServerVariable> variables) { this.URL = URL; this.description = description; this.variables = variables; } /** * Format URL template using given variables. * * @param variables A map between a variable name and its value. * @return Formatted URL. */ public String URL(Map<String, String> variables) { String url = this.URL; // go through variables and replace placeholders for (Map.Entry<String, ServerVariable> variable: this.variables.entrySet()) { String name = variable.getKey(); ServerVariable serverVariable = variable.getValue(); String value = serverVariable.defaultValue; if (variables != null && variables.containsKey(name)) { value = variables.get(name); if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } url = url.replace("{" + name + "}", value); } return url; } /** * Format URL template using default server variables. * * @return Formatted URL. */ public String URL() { return URL(null); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/ServerVariable.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client; import java.util.HashSet; /** * Representing a Server Variable for server URL template substitution. */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ServerVariable { public String description; public String defaultValue; public HashSet<String> enumValues = null; /** * @param description A description for the server variable. * @param defaultValue The default value to use for substitution. * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. */ public ServerVariable(String description, String defaultValue, HashSet<String> enumValues) { this.description = description; this.defaultValue = defaultValue; this.enumValues = enumValues; } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/StringUtil.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client; import java.util.Collection; import java.util.Iterator; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). * * @param array The array * @param value The value to search * @return true if the array contains the value */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { if (value == null && str == null) { return true; } if (value != null && value.equalsIgnoreCase(str)) { return true; } } return false; } /** * Join an array of strings with the given separator. * <p> * Note: This might be replaced by utility method from commons-lang or guava someday * if one of those libraries is added as dependency. * </p> * * @param array The array of strings * @param separator The separator * @return the resulting string */ public static String join(String[] array, String separator) { int len = array.length; if (len == 0) { return ""; } StringBuilder out = new StringBuilder(); out.append(array[0]); for (int i = 1; i < len; i++) { out.append(separator).append(array[i]); } return out.toString(); } /** * Join a list of strings with the given separator. * * @param list The list of strings * @param separator The separator * @return the resulting string */ public static String join(Collection<String> list, String separator) { Iterator<String> iterator = list.iterator(); StringBuilder out = new StringBuilder(); if (iterator.hasNext()) { out.append(iterator.next()); } while (iterator.hasNext()) { out.append(separator).append(iterator.next()); } return out.toString(); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/api/DefaultApi.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.api; import org.openapitools.client.ApiCallback; import org.openapitools.client.ApiClient; import org.openapitools.client.ApiException; import org.openapitools.client.ApiResponse; import org.openapitools.client.Configuration; import org.openapitools.client.Pair; import org.openapitools.client.ProgressRequestBody; import org.openapitools.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import org.openapitools.client.model.AppendBlockChildrenRequest; import org.openapitools.client.model.AppendBlockChildrenResponse; import org.openapitools.client.model.Block; import org.openapitools.client.model.CreateDatabaseRequest; import org.openapitools.client.model.CreatePageRequest; import org.openapitools.client.model.CreatePageResponse; import org.openapitools.client.model.Database; import org.openapitools.client.model.DeleteBlockResponse; import org.openapitools.client.model.Error; import org.openapitools.client.model.GetBlockChildrenResponse; import org.openapitools.client.model.Page; import org.openapitools.client.model.QueryDatabaseRequest; import org.openapitools.client.model.QueryDatabaseResponse; import org.openapitools.client.model.SearchRequest; import org.openapitools.client.model.SearchResult; import java.util.UUID; import org.openapitools.client.model.UpdateBlockRequest; import org.openapitools.client.model.UpdateDatabaseRequest; import org.openapitools.client.model.UpdatePageRequest; import org.openapitools.client.model.UserMe; import org.openapitools.client.model.V1SearchRequest; import org.openapitools.client.model.V1SearchResponse; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class DefaultApi { private ApiClient localVarApiClient; private int localHostIndex; private String localCustomBaseUrl; public DefaultApi() { this(Configuration.getDefaultApiClient()); } public DefaultApi(ApiClient apiClient) { this.localVarApiClient = apiClient; } public ApiClient getApiClient() { return localVarApiClient; } public void setApiClient(ApiClient apiClient) { this.localVarApiClient = apiClient; } public int getHostIndex() { return localHostIndex; } public void setHostIndex(int hostIndex) { this.localHostIndex = hostIndex; } public String getCustomBaseUrl() { return localCustomBaseUrl; } public void setCustomBaseUrl(String customBaseUrl) { this.localCustomBaseUrl = customBaseUrl; } /** * Build call for appendBlockChildren * @param blockId 父块ID (required) * @param appendBlockChildrenRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 子块创建成功 </td><td> - </td></tr> </table> */ public okhttp3.Call appendBlockChildrenCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull AppendBlockChildrenRequest appendBlockChildrenRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = appendBlockChildrenRequest; // create path and map variables String localVarPath = "/v1/blocks/{block_id}/children" .replace("{" + "block_id" + "}", localVarApiClient.escapeString(blockId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call appendBlockChildrenValidateBeforeCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull AppendBlockChildrenRequest appendBlockChildrenRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'blockId' is set if (blockId == null) { throw new ApiException("Missing the required parameter 'blockId' when calling appendBlockChildren(Async)"); } // verify the required parameter 'appendBlockChildrenRequest' is set if (appendBlockChildrenRequest == null) { throw new ApiException("Missing the required parameter 'appendBlockChildrenRequest' when calling appendBlockChildren(Async)"); } return appendBlockChildrenCall(blockId, appendBlockChildrenRequest, _callback); } /** * 追加子块 * 向指定块追加一个或多个子块 * @param blockId 父块ID (required) * @param appendBlockChildrenRequest (required) * @return AppendBlockChildrenResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 子块创建成功 </td><td> - </td></tr> </table> */ public AppendBlockChildrenResponse appendBlockChildren(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull AppendBlockChildrenRequest appendBlockChildrenRequest) throws ApiException { ApiResponse<AppendBlockChildrenResponse> localVarResp = appendBlockChildrenWithHttpInfo(blockId, appendBlockChildrenRequest); return localVarResp.getData(); } /** * 追加子块 * 向指定块追加一个或多个子块 * @param blockId 父块ID (required) * @param appendBlockChildrenRequest (required) * @return ApiResponse&lt;AppendBlockChildrenResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 子块创建成功 </td><td> - </td></tr> </table> */ public ApiResponse<AppendBlockChildrenResponse> appendBlockChildrenWithHttpInfo(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull AppendBlockChildrenRequest appendBlockChildrenRequest) throws ApiException { okhttp3.Call localVarCall = appendBlockChildrenValidateBeforeCall(blockId, appendBlockChildrenRequest, null); Type localVarReturnType = new TypeToken<AppendBlockChildrenResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 追加子块 (asynchronously) * 向指定块追加一个或多个子块 * @param blockId 父块ID (required) * @param appendBlockChildrenRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 子块创建成功 </td><td> - </td></tr> </table> */ public okhttp3.Call appendBlockChildrenAsync(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull AppendBlockChildrenRequest appendBlockChildrenRequest, final ApiCallback<AppendBlockChildrenResponse> _callback) throws ApiException { okhttp3.Call localVarCall = appendBlockChildrenValidateBeforeCall(blockId, appendBlockChildrenRequest, _callback); Type localVarReturnType = new TypeToken<AppendBlockChildrenResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for createDatabase * @param createDatabaseRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> </table> */ public okhttp3.Call createDatabaseCall(@javax.annotation.Nonnull CreateDatabaseRequest createDatabaseRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = createDatabaseRequest; // create path and map variables String localVarPath = "/v1/databases"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call createDatabaseValidateBeforeCall(@javax.annotation.Nonnull CreateDatabaseRequest createDatabaseRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'createDatabaseRequest' is set if (createDatabaseRequest == null) { throw new ApiException("Missing the required parameter 'createDatabaseRequest' when calling createDatabase(Async)"); } return createDatabaseCall(createDatabaseRequest, _callback); } /** * 创建数据库 * 在现有页面下创建一个新的数据库 * @param createDatabaseRequest (required) * @return Database * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> </table> */ public Database createDatabase(@javax.annotation.Nonnull CreateDatabaseRequest createDatabaseRequest) throws ApiException { ApiResponse<Database> localVarResp = createDatabaseWithHttpInfo(createDatabaseRequest); return localVarResp.getData(); } /** * 创建数据库 * 在现有页面下创建一个新的数据库 * @param createDatabaseRequest (required) * @return ApiResponse&lt;Database&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> </table> */ public ApiResponse<Database> createDatabaseWithHttpInfo(@javax.annotation.Nonnull CreateDatabaseRequest createDatabaseRequest) throws ApiException { okhttp3.Call localVarCall = createDatabaseValidateBeforeCall(createDatabaseRequest, null); Type localVarReturnType = new TypeToken<Database>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 创建数据库 (asynchronously) * 在现有页面下创建一个新的数据库 * @param createDatabaseRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> </table> */ public okhttp3.Call createDatabaseAsync(@javax.annotation.Nonnull CreateDatabaseRequest createDatabaseRequest, final ApiCallback<Database> _callback) throws ApiException { okhttp3.Call localVarCall = createDatabaseValidateBeforeCall(createDatabaseRequest, _callback); Type localVarReturnType = new TypeToken<Database>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for createPage * @param createPageRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call createPageCall(@javax.annotation.Nonnull CreatePageRequest createPageRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = createPageRequest; // create path and map variables String localVarPath = "/v1/pages"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call createPageValidateBeforeCall(@javax.annotation.Nonnull CreatePageRequest createPageRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'createPageRequest' is set if (createPageRequest == null) { throw new ApiException("Missing the required parameter 'createPageRequest' when calling createPage(Async)"); } return createPageCall(createPageRequest, _callback); } /** * 创建页面 * 在页面或数据库中创建新页面 * @param createPageRequest (required) * @return CreatePageResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public CreatePageResponse createPage(@javax.annotation.Nonnull CreatePageRequest createPageRequest) throws ApiException { ApiResponse<CreatePageResponse> localVarResp = createPageWithHttpInfo(createPageRequest); return localVarResp.getData(); } /** * 创建页面 * 在页面或数据库中创建新页面 * @param createPageRequest (required) * @return ApiResponse&lt;CreatePageResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public ApiResponse<CreatePageResponse> createPageWithHttpInfo(@javax.annotation.Nonnull CreatePageRequest createPageRequest) throws ApiException { okhttp3.Call localVarCall = createPageValidateBeforeCall(createPageRequest, null); Type localVarReturnType = new TypeToken<CreatePageResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 创建页面 (asynchronously) * 在页面或数据库中创建新页面 * @param createPageRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面创建成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call createPageAsync(@javax.annotation.Nonnull CreatePageRequest createPageRequest, final ApiCallback<CreatePageResponse> _callback) throws ApiException { okhttp3.Call localVarCall = createPageValidateBeforeCall(createPageRequest, _callback); Type localVarReturnType = new TypeToken<CreatePageResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for deleteBlock * @param blockId 块ID (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块删除成功 </td><td> - </td></tr> </table> */ public okhttp3.Call deleteBlockCall(@javax.annotation.Nonnull UUID blockId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/blocks/{block_id}" .replace("{" + "block_id" + "}", localVarApiClient.escapeString(blockId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call deleteBlockValidateBeforeCall(@javax.annotation.Nonnull UUID blockId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'blockId' is set if (blockId == null) { throw new ApiException("Missing the required parameter 'blockId' when calling deleteBlock(Async)"); } return deleteBlockCall(blockId, _callback); } /** * 删除块 * 删除指定块及其所有子块 * @param blockId 块ID (required) * @return DeleteBlockResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块删除成功 </td><td> - </td></tr> </table> */ public DeleteBlockResponse deleteBlock(@javax.annotation.Nonnull UUID blockId) throws ApiException { ApiResponse<DeleteBlockResponse> localVarResp = deleteBlockWithHttpInfo(blockId); return localVarResp.getData(); } /** * 删除块 * 删除指定块及其所有子块 * @param blockId 块ID (required) * @return ApiResponse&lt;DeleteBlockResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块删除成功 </td><td> - </td></tr> </table> */ public ApiResponse<DeleteBlockResponse> deleteBlockWithHttpInfo(@javax.annotation.Nonnull UUID blockId) throws ApiException { okhttp3.Call localVarCall = deleteBlockValidateBeforeCall(blockId, null); Type localVarReturnType = new TypeToken<DeleteBlockResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 删除块 (asynchronously) * 删除指定块及其所有子块 * @param blockId 块ID (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块删除成功 </td><td> - </td></tr> </table> */ public okhttp3.Call deleteBlockAsync(@javax.annotation.Nonnull UUID blockId, final ApiCallback<DeleteBlockResponse> _callback) throws ApiException { okhttp3.Call localVarCall = deleteBlockValidateBeforeCall(blockId, _callback); Type localVarReturnType = new TypeToken<DeleteBlockResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getBlock * @param blockId 块ID (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取块 </td><td> - </td></tr> </table> */ public okhttp3.Call getBlockCall(@javax.annotation.Nonnull UUID blockId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/blocks/{block_id}" .replace("{" + "block_id" + "}", localVarApiClient.escapeString(blockId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBlockValidateBeforeCall(@javax.annotation.Nonnull UUID blockId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'blockId' is set if (blockId == null) { throw new ApiException("Missing the required parameter 'blockId' when calling getBlock(Async)"); } return getBlockCall(blockId, _callback); } /** * 获取块 * 根据ID获取块对象 * @param blockId 块ID (required) * @return Block * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取块 </td><td> - </td></tr> </table> */ public Block getBlock(@javax.annotation.Nonnull UUID blockId) throws ApiException { ApiResponse<Block> localVarResp = getBlockWithHttpInfo(blockId); return localVarResp.getData(); } /** * 获取块 * 根据ID获取块对象 * @param blockId 块ID (required) * @return ApiResponse&lt;Block&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取块 </td><td> - </td></tr> </table> */ public ApiResponse<Block> getBlockWithHttpInfo(@javax.annotation.Nonnull UUID blockId) throws ApiException { okhttp3.Call localVarCall = getBlockValidateBeforeCall(blockId, null); Type localVarReturnType = new TypeToken<Block>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 获取块 (asynchronously) * 根据ID获取块对象 * @param blockId 块ID (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取块 </td><td> - </td></tr> </table> */ public okhttp3.Call getBlockAsync(@javax.annotation.Nonnull UUID blockId, final ApiCallback<Block> _callback) throws ApiException { okhttp3.Call localVarCall = getBlockValidateBeforeCall(blockId, _callback); Type localVarReturnType = new TypeToken<Block>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getBlockChildren * @param blockId 父块ID (required) * @param startCursor 分页游标,使用子块的ID作为游标值 (optional) * @param pageSize 每页记录数 (optional, default to 50) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取子块列表 </td><td> - </td></tr> </table> */ public okhttp3.Call getBlockChildrenCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nullable String startCursor, @javax.annotation.Nullable Integer pageSize, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/blocks/{block_id}/children" .replace("{" + "block_id" + "}", localVarApiClient.escapeString(blockId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); if (startCursor != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("start_cursor", startCursor)); } if (pageSize != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("page_size", pageSize)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getBlockChildrenValidateBeforeCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nullable String startCursor, @javax.annotation.Nullable Integer pageSize, final ApiCallback _callback) throws ApiException { // verify the required parameter 'blockId' is set if (blockId == null) { throw new ApiException("Missing the required parameter 'blockId' when calling getBlockChildren(Async)"); } return getBlockChildrenCall(blockId, startCursor, pageSize, _callback); } /** * 获取子块 * 获取指定块的子块列表 * @param blockId 父块ID (required) * @param startCursor 分页游标,使用子块的ID作为游标值 (optional) * @param pageSize 每页记录数 (optional, default to 50) * @return GetBlockChildrenResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取子块列表 </td><td> - </td></tr> </table> */ public GetBlockChildrenResponse getBlockChildren(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nullable String startCursor, @javax.annotation.Nullable Integer pageSize) throws ApiException { ApiResponse<GetBlockChildrenResponse> localVarResp = getBlockChildrenWithHttpInfo(blockId, startCursor, pageSize); return localVarResp.getData(); } /** * 获取子块 * 获取指定块的子块列表 * @param blockId 父块ID (required) * @param startCursor 分页游标,使用子块的ID作为游标值 (optional) * @param pageSize 每页记录数 (optional, default to 50) * @return ApiResponse&lt;GetBlockChildrenResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取子块列表 </td><td> - </td></tr> </table> */ public ApiResponse<GetBlockChildrenResponse> getBlockChildrenWithHttpInfo(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nullable String startCursor, @javax.annotation.Nullable Integer pageSize) throws ApiException { okhttp3.Call localVarCall = getBlockChildrenValidateBeforeCall(blockId, startCursor, pageSize, null); Type localVarReturnType = new TypeToken<GetBlockChildrenResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 获取子块 (asynchronously) * 获取指定块的子块列表 * @param blockId 父块ID (required) * @param startCursor 分页游标,使用子块的ID作为游标值 (optional) * @param pageSize 每页记录数 (optional, default to 50) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取子块列表 </td><td> - </td></tr> </table> */ public okhttp3.Call getBlockChildrenAsync(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nullable String startCursor, @javax.annotation.Nullable Integer pageSize, final ApiCallback<GetBlockChildrenResponse> _callback) throws ApiException { okhttp3.Call localVarCall = getBlockChildrenValidateBeforeCall(blockId, startCursor, pageSize, _callback); Type localVarReturnType = new TypeToken<GetBlockChildrenResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getDatabase * @param databaseId 数据库ID (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取数据库 </td><td> - </td></tr> <tr><td> 404 </td><td> 数据库不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getDatabaseCall(@javax.annotation.Nonnull UUID databaseId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/databases/{database_id}" .replace("{" + "database_id" + "}", localVarApiClient.escapeString(databaseId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getDatabaseValidateBeforeCall(@javax.annotation.Nonnull UUID databaseId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'databaseId' is set if (databaseId == null) { throw new ApiException("Missing the required parameter 'databaseId' when calling getDatabase(Async)"); } return getDatabaseCall(databaseId, _callback); } /** * 获取数据库 * 根据ID获取数据库对象 * @param databaseId 数据库ID (required) * @return Database * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取数据库 </td><td> - </td></tr> <tr><td> 404 </td><td> 数据库不存在 </td><td> - </td></tr> </table> */ public Database getDatabase(@javax.annotation.Nonnull UUID databaseId) throws ApiException { ApiResponse<Database> localVarResp = getDatabaseWithHttpInfo(databaseId); return localVarResp.getData(); } /** * 获取数据库 * 根据ID获取数据库对象 * @param databaseId 数据库ID (required) * @return ApiResponse&lt;Database&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取数据库 </td><td> - </td></tr> <tr><td> 404 </td><td> 数据库不存在 </td><td> - </td></tr> </table> */ public ApiResponse<Database> getDatabaseWithHttpInfo(@javax.annotation.Nonnull UUID databaseId) throws ApiException { okhttp3.Call localVarCall = getDatabaseValidateBeforeCall(databaseId, null); Type localVarReturnType = new TypeToken<Database>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 获取数据库 (asynchronously) * 根据ID获取数据库对象 * @param databaseId 数据库ID (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取数据库 </td><td> - </td></tr> <tr><td> 404 </td><td> 数据库不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getDatabaseAsync(@javax.annotation.Nonnull UUID databaseId, final ApiCallback<Database> _callback) throws ApiException { okhttp3.Call localVarCall = getDatabaseValidateBeforeCall(databaseId, _callback); Type localVarReturnType = new TypeToken<Database>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getMe * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取用户信息 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 404 </td><td> 机器人创建者信息不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getMeCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/users/me"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getMeValidateBeforeCall(final ApiCallback _callback) throws ApiException { return getMeCall(_callback); } /** * 获取机器人创建者信息 * 获取当前机器人的创建者用户信息 * @return UserMe * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取用户信息 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 404 </td><td> 机器人创建者信息不存在 </td><td> - </td></tr> </table> */ public UserMe getMe() throws ApiException { ApiResponse<UserMe> localVarResp = getMeWithHttpInfo(); return localVarResp.getData(); } /** * 获取机器人创建者信息 * 获取当前机器人的创建者用户信息 * @return ApiResponse&lt;UserMe&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取用户信息 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 404 </td><td> 机器人创建者信息不存在 </td><td> - </td></tr> </table> */ public ApiResponse<UserMe> getMeWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = getMeValidateBeforeCall(null); Type localVarReturnType = new TypeToken<UserMe>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 获取机器人创建者信息 (asynchronously) * 获取当前机器人的创建者用户信息 * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取用户信息 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 404 </td><td> 机器人创建者信息不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getMeAsync(final ApiCallback<UserMe> _callback) throws ApiException { okhttp3.Call localVarCall = getMeValidateBeforeCall(_callback); Type localVarReturnType = new TypeToken<UserMe>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for getPage * @param pageId 页面ID (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取页面 </td><td> - </td></tr> <tr><td> 404 </td><td> 页面不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getPageCall(@javax.annotation.Nonnull UUID pageId, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/v1/pages/{page_id}" .replace("{" + "page_id" + "}", localVarApiClient.escapeString(pageId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call getPageValidateBeforeCall(@javax.annotation.Nonnull UUID pageId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'pageId' is set if (pageId == null) { throw new ApiException("Missing the required parameter 'pageId' when calling getPage(Async)"); } return getPageCall(pageId, _callback); } /** * 获取页面 * 根据ID获取页面对象 * @param pageId 页面ID (required) * @return Page * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取页面 </td><td> - </td></tr> <tr><td> 404 </td><td> 页面不存在 </td><td> - </td></tr> </table> */ public Page getPage(@javax.annotation.Nonnull UUID pageId) throws ApiException { ApiResponse<Page> localVarResp = getPageWithHttpInfo(pageId); return localVarResp.getData(); } /** * 获取页面 * 根据ID获取页面对象 * @param pageId 页面ID (required) * @return ApiResponse&lt;Page&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取页面 </td><td> - </td></tr> <tr><td> 404 </td><td> 页面不存在 </td><td> - </td></tr> </table> */ public ApiResponse<Page> getPageWithHttpInfo(@javax.annotation.Nonnull UUID pageId) throws ApiException { okhttp3.Call localVarCall = getPageValidateBeforeCall(pageId, null); Type localVarReturnType = new TypeToken<Page>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 获取页面 (asynchronously) * 根据ID获取页面对象 * @param pageId 页面ID (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 成功获取页面 </td><td> - </td></tr> <tr><td> 404 </td><td> 页面不存在 </td><td> - </td></tr> </table> */ public okhttp3.Call getPageAsync(@javax.annotation.Nonnull UUID pageId, final ApiCallback<Page> _callback) throws ApiException { okhttp3.Call localVarCall = getPageValidateBeforeCall(pageId, _callback); Type localVarReturnType = new TypeToken<Page>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for queryDatabase * @param databaseId 数据库ID (required) * @param queryDatabaseRequest (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 查询成功 </td><td> - </td></tr> </table> */ public okhttp3.Call queryDatabaseCall(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nullable QueryDatabaseRequest queryDatabaseRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = queryDatabaseRequest; // create path and map variables String localVarPath = "/v1/databases/{database_id}/query" .replace("{" + "database_id" + "}", localVarApiClient.escapeString(databaseId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call queryDatabaseValidateBeforeCall(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nullable QueryDatabaseRequest queryDatabaseRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'databaseId' is set if (databaseId == null) { throw new ApiException("Missing the required parameter 'databaseId' when calling queryDatabase(Async)"); } return queryDatabaseCall(databaseId, queryDatabaseRequest, _callback); } /** * 查询数据库 * 获取数据库中的页面列表,支持分页 * @param databaseId 数据库ID (required) * @param queryDatabaseRequest (optional) * @return QueryDatabaseResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 查询成功 </td><td> - </td></tr> </table> */ public QueryDatabaseResponse queryDatabase(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nullable QueryDatabaseRequest queryDatabaseRequest) throws ApiException { ApiResponse<QueryDatabaseResponse> localVarResp = queryDatabaseWithHttpInfo(databaseId, queryDatabaseRequest); return localVarResp.getData(); } /** * 查询数据库 * 获取数据库中的页面列表,支持分页 * @param databaseId 数据库ID (required) * @param queryDatabaseRequest (optional) * @return ApiResponse&lt;QueryDatabaseResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 查询成功 </td><td> - </td></tr> </table> */ public ApiResponse<QueryDatabaseResponse> queryDatabaseWithHttpInfo(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nullable QueryDatabaseRequest queryDatabaseRequest) throws ApiException { okhttp3.Call localVarCall = queryDatabaseValidateBeforeCall(databaseId, queryDatabaseRequest, null); Type localVarReturnType = new TypeToken<QueryDatabaseResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 查询数据库 (asynchronously) * 获取数据库中的页面列表,支持分页 * @param databaseId 数据库ID (required) * @param queryDatabaseRequest (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 查询成功 </td><td> - </td></tr> </table> */ public okhttp3.Call queryDatabaseAsync(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nullable QueryDatabaseRequest queryDatabaseRequest, final ApiCallback<QueryDatabaseResponse> _callback) throws ApiException { okhttp3.Call localVarCall = queryDatabaseValidateBeforeCall(databaseId, queryDatabaseRequest, _callback); Type localVarReturnType = new TypeToken<QueryDatabaseResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for searchPages * @param searchRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call searchPagesCall(@javax.annotation.Nonnull SearchRequest searchRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = searchRequest; // create path and map variables String localVarPath = "/v1/pages/search"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call searchPagesValidateBeforeCall(@javax.annotation.Nonnull SearchRequest searchRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'searchRequest' is set if (searchRequest == null) { throw new ApiException("Missing the required parameter 'searchRequest' when calling searchPages(Async)"); } return searchPagesCall(searchRequest, _callback); } /** * 搜索页面 * 通过向量搜索在空间中查找相关页面和内容 * @param searchRequest (required) * @return SearchResult * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public SearchResult searchPages(@javax.annotation.Nonnull SearchRequest searchRequest) throws ApiException { ApiResponse<SearchResult> localVarResp = searchPagesWithHttpInfo(searchRequest); return localVarResp.getData(); } /** * 搜索页面 * 通过向量搜索在空间中查找相关页面和内容 * @param searchRequest (required) * @return ApiResponse&lt;SearchResult&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public ApiResponse<SearchResult> searchPagesWithHttpInfo(@javax.annotation.Nonnull SearchRequest searchRequest) throws ApiException { okhttp3.Call localVarCall = searchPagesValidateBeforeCall(searchRequest, null); Type localVarReturnType = new TypeToken<SearchResult>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 搜索页面 (asynchronously) * 通过向量搜索在空间中查找相关页面和内容 * @param searchRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call searchPagesAsync(@javax.annotation.Nonnull SearchRequest searchRequest, final ApiCallback<SearchResult> _callback) throws ApiException { okhttp3.Call localVarCall = searchPagesValidateBeforeCall(searchRequest, _callback); Type localVarReturnType = new TypeToken<SearchResult>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateBlock * @param blockId 块ID (required) * @param updateBlockRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updateBlockCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull UpdateBlockRequest updateBlockRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = updateBlockRequest; // create path and map variables String localVarPath = "/v1/blocks/{block_id}" .replace("{" + "block_id" + "}", localVarApiClient.escapeString(blockId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updateBlockValidateBeforeCall(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull UpdateBlockRequest updateBlockRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'blockId' is set if (blockId == null) { throw new ApiException("Missing the required parameter 'blockId' when calling updateBlock(Async)"); } // verify the required parameter 'updateBlockRequest' is set if (updateBlockRequest == null) { throw new ApiException("Missing the required parameter 'updateBlockRequest' when calling updateBlock(Async)"); } return updateBlockCall(blockId, updateBlockRequest, _callback); } /** * 更新块 * 更新指定块的内容或属性 * @param blockId 块ID (required) * @param updateBlockRequest (required) * @return Block * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块更新成功 </td><td> - </td></tr> </table> */ public Block updateBlock(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull UpdateBlockRequest updateBlockRequest) throws ApiException { ApiResponse<Block> localVarResp = updateBlockWithHttpInfo(blockId, updateBlockRequest); return localVarResp.getData(); } /** * 更新块 * 更新指定块的内容或属性 * @param blockId 块ID (required) * @param updateBlockRequest (required) * @return ApiResponse&lt;Block&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块更新成功 </td><td> - </td></tr> </table> */ public ApiResponse<Block> updateBlockWithHttpInfo(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull UpdateBlockRequest updateBlockRequest) throws ApiException { okhttp3.Call localVarCall = updateBlockValidateBeforeCall(blockId, updateBlockRequest, null); Type localVarReturnType = new TypeToken<Block>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 更新块 (asynchronously) * 更新指定块的内容或属性 * @param blockId 块ID (required) * @param updateBlockRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 块更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updateBlockAsync(@javax.annotation.Nonnull UUID blockId, @javax.annotation.Nonnull UpdateBlockRequest updateBlockRequest, final ApiCallback<Block> _callback) throws ApiException { okhttp3.Call localVarCall = updateBlockValidateBeforeCall(blockId, updateBlockRequest, _callback); Type localVarReturnType = new TypeToken<Block>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updateDatabase * @param databaseId 数据库ID (required) * @param updateDatabaseRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updateDatabaseCall(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nonnull UpdateDatabaseRequest updateDatabaseRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = updateDatabaseRequest; // create path and map variables String localVarPath = "/v1/databases/{database_id}" .replace("{" + "database_id" + "}", localVarApiClient.escapeString(databaseId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updateDatabaseValidateBeforeCall(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nonnull UpdateDatabaseRequest updateDatabaseRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'databaseId' is set if (databaseId == null) { throw new ApiException("Missing the required parameter 'databaseId' when calling updateDatabase(Async)"); } // verify the required parameter 'updateDatabaseRequest' is set if (updateDatabaseRequest == null) { throw new ApiException("Missing the required parameter 'updateDatabaseRequest' when calling updateDatabase(Async)"); } return updateDatabaseCall(databaseId, updateDatabaseRequest, _callback); } /** * 更新数据库 * 更新数据库的属性 * @param databaseId 数据库ID (required) * @param updateDatabaseRequest (required) * @return Database * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库更新成功 </td><td> - </td></tr> </table> */ public Database updateDatabase(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nonnull UpdateDatabaseRequest updateDatabaseRequest) throws ApiException { ApiResponse<Database> localVarResp = updateDatabaseWithHttpInfo(databaseId, updateDatabaseRequest); return localVarResp.getData(); } /** * 更新数据库 * 更新数据库的属性 * @param databaseId 数据库ID (required) * @param updateDatabaseRequest (required) * @return ApiResponse&lt;Database&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库更新成功 </td><td> - </td></tr> </table> */ public ApiResponse<Database> updateDatabaseWithHttpInfo(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nonnull UpdateDatabaseRequest updateDatabaseRequest) throws ApiException { okhttp3.Call localVarCall = updateDatabaseValidateBeforeCall(databaseId, updateDatabaseRequest, null); Type localVarReturnType = new TypeToken<Database>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 更新数据库 (asynchronously) * 更新数据库的属性 * @param databaseId 数据库ID (required) * @param updateDatabaseRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 数据库更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updateDatabaseAsync(@javax.annotation.Nonnull UUID databaseId, @javax.annotation.Nonnull UpdateDatabaseRequest updateDatabaseRequest, final ApiCallback<Database> _callback) throws ApiException { okhttp3.Call localVarCall = updateDatabaseValidateBeforeCall(databaseId, updateDatabaseRequest, _callback); Type localVarReturnType = new TypeToken<Database>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for updatePage * @param pageId 页面ID (required) * @param updatePageRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updatePageCall(@javax.annotation.Nonnull UUID pageId, @javax.annotation.Nonnull UpdatePageRequest updatePageRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = updatePageRequest; // create path and map variables String localVarPath = "/v1/pages/{page_id}" .replace("{" + "page_id" + "}", localVarApiClient.escapeString(pageId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call updatePageValidateBeforeCall(@javax.annotation.Nonnull UUID pageId, @javax.annotation.Nonnull UpdatePageRequest updatePageRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'pageId' is set if (pageId == null) { throw new ApiException("Missing the required parameter 'pageId' when calling updatePage(Async)"); } // verify the required parameter 'updatePageRequest' is set if (updatePageRequest == null) { throw new ApiException("Missing the required parameter 'updatePageRequest' when calling updatePage(Async)"); } return updatePageCall(pageId, updatePageRequest, _callback); } /** * 更新页面属性 * 更新页面的属性 * @param pageId 页面ID (required) * @param updatePageRequest (required) * @return Page * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面更新成功 </td><td> - </td></tr> </table> */ public Page updatePage(@javax.annotation.Nonnull UUID pageId, @javax.annotation.Nonnull UpdatePageRequest updatePageRequest) throws ApiException { ApiResponse<Page> localVarResp = updatePageWithHttpInfo(pageId, updatePageRequest); return localVarResp.getData(); } /** * 更新页面属性 * 更新页面的属性 * @param pageId 页面ID (required) * @param updatePageRequest (required) * @return ApiResponse&lt;Page&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面更新成功 </td><td> - </td></tr> </table> */ public ApiResponse<Page> updatePageWithHttpInfo(@javax.annotation.Nonnull UUID pageId, @javax.annotation.Nonnull UpdatePageRequest updatePageRequest) throws ApiException { okhttp3.Call localVarCall = updatePageValidateBeforeCall(pageId, updatePageRequest, null); Type localVarReturnType = new TypeToken<Page>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 更新页面属性 (asynchronously) * 更新页面的属性 * @param pageId 页面ID (required) * @param updatePageRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 页面更新成功 </td><td> - </td></tr> </table> */ public okhttp3.Call updatePageAsync(@javax.annotation.Nonnull UUID pageId, @javax.annotation.Nonnull UpdatePageRequest updatePageRequest, final ApiCallback<Page> _callback) throws ApiException { okhttp3.Call localVarCall = updatePageValidateBeforeCall(pageId, updatePageRequest, _callback); Type localVarReturnType = new TypeToken<Page>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for v1Search * @param v1SearchRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 429 </td><td> 请求频率超过限制 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call v1SearchCall(@javax.annotation.Nonnull V1SearchRequest v1SearchRequest, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = v1SearchRequest; // create path and map variables String localVarPath = "/v1/search"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "bearerAuth" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call v1SearchValidateBeforeCall(@javax.annotation.Nonnull V1SearchRequest v1SearchRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'v1SearchRequest' is set if (v1SearchRequest == null) { throw new ApiException("Missing the required parameter 'v1SearchRequest' when calling v1Search(Async)"); } return v1SearchCall(v1SearchRequest, _callback); } /** * 搜索页面 * 在机器人授权的页面范围内搜索相关内容 * @param v1SearchRequest (required) * @return V1SearchResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 429 </td><td> 请求频率超过限制 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public V1SearchResponse v1Search(@javax.annotation.Nonnull V1SearchRequest v1SearchRequest) throws ApiException { ApiResponse<V1SearchResponse> localVarResp = v1SearchWithHttpInfo(v1SearchRequest); return localVarResp.getData(); } /** * 搜索页面 * 在机器人授权的页面范围内搜索相关内容 * @param v1SearchRequest (required) * @return ApiResponse&lt;V1SearchResponse&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 429 </td><td> 请求频率超过限制 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public ApiResponse<V1SearchResponse> v1SearchWithHttpInfo(@javax.annotation.Nonnull V1SearchRequest v1SearchRequest) throws ApiException { okhttp3.Call localVarCall = v1SearchValidateBeforeCall(v1SearchRequest, null); Type localVarReturnType = new TypeToken<V1SearchResponse>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * 搜索页面 (asynchronously) * 在机器人授权的页面范围内搜索相关内容 * @param v1SearchRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table border="1"> <caption>Response Details</caption> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> 搜索成功 </td><td> - </td></tr> <tr><td> 400 </td><td> 请求参数错误 </td><td> - </td></tr> <tr><td> 401 </td><td> 未授权 </td><td> - </td></tr> <tr><td> 403 </td><td> 权限不足 </td><td> - </td></tr> <tr><td> 429 </td><td> 请求频率超过限制 </td><td> - </td></tr> <tr><td> 500 </td><td> 内部服务器错误 </td><td> - </td></tr> </table> */ public okhttp3.Call v1SearchAsync(@javax.annotation.Nonnull V1SearchRequest v1SearchRequest, final ApiCallback<V1SearchResponse> _callback) throws ApiException { okhttp3.Call localVarCall = v1SearchValidateBeforeCall(v1SearchRequest, _callback); Type localVarReturnType = new TypeToken<V1SearchResponse>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/auth/ApiKeyAuth.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.auth; import org.openapitools.client.ApiException; import org.openapitools.client.Pair; import java.net.URI; import java.util.Map; import java.util.List; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; private String apiKey; private String apiKeyPrefix; public ApiKeyAuth(String location, String paramName) { this.location = location; this.paramName = paramName; } public String getLocation() { return location; } public String getParamName() { return paramName; } public String getApiKey() { return apiKey; } public void setApiKey(String apiKey) { this.apiKey = apiKey; } public String getApiKeyPrefix() { return apiKeyPrefix; } public void setApiKeyPrefix(String apiKeyPrefix) { this.apiKeyPrefix = apiKeyPrefix; } @Override public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { if (apiKey == null) { return; } String value; if (apiKeyPrefix != null) { value = apiKeyPrefix + " " + apiKey; } else { value = apiKey; } if ("query".equals(location)) { queryParams.add(new Pair(paramName, value)); } else if ("header".equals(location)) { headerParams.put(paramName, value); } else if ("cookie".equals(location)) { cookieParams.put(paramName, value); } } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/auth/Authentication.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.auth; import org.openapitools.client.Pair; import org.openapitools.client.ApiException; import java.net.URI; import java.util.Map; import java.util.List; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public interface Authentication { /** * Apply authentication settings to header and query params. * * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters * @param payload HTTP request body * @param method HTTP method * @param uri URI * @throws ApiException if failed to update the parameters */ void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException; }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/auth/HttpBasicAuth.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.auth; import org.openapitools.client.Pair; import org.openapitools.client.ApiException; import okhttp3.Credentials; import java.net.URI; import java.util.Map; import java.util.List; public class HttpBasicAuth implements Authentication { private String username; private String password; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { if (username == null && password == null) { return; } headerParams.put("Authorization", Credentials.basic( username == null ? "" : username, password == null ? "" : password)); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/auth/HttpBearerAuth.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.auth; import org.openapitools.client.ApiException; import org.openapitools.client.Pair; import java.net.URI; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Supplier; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class HttpBearerAuth implements Authentication { private final String scheme; private Supplier<String> tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; } /** * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. * * @return The bearer token */ public String getBearerToken() { return tokenSupplier.get(); } /** * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. * * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { this.tokenSupplier = () -> bearerToken; } /** * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. * * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header */ public void setBearerToken(Supplier<String> tokenSupplier) { this.tokenSupplier = tokenSupplier; } @Override public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams, Map<String, String> cookieParams, String payload, String method, URI uri) throws ApiException { String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); if (bearerToken == null) { return; } headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); } private static String upperCaseBearer(String scheme) { return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/AbstractOpenApiSchema.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import org.openapitools.client.ApiException; import java.util.Objects; import java.lang.reflect.Type; import java.util.Map; /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object private Object instance; // is nullable private Boolean isNullable; // schema type (e.g. oneOf, anyOf) private final String schemaType; public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { this.schemaType = schemaType; this.isNullable = isNullable; } /** * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object * * @return an instance of the actual schema/object */ public abstract Map<String, Class<?>> getSchemas(); /** * Get the actual instance * * @return an instance of the actual schema/object */ //@JsonValue public Object getActualInstance() {return instance;} /** * Set the actual instance * * @param instance the actual instance of the schema/object */ public void setActualInstance(Object instance) {this.instance = instance;} /** * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well * * @return an instance of the actual schema/object */ public Object getActualInstanceRecursively() { return getActualInstanceRecursively(this); } private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { if (object.getActualInstance() == null) { return null; } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); } else { return object.getActualInstance(); } } /** * Get the schema type (e.g. anyOf, oneOf) * * @return the schema type */ public String getSchemaType() { return schemaType; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ").append(getClass()).append(" {\n"); sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); sb.append(" schemaType: ").append(toIndentedString(schemaType)).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 boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; return Objects.equals(this.instance, a.instance) && Objects.equals(this.isNullable, a.isNullable) && Objects.equals(this.schemaType, a.schemaType); } @Override public int hashCode() { return Objects.hash(instance, isNullable, schemaType); } /** * Is nullable * * @return true if it's nullable */ public Boolean isNullable() { if (Boolean.TRUE.equals(isNullable)) { return Boolean.TRUE; } else { return Boolean.FALSE; } } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/AppendBlockChildrenRequest.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.AppendBlockChildrenRequestChildrenInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * AppendBlockChildrenRequest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class AppendBlockChildrenRequest { public static final String SERIALIZED_NAME_CHILDREN = "children"; @SerializedName(SERIALIZED_NAME_CHILDREN) @javax.annotation.Nonnull private List<AppendBlockChildrenRequestChildrenInner> children = new ArrayList<>(); public AppendBlockChildrenRequest() { } public AppendBlockChildrenRequest children(@javax.annotation.Nonnull List<AppendBlockChildrenRequestChildrenInner> children) { this.children = children; return this; } public AppendBlockChildrenRequest addChildrenItem(AppendBlockChildrenRequestChildrenInner childrenItem) { if (this.children == null) { this.children = new ArrayList<>(); } this.children.add(childrenItem); return this; } /** * 要创建的子块列表,最多100个 * @return children */ @javax.annotation.Nonnull public List<AppendBlockChildrenRequestChildrenInner> getChildren() { return children; } public void setChildren(@javax.annotation.Nonnull List<AppendBlockChildrenRequestChildrenInner> children) { this.children = children; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AppendBlockChildrenRequest appendBlockChildrenRequest = (AppendBlockChildrenRequest) o; return Objects.equals(this.children, appendBlockChildrenRequest.children); } @Override public int hashCode() { return Objects.hash(children); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AppendBlockChildrenRequest {\n"); sb.append(" children: ").append(toIndentedString(children)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("children")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("children")); } /** * 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 AppendBlockChildrenRequest */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!AppendBlockChildrenRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in AppendBlockChildrenRequest is not found in the empty JSON string", AppendBlockChildrenRequest.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!AppendBlockChildrenRequest.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppendBlockChildrenRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AppendBlockChildrenRequest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("children").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `children` to be an array in the JSON string but got `%s`", jsonObj.get("children").toString())); } JsonArray jsonArraychildren = jsonObj.getAsJsonArray("children"); // validate the required field `children` (array) for (int i = 0; i < jsonArraychildren.size(); i++) { AppendBlockChildrenRequestChildrenInner.validateJsonElement(jsonArraychildren.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!AppendBlockChildrenRequest.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'AppendBlockChildrenRequest' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<AppendBlockChildrenRequest> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(AppendBlockChildrenRequest.class)); return (TypeAdapter<T>) new TypeAdapter<AppendBlockChildrenRequest>() { @Override public void write(JsonWriter out, AppendBlockChildrenRequest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public AppendBlockChildrenRequest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of AppendBlockChildrenRequest given an JSON string * * @param jsonString JSON string * @return An instance of AppendBlockChildrenRequest * @throws IOException if the JSON string is invalid with respect to AppendBlockChildrenRequest */ public static AppendBlockChildrenRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, AppendBlockChildrenRequest.class); } /** * Convert an instance of AppendBlockChildrenRequest to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/AppendBlockChildrenRequestChildrenInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.BlockData; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * AppendBlockChildrenRequestChildrenInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class AppendBlockChildrenRequestChildrenInner { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { PARAGRAPH("paragraph"), HEADING_1("heading_1"), HEADING_2("heading_2"), HEADING_3("heading_3"), BULLETED_LIST_ITEM("bulleted_list_item"), NUMBERED_LIST_ITEM("numbered_list_item"), TO_DO("to_do"), QUOTE("quote"), TOGGLE("toggle"), CODE("code"), IMAGE("image"), FILE("file"), BOOKMARK("bookmark"), EMBED("embed"), CALLOUT("callout"), EQUATION("equation"), LINK_TO_PAGE("link_to_page"), TEMPLATE("template"), SYNCED_BLOCK("synced_block"), DIVIDER("divider"), COLUMN_LIST("column_list"), COLUMN("column"), TABLE("table"), TABLE_ROW("table_row"), CHILD_PAGE("child_page"), CHILD_DATABASE("child_database"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nonnull private BlockData data; public AppendBlockChildrenRequestChildrenInner() { } public AppendBlockChildrenRequestChildrenInner type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public AppendBlockChildrenRequestChildrenInner data(@javax.annotation.Nonnull BlockData data) { this.data = data; return this; } /** * Get data * @return data */ @javax.annotation.Nonnull public BlockData getData() { return data; } public void setData(@javax.annotation.Nonnull BlockData data) { this.data = data; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AppendBlockChildrenRequestChildrenInner appendBlockChildrenRequestChildrenInner = (AppendBlockChildrenRequestChildrenInner) o; return Objects.equals(this.type, appendBlockChildrenRequestChildrenInner.type) && Objects.equals(this.data, appendBlockChildrenRequestChildrenInner.data); } @Override public int hashCode() { return Objects.hash(type, data); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AppendBlockChildrenRequestChildrenInner {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" data: ").append(toIndentedString(data)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "data")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "data")); } /** * 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 AppendBlockChildrenRequestChildrenInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!AppendBlockChildrenRequestChildrenInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in AppendBlockChildrenRequestChildrenInner is not found in the empty JSON string", AppendBlockChildrenRequestChildrenInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!AppendBlockChildrenRequestChildrenInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppendBlockChildrenRequestChildrenInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : AppendBlockChildrenRequestChildrenInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); // validate the required field `data` BlockData.validateJsonElement(jsonObj.get("data")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!AppendBlockChildrenRequestChildrenInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'AppendBlockChildrenRequestChildrenInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<AppendBlockChildrenRequestChildrenInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(AppendBlockChildrenRequestChildrenInner.class)); return (TypeAdapter<T>) new TypeAdapter<AppendBlockChildrenRequestChildrenInner>() { @Override public void write(JsonWriter out, AppendBlockChildrenRequestChildrenInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public AppendBlockChildrenRequestChildrenInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of AppendBlockChildrenRequestChildrenInner given an JSON string * * @param jsonString JSON string * @return An instance of AppendBlockChildrenRequestChildrenInner * @throws IOException if the JSON string is invalid with respect to AppendBlockChildrenRequestChildrenInner */ public static AppendBlockChildrenRequestChildrenInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, AppendBlockChildrenRequestChildrenInner.class); } /** * Convert an instance of AppendBlockChildrenRequestChildrenInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/AppendBlockChildrenResponse.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.Block; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * AppendBlockChildrenResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class AppendBlockChildrenResponse { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { LIST("list"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) @javax.annotation.Nullable private List<Block> results = new ArrayList<>(); public static final String SERIALIZED_NAME_NEXT_CURSOR = "next_cursor"; @SerializedName(SERIALIZED_NAME_NEXT_CURSOR) @javax.annotation.Nullable private String nextCursor; public static final String SERIALIZED_NAME_HAS_MORE = "has_more"; @SerializedName(SERIALIZED_NAME_HAS_MORE) @javax.annotation.Nullable private Boolean hasMore; public AppendBlockChildrenResponse() { } public AppendBlockChildrenResponse _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public AppendBlockChildrenResponse results(@javax.annotation.Nullable List<Block> results) { this.results = results; return this; } public AppendBlockChildrenResponse addResultsItem(Block resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } this.results.add(resultsItem); return this; } /** * Get results * @return results */ @javax.annotation.Nullable public List<Block> getResults() { return results; } public void setResults(@javax.annotation.Nullable List<Block> results) { this.results = results; } public AppendBlockChildrenResponse nextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; return this; } /** * 下一页游标,使用最后一个项目的ID作为游标值 * @return nextCursor */ @javax.annotation.Nullable public String getNextCursor() { return nextCursor; } public void setNextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; } public AppendBlockChildrenResponse hasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; return this; } /** * Get hasMore * @return hasMore */ @javax.annotation.Nullable public Boolean getHasMore() { return hasMore; } public void setHasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } AppendBlockChildrenResponse appendBlockChildrenResponse = (AppendBlockChildrenResponse) o; return Objects.equals(this._object, appendBlockChildrenResponse._object) && Objects.equals(this.results, appendBlockChildrenResponse.results) && Objects.equals(this.nextCursor, appendBlockChildrenResponse.nextCursor) && Objects.equals(this.hasMore, appendBlockChildrenResponse.hasMore); } @Override public int hashCode() { return Objects.hash(_object, results, nextCursor, hasMore); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class AppendBlockChildrenResponse {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" results: ").append(toIndentedString(results)).append("\n"); sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); sb.append(" hasMore: ").append(toIndentedString(hasMore)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "results", "next_cursor", "has_more")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 AppendBlockChildrenResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!AppendBlockChildrenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in AppendBlockChildrenResponse is not found in the empty JSON string", AppendBlockChildrenResponse.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!AppendBlockChildrenResponse.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppendBlockChildrenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull()) { JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); if (jsonArrayresults != null) { // ensure the json data is an array if (!jsonObj.get("results").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); } // validate the optional field `results` (array) for (int i = 0; i < jsonArrayresults.size(); i++) { Block.validateJsonElement(jsonArrayresults.get(i)); }; } } if ((jsonObj.get("next_cursor") != null && !jsonObj.get("next_cursor").isJsonNull()) && !jsonObj.get("next_cursor").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `next_cursor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next_cursor").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!AppendBlockChildrenResponse.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'AppendBlockChildrenResponse' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<AppendBlockChildrenResponse> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(AppendBlockChildrenResponse.class)); return (TypeAdapter<T>) new TypeAdapter<AppendBlockChildrenResponse>() { @Override public void write(JsonWriter out, AppendBlockChildrenResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public AppendBlockChildrenResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of AppendBlockChildrenResponse given an JSON string * * @param jsonString JSON string * @return An instance of AppendBlockChildrenResponse * @throws IOException if the JSON string is invalid with respect to AppendBlockChildrenResponse */ public static AppendBlockChildrenResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, AppendBlockChildrenResponse.class); } /** * Convert an instance of AppendBlockChildrenResponse to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Block.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.time.OffsetDateTime; import java.util.Arrays; import java.util.UUID; import org.openapitools.client.model.BlockData; import org.openapitools.client.model.Parent; import org.openapitools.client.model.User; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * Block */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Block { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { BLOCK("block"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private Parent parent; /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { PARAGRAPH("paragraph"), HEADING_1("heading_1"), HEADING_2("heading_2"), HEADING_3("heading_3"), BULLETED_LIST_ITEM("bulleted_list_item"), NUMBERED_LIST_ITEM("numbered_list_item"), TO_DO("to_do"), QUOTE("quote"), TOGGLE("toggle"), CODE("code"), IMAGE("image"), FILE("file"), BOOKMARK("bookmark"), EMBED("embed"), CALLOUT("callout"), EQUATION("equation"), LINK_TO_PAGE("link_to_page"), TEMPLATE("template"), SYNCED_BLOCK("synced_block"), DIVIDER("divider"), COLUMN_LIST("column_list"), COLUMN("column"), TABLE("table"), TABLE_ROW("table_row"), CHILD_PAGE("child_page"), CHILD_DATABASE("child_database"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private TypeEnum type; public static final String SERIALIZED_NAME_CREATED_TIME = "created_time"; @SerializedName(SERIALIZED_NAME_CREATED_TIME) @javax.annotation.Nullable private OffsetDateTime createdTime; public static final String SERIALIZED_NAME_CREATED_BY = "created_by"; @SerializedName(SERIALIZED_NAME_CREATED_BY) @javax.annotation.Nullable private User createdBy; public static final String SERIALIZED_NAME_LAST_EDITED_TIME = "last_edited_time"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_TIME) @javax.annotation.Nullable private OffsetDateTime lastEditedTime; public static final String SERIALIZED_NAME_LAST_EDITED_BY = "last_edited_by"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_BY) @javax.annotation.Nullable private User lastEditedBy; public static final String SERIALIZED_NAME_ARCHIVED = "archived"; @SerializedName(SERIALIZED_NAME_ARCHIVED) @javax.annotation.Nullable private Boolean archived; public static final String SERIALIZED_NAME_HAS_CHILDREN = "has_children"; @SerializedName(SERIALIZED_NAME_HAS_CHILDREN) @javax.annotation.Nullable private Boolean hasChildren; public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) @javax.annotation.Nullable private BlockData data; public Block() { } public Block _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public Block id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } public Block parent(@javax.annotation.Nullable Parent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public Parent getParent() { return parent; } public void setParent(@javax.annotation.Nullable Parent parent) { this.parent = parent; } public Block type(@javax.annotation.Nullable TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nullable TypeEnum type) { this.type = type; } public Block createdTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; return this; } /** * Get createdTime * @return createdTime */ @javax.annotation.Nullable public OffsetDateTime getCreatedTime() { return createdTime; } public void setCreatedTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; } public Block createdBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; return this; } /** * Get createdBy * @return createdBy */ @javax.annotation.Nullable public User getCreatedBy() { return createdBy; } public void setCreatedBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; } public Block lastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; return this; } /** * Get lastEditedTime * @return lastEditedTime */ @javax.annotation.Nullable public OffsetDateTime getLastEditedTime() { return lastEditedTime; } public void setLastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; } public Block lastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; return this; } /** * Get lastEditedBy * @return lastEditedBy */ @javax.annotation.Nullable public User getLastEditedBy() { return lastEditedBy; } public void setLastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; } public Block archived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; return this; } /** * Get archived * @return archived */ @javax.annotation.Nullable public Boolean getArchived() { return archived; } public void setArchived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; } public Block hasChildren(@javax.annotation.Nullable Boolean hasChildren) { this.hasChildren = hasChildren; return this; } /** * Get hasChildren * @return hasChildren */ @javax.annotation.Nullable public Boolean getHasChildren() { return hasChildren; } public void setHasChildren(@javax.annotation.Nullable Boolean hasChildren) { this.hasChildren = hasChildren; } public Block data(@javax.annotation.Nullable BlockData data) { this.data = data; return this; } /** * Get data * @return data */ @javax.annotation.Nullable public BlockData getData() { return data; } public void setData(@javax.annotation.Nullable BlockData data) { this.data = data; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Block block = (Block) o; return Objects.equals(this._object, block._object) && Objects.equals(this.id, block.id) && Objects.equals(this.parent, block.parent) && Objects.equals(this.type, block.type) && Objects.equals(this.createdTime, block.createdTime) && Objects.equals(this.createdBy, block.createdBy) && Objects.equals(this.lastEditedTime, block.lastEditedTime) && Objects.equals(this.lastEditedBy, block.lastEditedBy) && Objects.equals(this.archived, block.archived) && Objects.equals(this.hasChildren, block.hasChildren) && Objects.equals(this.data, block.data); } @Override public int hashCode() { return Objects.hash(_object, id, parent, type, createdTime, createdBy, lastEditedTime, lastEditedBy, archived, hasChildren, data); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Block {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" lastEditedTime: ").append(toIndentedString(lastEditedTime)).append("\n"); sb.append(" lastEditedBy: ").append(toIndentedString(lastEditedBy)).append("\n"); sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); sb.append(" hasChildren: ").append(toIndentedString(hasChildren)).append("\n"); sb.append(" data: ").append(toIndentedString(data)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id", "parent", "type", "created_time", "created_by", "last_edited_time", "last_edited_by", "archived", "has_children", "data")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 Block */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Block.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in Block is not found in the empty JSON string", Block.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!Block.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Block` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { Parent.validateJsonElement(jsonObj.get("parent")); } if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the optional field `type` if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { TypeEnum.validateJsonElement(jsonObj.get("type")); } // validate the optional field `created_by` if (jsonObj.get("created_by") != null && !jsonObj.get("created_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("created_by")); } // validate the optional field `last_edited_by` if (jsonObj.get("last_edited_by") != null && !jsonObj.get("last_edited_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("last_edited_by")); } // validate the optional field `data` if (jsonObj.get("data") != null && !jsonObj.get("data").isJsonNull()) { BlockData.validateJsonElement(jsonObj.get("data")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Block.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Block' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<Block> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Block.class)); return (TypeAdapter<T>) new TypeAdapter<Block>() { @Override public void write(JsonWriter out, Block value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public Block read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of Block given an JSON string * * @param jsonString JSON string * @return An instance of Block * @throws IOException if the JSON string is invalid with respect to Block */ public static Block fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Block.class); } /** * Convert an instance of Block to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/BlockData.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import java.util.UUID; import org.openapitools.client.model.BlockDataExternal; import org.openapitools.client.model.BlockDataFile; import org.openapitools.client.model.BlockDataSyncedFrom; import org.openapitools.client.model.Icon; import org.openapitools.client.model.RichTextItem; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * 块类型特定的数据内容 */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class BlockData { public static final String SERIALIZED_NAME_RICH_TEXT = "rich_text"; @SerializedName(SERIALIZED_NAME_RICH_TEXT) @javax.annotation.Nullable private List<RichTextItem> richText = new ArrayList<>(); /** * 文本颜色 */ @JsonAdapter(TextColorEnum.Adapter.class) public enum TextColorEnum { DEFAULT("default"), GRAY("gray"), BROWN("brown"), ORANGE("orange"), YELLOW("yellow"), GREEN("green"), BLUE("blue"), PURPLE("purple"), PINK("pink"), RED("red"); private String value; TextColorEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TextColorEnum fromValue(String value) { for (TextColorEnum b : TextColorEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TextColorEnum> { @Override public void write(final JsonWriter jsonWriter, final TextColorEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TextColorEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TextColorEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TextColorEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TEXT_COLOR = "text_color"; @SerializedName(SERIALIZED_NAME_TEXT_COLOR) @javax.annotation.Nullable private TextColorEnum textColor; /** * 背景颜色 */ @JsonAdapter(BackgroundColorEnum.Adapter.class) public enum BackgroundColorEnum { DEFAULT("default"), GRAY("gray"), BROWN("brown"), ORANGE("orange"), YELLOW("yellow"), GREEN("green"), BLUE("blue"), PURPLE("purple"), PINK("pink"), RED("red"); private String value; BackgroundColorEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static BackgroundColorEnum fromValue(String value) { for (BackgroundColorEnum b : BackgroundColorEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<BackgroundColorEnum> { @Override public void write(final JsonWriter jsonWriter, final BackgroundColorEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public BackgroundColorEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return BackgroundColorEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); BackgroundColorEnum.fromValue(value); } } public static final String SERIALIZED_NAME_BACKGROUND_COLOR = "background_color"; @SerializedName(SERIALIZED_NAME_BACKGROUND_COLOR) @javax.annotation.Nullable private BackgroundColorEnum backgroundColor; public static final String SERIALIZED_NAME_CHECKED = "checked"; @SerializedName(SERIALIZED_NAME_CHECKED) @javax.annotation.Nullable private Boolean checked; public static final String SERIALIZED_NAME_LANGUAGE = "language"; @SerializedName(SERIALIZED_NAME_LANGUAGE) @javax.annotation.Nullable private String language; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_CAPTION = "caption"; @SerializedName(SERIALIZED_NAME_CAPTION) @javax.annotation.Nullable private List<RichTextItem> caption = new ArrayList<>(); public static final String SERIALIZED_NAME_ICON = "icon"; @SerializedName(SERIALIZED_NAME_ICON) @javax.annotation.Nullable private Icon icon; public static final String SERIALIZED_NAME_EXPRESSION = "expression"; @SerializedName(SERIALIZED_NAME_EXPRESSION) @javax.annotation.Nullable private String expression; public static final String SERIALIZED_NAME_PAGE_ID = "page_id"; @SerializedName(SERIALIZED_NAME_PAGE_ID) @javax.annotation.Nullable private UUID pageId; public static final String SERIALIZED_NAME_TABLE_WIDTH = "table_width"; @SerializedName(SERIALIZED_NAME_TABLE_WIDTH) @javax.annotation.Nullable private Integer tableWidth; public static final String SERIALIZED_NAME_HAS_COLUMN_HEADER = "has_column_header"; @SerializedName(SERIALIZED_NAME_HAS_COLUMN_HEADER) @javax.annotation.Nullable private Boolean hasColumnHeader; public static final String SERIALIZED_NAME_HAS_ROW_HEADER = "has_row_header"; @SerializedName(SERIALIZED_NAME_HAS_ROW_HEADER) @javax.annotation.Nullable private Boolean hasRowHeader; public static final String SERIALIZED_NAME_CELLS = "cells"; @SerializedName(SERIALIZED_NAME_CELLS) @javax.annotation.Nullable private List<List<RichTextItem>> cells = new ArrayList<>(); public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @javax.annotation.Nullable private String title; public static final String SERIALIZED_NAME_SYNCED_FROM = "synced_from"; @SerializedName(SERIALIZED_NAME_SYNCED_FROM) @javax.annotation.Nullable private BlockDataSyncedFrom syncedFrom; public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) @javax.annotation.Nullable private BlockDataFile _file; public static final String SERIALIZED_NAME_EXTERNAL = "external"; @SerializedName(SERIALIZED_NAME_EXTERNAL) @javax.annotation.Nullable private BlockDataExternal external; public BlockData() { } public BlockData richText(@javax.annotation.Nullable List<RichTextItem> richText) { this.richText = richText; return this; } public BlockData addRichTextItem(RichTextItem richTextItem) { if (this.richText == null) { this.richText = new ArrayList<>(); } this.richText.add(richTextItem); return this; } /** * 富文本内容 * @return richText */ @javax.annotation.Nullable public List<RichTextItem> getRichText() { return richText; } public void setRichText(@javax.annotation.Nullable List<RichTextItem> richText) { this.richText = richText; } public BlockData textColor(@javax.annotation.Nullable TextColorEnum textColor) { this.textColor = textColor; return this; } /** * 文本颜色 * @return textColor */ @javax.annotation.Nullable public TextColorEnum getTextColor() { return textColor; } public void setTextColor(@javax.annotation.Nullable TextColorEnum textColor) { this.textColor = textColor; } public BlockData backgroundColor(@javax.annotation.Nullable BackgroundColorEnum backgroundColor) { this.backgroundColor = backgroundColor; return this; } /** * 背景颜色 * @return backgroundColor */ @javax.annotation.Nullable public BackgroundColorEnum getBackgroundColor() { return backgroundColor; } public void setBackgroundColor(@javax.annotation.Nullable BackgroundColorEnum backgroundColor) { this.backgroundColor = backgroundColor; } public BlockData checked(@javax.annotation.Nullable Boolean checked) { this.checked = checked; return this; } /** * 待办事项是否完成 * @return checked */ @javax.annotation.Nullable public Boolean getChecked() { return checked; } public void setChecked(@javax.annotation.Nullable Boolean checked) { this.checked = checked; } public BlockData language(@javax.annotation.Nullable String language) { this.language = language; return this; } /** * 代码块语言 * @return language */ @javax.annotation.Nullable public String getLanguage() { return language; } public void setLanguage(@javax.annotation.Nullable String language) { this.language = language; } public BlockData url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * 链接地址 * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } public BlockData caption(@javax.annotation.Nullable List<RichTextItem> caption) { this.caption = caption; return this; } public BlockData addCaptionItem(RichTextItem captionItem) { if (this.caption == null) { this.caption = new ArrayList<>(); } this.caption.add(captionItem); return this; } /** * 说明文字 * @return caption */ @javax.annotation.Nullable public List<RichTextItem> getCaption() { return caption; } public void setCaption(@javax.annotation.Nullable List<RichTextItem> caption) { this.caption = caption; } public BlockData icon(@javax.annotation.Nullable Icon icon) { this.icon = icon; return this; } /** * 图标 * @return icon */ @javax.annotation.Nullable public Icon getIcon() { return icon; } public void setIcon(@javax.annotation.Nullable Icon icon) { this.icon = icon; } public BlockData expression(@javax.annotation.Nullable String expression) { this.expression = expression; return this; } /** * 数学公式表达式 * @return expression */ @javax.annotation.Nullable public String getExpression() { return expression; } public void setExpression(@javax.annotation.Nullable String expression) { this.expression = expression; } public BlockData pageId(@javax.annotation.Nullable UUID pageId) { this.pageId = pageId; return this; } /** * 页面引用ID * @return pageId */ @javax.annotation.Nullable public UUID getPageId() { return pageId; } public void setPageId(@javax.annotation.Nullable UUID pageId) { this.pageId = pageId; } public BlockData tableWidth(@javax.annotation.Nullable Integer tableWidth) { this.tableWidth = tableWidth; return this; } /** * 表格列数 * @return tableWidth */ @javax.annotation.Nullable public Integer getTableWidth() { return tableWidth; } public void setTableWidth(@javax.annotation.Nullable Integer tableWidth) { this.tableWidth = tableWidth; } public BlockData hasColumnHeader(@javax.annotation.Nullable Boolean hasColumnHeader) { this.hasColumnHeader = hasColumnHeader; return this; } /** * 是否有列标题 * @return hasColumnHeader */ @javax.annotation.Nullable public Boolean getHasColumnHeader() { return hasColumnHeader; } public void setHasColumnHeader(@javax.annotation.Nullable Boolean hasColumnHeader) { this.hasColumnHeader = hasColumnHeader; } public BlockData hasRowHeader(@javax.annotation.Nullable Boolean hasRowHeader) { this.hasRowHeader = hasRowHeader; return this; } /** * 是否有行标题 * @return hasRowHeader */ @javax.annotation.Nullable public Boolean getHasRowHeader() { return hasRowHeader; } public void setHasRowHeader(@javax.annotation.Nullable Boolean hasRowHeader) { this.hasRowHeader = hasRowHeader; } public BlockData cells(@javax.annotation.Nullable List<List<RichTextItem>> cells) { this.cells = cells; return this; } public BlockData addCellsItem(List<RichTextItem> cellsItem) { if (this.cells == null) { this.cells = new ArrayList<>(); } this.cells.add(cellsItem); return this; } /** * 表格单元格内容 * @return cells */ @javax.annotation.Nullable public List<List<RichTextItem>> getCells() { return cells; } public void setCells(@javax.annotation.Nullable List<List<RichTextItem>> cells) { this.cells = cells; } public BlockData title(@javax.annotation.Nullable String title) { this.title = title; return this; } /** * 子页面或子数据库标题 * @return title */ @javax.annotation.Nullable public String getTitle() { return title; } public void setTitle(@javax.annotation.Nullable String title) { this.title = title; } public BlockData syncedFrom(@javax.annotation.Nullable BlockDataSyncedFrom syncedFrom) { this.syncedFrom = syncedFrom; return this; } /** * Get syncedFrom * @return syncedFrom */ @javax.annotation.Nullable public BlockDataSyncedFrom getSyncedFrom() { return syncedFrom; } public void setSyncedFrom(@javax.annotation.Nullable BlockDataSyncedFrom syncedFrom) { this.syncedFrom = syncedFrom; } public BlockData _file(@javax.annotation.Nullable BlockDataFile _file) { this._file = _file; return this; } /** * Get _file * @return _file */ @javax.annotation.Nullable public BlockDataFile getFile() { return _file; } public void setFile(@javax.annotation.Nullable BlockDataFile _file) { this._file = _file; } public BlockData external(@javax.annotation.Nullable BlockDataExternal external) { this.external = external; return this; } /** * Get external * @return external */ @javax.annotation.Nullable public BlockDataExternal getExternal() { return external; } public void setExternal(@javax.annotation.Nullable BlockDataExternal external) { this.external = external; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BlockData blockData = (BlockData) o; return Objects.equals(this.richText, blockData.richText) && Objects.equals(this.textColor, blockData.textColor) && Objects.equals(this.backgroundColor, blockData.backgroundColor) && Objects.equals(this.checked, blockData.checked) && Objects.equals(this.language, blockData.language) && Objects.equals(this.url, blockData.url) && Objects.equals(this.caption, blockData.caption) && Objects.equals(this.icon, blockData.icon) && Objects.equals(this.expression, blockData.expression) && Objects.equals(this.pageId, blockData.pageId) && Objects.equals(this.tableWidth, blockData.tableWidth) && Objects.equals(this.hasColumnHeader, blockData.hasColumnHeader) && Objects.equals(this.hasRowHeader, blockData.hasRowHeader) && Objects.equals(this.cells, blockData.cells) && Objects.equals(this.title, blockData.title) && Objects.equals(this.syncedFrom, blockData.syncedFrom) && Objects.equals(this._file, blockData._file) && Objects.equals(this.external, blockData.external); } @Override public int hashCode() { return Objects.hash(richText, textColor, backgroundColor, checked, language, url, caption, icon, expression, pageId, tableWidth, hasColumnHeader, hasRowHeader, cells, title, syncedFrom, _file, external); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BlockData {\n"); sb.append(" richText: ").append(toIndentedString(richText)).append("\n"); sb.append(" textColor: ").append(toIndentedString(textColor)).append("\n"); sb.append(" backgroundColor: ").append(toIndentedString(backgroundColor)).append("\n"); sb.append(" checked: ").append(toIndentedString(checked)).append("\n"); sb.append(" language: ").append(toIndentedString(language)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" caption: ").append(toIndentedString(caption)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" expression: ").append(toIndentedString(expression)).append("\n"); sb.append(" pageId: ").append(toIndentedString(pageId)).append("\n"); sb.append(" tableWidth: ").append(toIndentedString(tableWidth)).append("\n"); sb.append(" hasColumnHeader: ").append(toIndentedString(hasColumnHeader)).append("\n"); sb.append(" hasRowHeader: ").append(toIndentedString(hasRowHeader)).append("\n"); sb.append(" cells: ").append(toIndentedString(cells)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" syncedFrom: ").append(toIndentedString(syncedFrom)).append("\n"); sb.append(" _file: ").append(toIndentedString(_file)).append("\n"); sb.append(" external: ").append(toIndentedString(external)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("rich_text", "text_color", "background_color", "checked", "language", "url", "caption", "icon", "expression", "page_id", "table_width", "has_column_header", "has_row_header", "cells", "title", "synced_from", "file", "external")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 BlockData */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BlockData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in BlockData is not found in the empty JSON string", BlockData.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!BlockData.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (jsonObj.get("rich_text") != null && !jsonObj.get("rich_text").isJsonNull()) { JsonArray jsonArrayrichText = jsonObj.getAsJsonArray("rich_text"); if (jsonArrayrichText != null) { // ensure the json data is an array if (!jsonObj.get("rich_text").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `rich_text` to be an array in the JSON string but got `%s`", jsonObj.get("rich_text").toString())); } // validate the optional field `rich_text` (array) for (int i = 0; i < jsonArrayrichText.size(); i++) { RichTextItem.validateJsonElement(jsonArrayrichText.get(i)); }; } } if ((jsonObj.get("text_color") != null && !jsonObj.get("text_color").isJsonNull()) && !jsonObj.get("text_color").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `text_color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text_color").toString())); } // validate the optional field `text_color` if (jsonObj.get("text_color") != null && !jsonObj.get("text_color").isJsonNull()) { TextColorEnum.validateJsonElement(jsonObj.get("text_color")); } if ((jsonObj.get("background_color") != null && !jsonObj.get("background_color").isJsonNull()) && !jsonObj.get("background_color").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `background_color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("background_color").toString())); } // validate the optional field `background_color` if (jsonObj.get("background_color") != null && !jsonObj.get("background_color").isJsonNull()) { BackgroundColorEnum.validateJsonElement(jsonObj.get("background_color")); } if ((jsonObj.get("language") != null && !jsonObj.get("language").isJsonNull()) && !jsonObj.get("language").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").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("caption") != null && !jsonObj.get("caption").isJsonNull()) { JsonArray jsonArraycaption = jsonObj.getAsJsonArray("caption"); if (jsonArraycaption != null) { // ensure the json data is an array if (!jsonObj.get("caption").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `caption` to be an array in the JSON string but got `%s`", jsonObj.get("caption").toString())); } // validate the optional field `caption` (array) for (int i = 0; i < jsonArraycaption.size(); i++) { RichTextItem.validateJsonElement(jsonArraycaption.get(i)); }; } } // validate the optional field `icon` if (jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) { Icon.validateJsonElement(jsonObj.get("icon")); } if ((jsonObj.get("expression") != null && !jsonObj.get("expression").isJsonNull()) && !jsonObj.get("expression").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `expression` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expression").toString())); } if ((jsonObj.get("page_id") != null && !jsonObj.get("page_id").isJsonNull()) && !jsonObj.get("page_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `page_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("page_id").toString())); } // ensure the optional json data is an array if present if (jsonObj.get("cells") != null && !jsonObj.get("cells").isJsonNull() && !jsonObj.get("cells").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `cells` to be an array in the JSON string but got `%s`", jsonObj.get("cells").toString())); } if ((jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) && !jsonObj.get("title").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `title` to be a primitive type in the JSON string but got `%s`", jsonObj.get("title").toString())); } // validate the optional field `synced_from` if (jsonObj.get("synced_from") != null && !jsonObj.get("synced_from").isJsonNull()) { BlockDataSyncedFrom.validateJsonElement(jsonObj.get("synced_from")); } // validate the optional field `file` if (jsonObj.get("file") != null && !jsonObj.get("file").isJsonNull()) { BlockDataFile.validateJsonElement(jsonObj.get("file")); } // validate the optional field `external` if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { BlockDataExternal.validateJsonElement(jsonObj.get("external")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!BlockData.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'BlockData' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<BlockData> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(BlockData.class)); return (TypeAdapter<T>) new TypeAdapter<BlockData>() { @Override public void write(JsonWriter out, BlockData value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public BlockData read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of BlockData given an JSON string * * @param jsonString JSON string * @return An instance of BlockData * @throws IOException if the JSON string is invalid with respect to BlockData */ public static BlockData fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BlockData.class); } /** * Convert an instance of BlockData to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/BlockDataExternal.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * 外部链接信息 */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class BlockDataExternal { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public BlockDataExternal() { } public BlockDataExternal url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BlockDataExternal blockDataExternal = (BlockDataExternal) o; return Objects.equals(this.url, blockDataExternal.url); } @Override public int hashCode() { return Objects.hash(url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BlockDataExternal {\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 BlockDataExternal */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BlockDataExternal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in BlockDataExternal is not found in the empty JSON string", BlockDataExternal.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!BlockDataExternal.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockDataExternal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!BlockDataExternal.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'BlockDataExternal' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<BlockDataExternal> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(BlockDataExternal.class)); return (TypeAdapter<T>) new TypeAdapter<BlockDataExternal>() { @Override public void write(JsonWriter out, BlockDataExternal value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public BlockDataExternal read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of BlockDataExternal given an JSON string * * @param jsonString JSON string * @return An instance of BlockDataExternal * @throws IOException if the JSON string is invalid with respect to BlockDataExternal */ public static BlockDataExternal fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BlockDataExternal.class); } /** * Convert an instance of BlockDataExternal to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/BlockDataFile.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.time.OffsetDateTime; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * 内部文件信息 */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class BlockDataFile { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_EXPIRY_TIME = "expiry_time"; @SerializedName(SERIALIZED_NAME_EXPIRY_TIME) @javax.annotation.Nullable private OffsetDateTime expiryTime; public BlockDataFile() { } public BlockDataFile url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } public BlockDataFile expiryTime(@javax.annotation.Nullable OffsetDateTime expiryTime) { this.expiryTime = expiryTime; return this; } /** * Get expiryTime * @return expiryTime */ @javax.annotation.Nullable public OffsetDateTime getExpiryTime() { return expiryTime; } public void setExpiryTime(@javax.annotation.Nullable OffsetDateTime expiryTime) { this.expiryTime = expiryTime; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BlockDataFile blockDataFile = (BlockDataFile) o; return Objects.equals(this.url, blockDataFile.url) && Objects.equals(this.expiryTime, blockDataFile.expiryTime); } @Override public int hashCode() { return Objects.hash(url, expiryTime); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BlockDataFile {\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" expiryTime: ").append(toIndentedString(expiryTime)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url", "expiry_time")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 BlockDataFile */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BlockDataFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in BlockDataFile is not found in the empty JSON string", BlockDataFile.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!BlockDataFile.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockDataFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!BlockDataFile.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'BlockDataFile' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<BlockDataFile> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(BlockDataFile.class)); return (TypeAdapter<T>) new TypeAdapter<BlockDataFile>() { @Override public void write(JsonWriter out, BlockDataFile value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public BlockDataFile read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of BlockDataFile given an JSON string * * @param jsonString JSON string * @return An instance of BlockDataFile * @throws IOException if the JSON string is invalid with respect to BlockDataFile */ public static BlockDataFile fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BlockDataFile.class); } /** * Convert an instance of BlockDataFile to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/BlockDataSyncedFrom.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * 同步块来源 */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class BlockDataSyncedFrom { public static final String SERIALIZED_NAME_BLOCK_ID = "block_id"; @SerializedName(SERIALIZED_NAME_BLOCK_ID) @javax.annotation.Nullable private UUID blockId; public BlockDataSyncedFrom() { } public BlockDataSyncedFrom blockId(@javax.annotation.Nullable UUID blockId) { this.blockId = blockId; return this; } /** * Get blockId * @return blockId */ @javax.annotation.Nullable public UUID getBlockId() { return blockId; } public void setBlockId(@javax.annotation.Nullable UUID blockId) { this.blockId = blockId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BlockDataSyncedFrom blockDataSyncedFrom = (BlockDataSyncedFrom) o; return Objects.equals(this.blockId, blockDataSyncedFrom.blockId); } @Override public int hashCode() { return Objects.hash(blockId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class BlockDataSyncedFrom {\n"); sb.append(" blockId: ").append(toIndentedString(blockId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("block_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 BlockDataSyncedFrom */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!BlockDataSyncedFrom.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in BlockDataSyncedFrom is not found in the empty JSON string", BlockDataSyncedFrom.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!BlockDataSyncedFrom.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BlockDataSyncedFrom` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("block_id") != null && !jsonObj.get("block_id").isJsonNull()) && !jsonObj.get("block_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `block_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("block_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!BlockDataSyncedFrom.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'BlockDataSyncedFrom' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<BlockDataSyncedFrom> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(BlockDataSyncedFrom.class)); return (TypeAdapter<T>) new TypeAdapter<BlockDataSyncedFrom>() { @Override public void write(JsonWriter out, BlockDataSyncedFrom value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public BlockDataSyncedFrom read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of BlockDataSyncedFrom given an JSON string * * @param jsonString JSON string * @return An instance of BlockDataSyncedFrom * @throws IOException if the JSON string is invalid with respect to BlockDataSyncedFrom */ public static BlockDataSyncedFrom fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, BlockDataSyncedFrom.class); } /** * Convert an instance of BlockDataSyncedFrom to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Cover.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.CoverExternal; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * Cover */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Cover { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { EXTERNAL("external"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private TypeEnum type; public static final String SERIALIZED_NAME_EXTERNAL = "external"; @SerializedName(SERIALIZED_NAME_EXTERNAL) @javax.annotation.Nullable private CoverExternal external; public Cover() { } public Cover type(@javax.annotation.Nullable TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nullable TypeEnum type) { this.type = type; } public Cover external(@javax.annotation.Nullable CoverExternal external) { this.external = external; return this; } /** * Get external * @return external */ @javax.annotation.Nullable public CoverExternal getExternal() { return external; } public void setExternal(@javax.annotation.Nullable CoverExternal external) { this.external = external; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Cover cover = (Cover) o; return Objects.equals(this.type, cover.type) && Objects.equals(this.external, cover.external); } @Override public int hashCode() { return Objects.hash(type, external); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Cover {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" external: ").append(toIndentedString(external)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "external")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 Cover */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Cover.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in Cover is not found in the empty JSON string", Cover.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!Cover.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Cover` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the optional field `type` if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { TypeEnum.validateJsonElement(jsonObj.get("type")); } // validate the optional field `external` if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { CoverExternal.validateJsonElement(jsonObj.get("external")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Cover.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Cover' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<Cover> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Cover.class)); return (TypeAdapter<T>) new TypeAdapter<Cover>() { @Override public void write(JsonWriter out, Cover value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public Cover read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of Cover given an JSON string * * @param jsonString JSON string * @return An instance of Cover * @throws IOException if the JSON string is invalid with respect to Cover */ public static Cover fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Cover.class); } /** * Convert an instance of Cover to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CoverExternal.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CoverExternal */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CoverExternal { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public CoverExternal() { } public CoverExternal url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CoverExternal coverExternal = (CoverExternal) o; return Objects.equals(this.url, coverExternal.url); } @Override public int hashCode() { return Objects.hash(url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CoverExternal {\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 CoverExternal */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CoverExternal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CoverExternal is not found in the empty JSON string", CoverExternal.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CoverExternal.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CoverExternal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CoverExternal.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CoverExternal' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CoverExternal> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CoverExternal.class)); return (TypeAdapter<T>) new TypeAdapter<CoverExternal>() { @Override public void write(JsonWriter out, CoverExternal value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CoverExternal read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CoverExternal given an JSON string * * @param jsonString JSON string * @return An instance of CoverExternal * @throws IOException if the JSON string is invalid with respect to CoverExternal */ public static CoverExternal fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CoverExternal.class); } /** * Convert an instance of CoverExternal to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreateDatabaseRequest.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.client.model.Cover; import org.openapitools.client.model.Icon; import org.openapitools.client.model.Parent; import org.openapitools.client.model.PropertySchema; import org.openapitools.client.model.RichTextItem; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreateDatabaseRequest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreateDatabaseRequest { public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private Parent parent; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @javax.annotation.Nonnull private List<RichTextItem> title = new ArrayList<>(); public static final String SERIALIZED_NAME_ICON = "icon"; @SerializedName(SERIALIZED_NAME_ICON) @javax.annotation.Nullable private Icon icon; public static final String SERIALIZED_NAME_COVER = "cover"; @SerializedName(SERIALIZED_NAME_COVER) @javax.annotation.Nullable private Cover cover; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) @javax.annotation.Nonnull private Map<String, PropertySchema> properties = new HashMap<>(); public static final String SERIALIZED_NAME_IS_INLINE = "is_inline"; @SerializedName(SERIALIZED_NAME_IS_INLINE) @javax.annotation.Nullable private Boolean isInline; public CreateDatabaseRequest() { } public CreateDatabaseRequest parent(@javax.annotation.Nullable Parent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public Parent getParent() { return parent; } public void setParent(@javax.annotation.Nullable Parent parent) { this.parent = parent; } public CreateDatabaseRequest title(@javax.annotation.Nonnull List<RichTextItem> title) { this.title = title; return this; } public CreateDatabaseRequest addTitleItem(RichTextItem titleItem) { if (this.title == null) { this.title = new ArrayList<>(); } this.title.add(titleItem); return this; } /** * Get title * @return title */ @javax.annotation.Nonnull public List<RichTextItem> getTitle() { return title; } public void setTitle(@javax.annotation.Nonnull List<RichTextItem> title) { this.title = title; } public CreateDatabaseRequest icon(@javax.annotation.Nullable Icon icon) { this.icon = icon; return this; } /** * Get icon * @return icon */ @javax.annotation.Nullable public Icon getIcon() { return icon; } public void setIcon(@javax.annotation.Nullable Icon icon) { this.icon = icon; } public CreateDatabaseRequest cover(@javax.annotation.Nullable Cover cover) { this.cover = cover; return this; } /** * Get cover * @return cover */ @javax.annotation.Nullable public Cover getCover() { return cover; } public void setCover(@javax.annotation.Nullable Cover cover) { this.cover = cover; } public CreateDatabaseRequest properties(@javax.annotation.Nonnull Map<String, PropertySchema> properties) { this.properties = properties; return this; } public CreateDatabaseRequest putPropertiesItem(String key, PropertySchema propertiesItem) { if (this.properties == null) { this.properties = new HashMap<>(); } this.properties.put(key, propertiesItem); return this; } /** * Get properties * @return properties */ @javax.annotation.Nonnull public Map<String, PropertySchema> getProperties() { return properties; } public void setProperties(@javax.annotation.Nonnull Map<String, PropertySchema> properties) { this.properties = properties; } public CreateDatabaseRequest isInline(@javax.annotation.Nullable Boolean isInline) { this.isInline = isInline; return this; } /** * 是否为内联数据库 * @return isInline */ @javax.annotation.Nullable public Boolean getIsInline() { return isInline; } public void setIsInline(@javax.annotation.Nullable Boolean isInline) { this.isInline = isInline; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreateDatabaseRequest createDatabaseRequest = (CreateDatabaseRequest) o; return Objects.equals(this.parent, createDatabaseRequest.parent) && Objects.equals(this.title, createDatabaseRequest.title) && Objects.equals(this.icon, createDatabaseRequest.icon) && Objects.equals(this.cover, createDatabaseRequest.cover) && Objects.equals(this.properties, createDatabaseRequest.properties) && Objects.equals(this.isInline, createDatabaseRequest.isInline); } @Override public int hashCode() { return Objects.hash(parent, title, icon, cover, properties, isInline); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreateDatabaseRequest {\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" cover: ").append(toIndentedString(cover)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append(" isInline: ").append(toIndentedString(isInline)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("parent", "title", "icon", "cover", "properties", "is_inline")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("title", "properties")); } /** * 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 CreateDatabaseRequest */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreateDatabaseRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreateDatabaseRequest is not found in the empty JSON string", CreateDatabaseRequest.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreateDatabaseRequest.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateDatabaseRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreateDatabaseRequest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { Parent.validateJsonElement(jsonObj.get("parent")); } // ensure the json data is an array if (!jsonObj.get("title").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `title` to be an array in the JSON string but got `%s`", jsonObj.get("title").toString())); } JsonArray jsonArraytitle = jsonObj.getAsJsonArray("title"); // validate the required field `title` (array) for (int i = 0; i < jsonArraytitle.size(); i++) { RichTextItem.validateJsonElement(jsonArraytitle.get(i)); }; // validate the optional field `icon` if (jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) { Icon.validateJsonElement(jsonObj.get("icon")); } // validate the optional field `cover` if (jsonObj.get("cover") != null && !jsonObj.get("cover").isJsonNull()) { Cover.validateJsonElement(jsonObj.get("cover")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreateDatabaseRequest.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreateDatabaseRequest' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreateDatabaseRequest> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreateDatabaseRequest.class)); return (TypeAdapter<T>) new TypeAdapter<CreateDatabaseRequest>() { @Override public void write(JsonWriter out, CreateDatabaseRequest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreateDatabaseRequest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreateDatabaseRequest given an JSON string * * @param jsonString JSON string * @return An instance of CreateDatabaseRequest * @throws IOException if the JSON string is invalid with respect to CreateDatabaseRequest */ public static CreateDatabaseRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreateDatabaseRequest.class); } /** * Convert an instance of CreateDatabaseRequest to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValue.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.math.BigDecimal; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.openapitools.client.model.CreatePagePropertyValueCheckbox; import org.openapitools.client.model.CreatePagePropertyValueDate; import org.openapitools.client.model.CreatePagePropertyValueDateDate; import org.openapitools.client.model.CreatePagePropertyValueEmail; import org.openapitools.client.model.CreatePagePropertyValueFiles; import org.openapitools.client.model.CreatePagePropertyValueFilesFilesInner; import org.openapitools.client.model.CreatePagePropertyValueMultiSelect; import org.openapitools.client.model.CreatePagePropertyValueNumber; import org.openapitools.client.model.CreatePagePropertyValuePeople; import org.openapitools.client.model.CreatePagePropertyValuePeoplePeopleInner; import org.openapitools.client.model.CreatePagePropertyValuePhoneNumber; import org.openapitools.client.model.CreatePagePropertyValueRelation; import org.openapitools.client.model.CreatePagePropertyValueRelationRelationInner; import org.openapitools.client.model.CreatePagePropertyValueRichText; import org.openapitools.client.model.CreatePagePropertyValueSelect; import org.openapitools.client.model.CreatePagePropertyValueSelectSelect; import org.openapitools.client.model.CreatePagePropertyValueTitle; import org.openapitools.client.model.CreatePagePropertyValueUrl; import org.openapitools.client.model.RichTextItem; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValue extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(CreatePagePropertyValue.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValue.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValue' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueTitle> adapterCreatePagePropertyValueTitle = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueTitle.class)); final TypeAdapter<CreatePagePropertyValueRichText> adapterCreatePagePropertyValueRichText = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueRichText.class)); final TypeAdapter<CreatePagePropertyValueSelect> adapterCreatePagePropertyValueSelect = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueSelect.class)); final TypeAdapter<CreatePagePropertyValueMultiSelect> adapterCreatePagePropertyValueMultiSelect = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueMultiSelect.class)); final TypeAdapter<CreatePagePropertyValueNumber> adapterCreatePagePropertyValueNumber = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueNumber.class)); final TypeAdapter<CreatePagePropertyValueCheckbox> adapterCreatePagePropertyValueCheckbox = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueCheckbox.class)); final TypeAdapter<CreatePagePropertyValueDate> adapterCreatePagePropertyValueDate = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueDate.class)); final TypeAdapter<CreatePagePropertyValuePeople> adapterCreatePagePropertyValuePeople = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValuePeople.class)); final TypeAdapter<CreatePagePropertyValueFiles> adapterCreatePagePropertyValueFiles = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueFiles.class)); final TypeAdapter<CreatePagePropertyValueUrl> adapterCreatePagePropertyValueUrl = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueUrl.class)); final TypeAdapter<CreatePagePropertyValueEmail> adapterCreatePagePropertyValueEmail = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueEmail.class)); final TypeAdapter<CreatePagePropertyValuePhoneNumber> adapterCreatePagePropertyValuePhoneNumber = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValuePhoneNumber.class)); final TypeAdapter<CreatePagePropertyValueRelation> adapterCreatePagePropertyValueRelation = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueRelation.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValue>() { @Override public void write(JsonWriter out, CreatePagePropertyValue value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `CreatePagePropertyValueTitle` if (value.getActualInstance() instanceof CreatePagePropertyValueTitle) { JsonElement element = adapterCreatePagePropertyValueTitle.toJsonTree((CreatePagePropertyValueTitle)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueRichText` if (value.getActualInstance() instanceof CreatePagePropertyValueRichText) { JsonElement element = adapterCreatePagePropertyValueRichText.toJsonTree((CreatePagePropertyValueRichText)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueSelect` if (value.getActualInstance() instanceof CreatePagePropertyValueSelect) { JsonElement element = adapterCreatePagePropertyValueSelect.toJsonTree((CreatePagePropertyValueSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueMultiSelect` if (value.getActualInstance() instanceof CreatePagePropertyValueMultiSelect) { JsonElement element = adapterCreatePagePropertyValueMultiSelect.toJsonTree((CreatePagePropertyValueMultiSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueNumber` if (value.getActualInstance() instanceof CreatePagePropertyValueNumber) { JsonElement element = adapterCreatePagePropertyValueNumber.toJsonTree((CreatePagePropertyValueNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueCheckbox` if (value.getActualInstance() instanceof CreatePagePropertyValueCheckbox) { JsonElement element = adapterCreatePagePropertyValueCheckbox.toJsonTree((CreatePagePropertyValueCheckbox)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueDate` if (value.getActualInstance() instanceof CreatePagePropertyValueDate) { JsonElement element = adapterCreatePagePropertyValueDate.toJsonTree((CreatePagePropertyValueDate)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValuePeople` if (value.getActualInstance() instanceof CreatePagePropertyValuePeople) { JsonElement element = adapterCreatePagePropertyValuePeople.toJsonTree((CreatePagePropertyValuePeople)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueFiles` if (value.getActualInstance() instanceof CreatePagePropertyValueFiles) { JsonElement element = adapterCreatePagePropertyValueFiles.toJsonTree((CreatePagePropertyValueFiles)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueUrl` if (value.getActualInstance() instanceof CreatePagePropertyValueUrl) { JsonElement element = adapterCreatePagePropertyValueUrl.toJsonTree((CreatePagePropertyValueUrl)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueEmail` if (value.getActualInstance() instanceof CreatePagePropertyValueEmail) { JsonElement element = adapterCreatePagePropertyValueEmail.toJsonTree((CreatePagePropertyValueEmail)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValuePhoneNumber` if (value.getActualInstance() instanceof CreatePagePropertyValuePhoneNumber) { JsonElement element = adapterCreatePagePropertyValuePhoneNumber.toJsonTree((CreatePagePropertyValuePhoneNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePagePropertyValueRelation` if (value.getActualInstance() instanceof CreatePagePropertyValueRelation) { JsonElement element = adapterCreatePagePropertyValueRelation.toJsonTree((CreatePagePropertyValueRelation)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl"); } @Override public CreatePagePropertyValue read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); int match = 0; ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize CreatePagePropertyValueTitle try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueTitle.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueTitle; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueTitle'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueTitle failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueTitle'", e); } // deserialize CreatePagePropertyValueRichText try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueRichText.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueRichText; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueRichText'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueRichText failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueRichText'", e); } // deserialize CreatePagePropertyValueSelect try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueSelect.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueSelect; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueSelect'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueSelect'", e); } // deserialize CreatePagePropertyValueMultiSelect try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueMultiSelect.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueMultiSelect; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueMultiSelect'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueMultiSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueMultiSelect'", e); } // deserialize CreatePagePropertyValueNumber try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueNumber.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueNumber; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueNumber'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueNumber'", e); } // deserialize CreatePagePropertyValueCheckbox try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueCheckbox.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueCheckbox; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueCheckbox'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueCheckbox failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueCheckbox'", e); } // deserialize CreatePagePropertyValueDate try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueDate.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueDate; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueDate'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueDate failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueDate'", e); } // deserialize CreatePagePropertyValuePeople try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValuePeople.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValuePeople; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValuePeople'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValuePeople failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValuePeople'", e); } // deserialize CreatePagePropertyValueFiles try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueFiles.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueFiles; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueFiles'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueFiles failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueFiles'", e); } // deserialize CreatePagePropertyValueUrl try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueUrl.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueUrl; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueUrl'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueUrl failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueUrl'", e); } // deserialize CreatePagePropertyValueEmail try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueEmail.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueEmail; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueEmail'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueEmail failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueEmail'", e); } // deserialize CreatePagePropertyValuePhoneNumber try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValuePhoneNumber.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValuePhoneNumber; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValuePhoneNumber'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValuePhoneNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValuePhoneNumber'", e); } // deserialize CreatePagePropertyValueRelation try { // validate the JSON object to see if any exception is thrown CreatePagePropertyValueRelation.validateJsonElement(jsonElement); actualAdapter = adapterCreatePagePropertyValueRelation; match++; log.log(Level.FINER, "Input data matches schema 'CreatePagePropertyValueRelation'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePagePropertyValueRelation failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePagePropertyValueRelation'", e); } if (match == 1) { CreatePagePropertyValue ret = new CreatePagePropertyValue(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } throw new IOException(String.format("Failed deserialization for CreatePagePropertyValue: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in oneOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public CreatePagePropertyValue() { super("oneOf", Boolean.FALSE); } public CreatePagePropertyValue(Object o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("CreatePagePropertyValueTitle", CreatePagePropertyValueTitle.class); schemas.put("CreatePagePropertyValueRichText", CreatePagePropertyValueRichText.class); schemas.put("CreatePagePropertyValueSelect", CreatePagePropertyValueSelect.class); schemas.put("CreatePagePropertyValueMultiSelect", CreatePagePropertyValueMultiSelect.class); schemas.put("CreatePagePropertyValueNumber", CreatePagePropertyValueNumber.class); schemas.put("CreatePagePropertyValueCheckbox", CreatePagePropertyValueCheckbox.class); schemas.put("CreatePagePropertyValueDate", CreatePagePropertyValueDate.class); schemas.put("CreatePagePropertyValuePeople", CreatePagePropertyValuePeople.class); schemas.put("CreatePagePropertyValueFiles", CreatePagePropertyValueFiles.class); schemas.put("CreatePagePropertyValueUrl", CreatePagePropertyValueUrl.class); schemas.put("CreatePagePropertyValueEmail", CreatePagePropertyValueEmail.class); schemas.put("CreatePagePropertyValuePhoneNumber", CreatePagePropertyValuePhoneNumber.class); schemas.put("CreatePagePropertyValueRelation", CreatePagePropertyValueRelation.class); } @Override public Map<String, Class<?>> getSchemas() { return CreatePagePropertyValue.schemas; } /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: * CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl * * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof CreatePagePropertyValueTitle) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueRichText) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueSelect) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueMultiSelect) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueNumber) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueCheckbox) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueDate) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValuePeople) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueFiles) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueUrl) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueEmail) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValuePhoneNumber) { super.setActualInstance(instance); return; } if (instance instanceof CreatePagePropertyValueRelation) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl"); } /** * Get the actual instance, which can be the following: * CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl * * @return The actual instance (CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueTitle`. If the actual instance is not `CreatePagePropertyValueTitle`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueTitle` * @throws ClassCastException if the instance is not `CreatePagePropertyValueTitle` */ public CreatePagePropertyValueTitle getCreatePagePropertyValueTitle() throws ClassCastException { return (CreatePagePropertyValueTitle)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueRichText`. If the actual instance is not `CreatePagePropertyValueRichText`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueRichText` * @throws ClassCastException if the instance is not `CreatePagePropertyValueRichText` */ public CreatePagePropertyValueRichText getCreatePagePropertyValueRichText() throws ClassCastException { return (CreatePagePropertyValueRichText)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueSelect`. If the actual instance is not `CreatePagePropertyValueSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueSelect` * @throws ClassCastException if the instance is not `CreatePagePropertyValueSelect` */ public CreatePagePropertyValueSelect getCreatePagePropertyValueSelect() throws ClassCastException { return (CreatePagePropertyValueSelect)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueMultiSelect`. If the actual instance is not `CreatePagePropertyValueMultiSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueMultiSelect` * @throws ClassCastException if the instance is not `CreatePagePropertyValueMultiSelect` */ public CreatePagePropertyValueMultiSelect getCreatePagePropertyValueMultiSelect() throws ClassCastException { return (CreatePagePropertyValueMultiSelect)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueNumber`. If the actual instance is not `CreatePagePropertyValueNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueNumber` * @throws ClassCastException if the instance is not `CreatePagePropertyValueNumber` */ public CreatePagePropertyValueNumber getCreatePagePropertyValueNumber() throws ClassCastException { return (CreatePagePropertyValueNumber)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueCheckbox`. If the actual instance is not `CreatePagePropertyValueCheckbox`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueCheckbox` * @throws ClassCastException if the instance is not `CreatePagePropertyValueCheckbox` */ public CreatePagePropertyValueCheckbox getCreatePagePropertyValueCheckbox() throws ClassCastException { return (CreatePagePropertyValueCheckbox)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueDate`. If the actual instance is not `CreatePagePropertyValueDate`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueDate` * @throws ClassCastException if the instance is not `CreatePagePropertyValueDate` */ public CreatePagePropertyValueDate getCreatePagePropertyValueDate() throws ClassCastException { return (CreatePagePropertyValueDate)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValuePeople`. If the actual instance is not `CreatePagePropertyValuePeople`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValuePeople` * @throws ClassCastException if the instance is not `CreatePagePropertyValuePeople` */ public CreatePagePropertyValuePeople getCreatePagePropertyValuePeople() throws ClassCastException { return (CreatePagePropertyValuePeople)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueFiles`. If the actual instance is not `CreatePagePropertyValueFiles`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueFiles` * @throws ClassCastException if the instance is not `CreatePagePropertyValueFiles` */ public CreatePagePropertyValueFiles getCreatePagePropertyValueFiles() throws ClassCastException { return (CreatePagePropertyValueFiles)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueUrl`. If the actual instance is not `CreatePagePropertyValueUrl`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueUrl` * @throws ClassCastException if the instance is not `CreatePagePropertyValueUrl` */ public CreatePagePropertyValueUrl getCreatePagePropertyValueUrl() throws ClassCastException { return (CreatePagePropertyValueUrl)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueEmail`. If the actual instance is not `CreatePagePropertyValueEmail`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueEmail` * @throws ClassCastException if the instance is not `CreatePagePropertyValueEmail` */ public CreatePagePropertyValueEmail getCreatePagePropertyValueEmail() throws ClassCastException { return (CreatePagePropertyValueEmail)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValuePhoneNumber`. If the actual instance is not `CreatePagePropertyValuePhoneNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValuePhoneNumber` * @throws ClassCastException if the instance is not `CreatePagePropertyValuePhoneNumber` */ public CreatePagePropertyValuePhoneNumber getCreatePagePropertyValuePhoneNumber() throws ClassCastException { return (CreatePagePropertyValuePhoneNumber)super.getActualInstance(); } /** * Get the actual instance of `CreatePagePropertyValueRelation`. If the actual instance is not `CreatePagePropertyValueRelation`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePagePropertyValueRelation` * @throws ClassCastException if the instance is not `CreatePagePropertyValueRelation` */ public CreatePagePropertyValueRelation getCreatePagePropertyValueRelation() throws ClassCastException { return (CreatePagePropertyValueRelation)super.getActualInstance(); } /** * 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 CreatePagePropertyValue */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate oneOf schemas one by one int validCount = 0; ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with CreatePagePropertyValueTitle try { CreatePagePropertyValueTitle.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueTitle failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueRichText try { CreatePagePropertyValueRichText.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueRichText failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueSelect try { CreatePagePropertyValueSelect.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueMultiSelect try { CreatePagePropertyValueMultiSelect.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueMultiSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueNumber try { CreatePagePropertyValueNumber.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueCheckbox try { CreatePagePropertyValueCheckbox.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueCheckbox failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueDate try { CreatePagePropertyValueDate.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueDate failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValuePeople try { CreatePagePropertyValuePeople.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValuePeople failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueFiles try { CreatePagePropertyValueFiles.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueFiles failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueUrl try { CreatePagePropertyValueUrl.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueUrl failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueEmail try { CreatePagePropertyValueEmail.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueEmail failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValuePhoneNumber try { CreatePagePropertyValuePhoneNumber.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValuePhoneNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePagePropertyValueRelation try { CreatePagePropertyValueRelation.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePagePropertyValueRelation failed with `%s`.", e.getMessage())); // continue to the next one } if (validCount != 1) { throw new IOException(String.format("The JSON string is invalid for CreatePagePropertyValue with oneOf schemas: CreatePagePropertyValueCheckbox, CreatePagePropertyValueDate, CreatePagePropertyValueEmail, CreatePagePropertyValueFiles, CreatePagePropertyValueMultiSelect, CreatePagePropertyValueNumber, CreatePagePropertyValuePeople, CreatePagePropertyValuePhoneNumber, CreatePagePropertyValueRelation, CreatePagePropertyValueRichText, CreatePagePropertyValueSelect, CreatePagePropertyValueTitle, CreatePagePropertyValueUrl. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } /** * Create an instance of CreatePagePropertyValue given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValue * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValue */ public static CreatePagePropertyValue fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValue.class); } /** * Convert an instance of CreatePagePropertyValue to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueCheckbox.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueCheckbox */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueCheckbox { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_CHECKBOX = "checkbox"; @SerializedName(SERIALIZED_NAME_CHECKBOX) @javax.annotation.Nonnull private Boolean checkbox; public CreatePagePropertyValueCheckbox() { } public CreatePagePropertyValueCheckbox type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueCheckbox checkbox(@javax.annotation.Nonnull Boolean checkbox) { this.checkbox = checkbox; return this; } /** * Get checkbox * @return checkbox */ @javax.annotation.Nonnull public Boolean getCheckbox() { return checkbox; } public void setCheckbox(@javax.annotation.Nonnull Boolean checkbox) { this.checkbox = checkbox; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueCheckbox createPagePropertyValueCheckbox = (CreatePagePropertyValueCheckbox) o; return Objects.equals(this.type, createPagePropertyValueCheckbox.type) && Objects.equals(this.checkbox, createPagePropertyValueCheckbox.checkbox); } @Override public int hashCode() { return Objects.hash(type, checkbox); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueCheckbox {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" checkbox: ").append(toIndentedString(checkbox)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "checkbox")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "checkbox")); } /** * 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 CreatePagePropertyValueCheckbox */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueCheckbox.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueCheckbox is not found in the empty JSON string", CreatePagePropertyValueCheckbox.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueCheckbox.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueCheckbox` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueCheckbox.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueCheckbox.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueCheckbox' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueCheckbox> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueCheckbox.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueCheckbox>() { @Override public void write(JsonWriter out, CreatePagePropertyValueCheckbox value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueCheckbox read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueCheckbox given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueCheckbox * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueCheckbox */ public static CreatePagePropertyValueCheckbox fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueCheckbox.class); } /** * Convert an instance of CreatePagePropertyValueCheckbox to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueDate.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.CreatePagePropertyValueDateDate; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueDate */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueDate { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) @javax.annotation.Nonnull private CreatePagePropertyValueDateDate date; public CreatePagePropertyValueDate() { } public CreatePagePropertyValueDate id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * 属性ID(可选) * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public CreatePagePropertyValueDate type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueDate date(@javax.annotation.Nonnull CreatePagePropertyValueDateDate date) { this.date = date; return this; } /** * Get date * @return date */ @javax.annotation.Nonnull public CreatePagePropertyValueDateDate getDate() { return date; } public void setDate(@javax.annotation.Nonnull CreatePagePropertyValueDateDate date) { this.date = date; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueDate createPagePropertyValueDate = (CreatePagePropertyValueDate) o; return Objects.equals(this.id, createPagePropertyValueDate.id) && Objects.equals(this.type, createPagePropertyValueDate.type) && Objects.equals(this.date, createPagePropertyValueDate.date); } @Override public int hashCode() { return Objects.hash(id, type, date); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueDate {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "date")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "date")); } /** * 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 CreatePagePropertyValueDate */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueDate is not found in the empty JSON string", CreatePagePropertyValueDate.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueDate.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueDate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueDate.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the required field `date` CreatePagePropertyValueDateDate.validateJsonElement(jsonObj.get("date")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueDate.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueDate' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueDate> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueDate.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueDate>() { @Override public void write(JsonWriter out, CreatePagePropertyValueDate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueDate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueDate given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueDate * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueDate */ public static CreatePagePropertyValueDate fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueDate.class); } /** * Convert an instance of CreatePagePropertyValueDate to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueDateDate.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueDateDate */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueDateDate { public static final String SERIALIZED_NAME_START = "start"; @SerializedName(SERIALIZED_NAME_START) @javax.annotation.Nonnull private String start; public static final String SERIALIZED_NAME_END = "end"; @SerializedName(SERIALIZED_NAME_END) @javax.annotation.Nullable private String end; public static final String SERIALIZED_NAME_TIME_ZONE = "time_zone"; @SerializedName(SERIALIZED_NAME_TIME_ZONE) @javax.annotation.Nullable private String timeZone; public CreatePagePropertyValueDateDate() { } public CreatePagePropertyValueDateDate start(@javax.annotation.Nonnull String start) { this.start = start; return this; } /** * 开始日期(YYYY-MM-DD 或 YYYY-MM-DDTHH:MM格式) * @return start */ @javax.annotation.Nonnull public String getStart() { return start; } public void setStart(@javax.annotation.Nonnull String start) { this.start = start; } public CreatePagePropertyValueDateDate end(@javax.annotation.Nullable String end) { this.end = end; return this; } /** * 结束日期(可选) * @return end */ @javax.annotation.Nullable public String getEnd() { return end; } public void setEnd(@javax.annotation.Nullable String end) { this.end = end; } public CreatePagePropertyValueDateDate timeZone(@javax.annotation.Nullable String timeZone) { this.timeZone = timeZone; return this; } /** * 时区 * @return timeZone */ @javax.annotation.Nullable public String getTimeZone() { return timeZone; } public void setTimeZone(@javax.annotation.Nullable String timeZone) { this.timeZone = timeZone; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueDateDate createPagePropertyValueDateDate = (CreatePagePropertyValueDateDate) o; return Objects.equals(this.start, createPagePropertyValueDateDate.start) && Objects.equals(this.end, createPagePropertyValueDateDate.end) && Objects.equals(this.timeZone, createPagePropertyValueDateDate.timeZone); } @Override public int hashCode() { return Objects.hash(start, end, timeZone); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueDateDate {\n"); sb.append(" start: ").append(toIndentedString(start)).append("\n"); sb.append(" end: ").append(toIndentedString(end)).append("\n"); sb.append(" timeZone: ").append(toIndentedString(timeZone)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("start", "end", "time_zone")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("start")); } /** * 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 CreatePagePropertyValueDateDate */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueDateDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueDateDate is not found in the empty JSON string", CreatePagePropertyValueDateDate.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueDateDate.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueDateDate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueDateDate.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("start").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `start` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start").toString())); } if ((jsonObj.get("end") != null && !jsonObj.get("end").isJsonNull()) && !jsonObj.get("end").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `end` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end").toString())); } if ((jsonObj.get("time_zone") != null && !jsonObj.get("time_zone").isJsonNull()) && !jsonObj.get("time_zone").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `time_zone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_zone").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueDateDate.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueDateDate' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueDateDate> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueDateDate.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueDateDate>() { @Override public void write(JsonWriter out, CreatePagePropertyValueDateDate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueDateDate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueDateDate given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueDateDate * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueDateDate */ public static CreatePagePropertyValueDateDate fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueDateDate.class); } /** * Convert an instance of CreatePagePropertyValueDateDate to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueEmail.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueEmail */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueEmail { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @javax.annotation.Nonnull private String email; public CreatePagePropertyValueEmail() { } public CreatePagePropertyValueEmail type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueEmail email(@javax.annotation.Nonnull String email) { this.email = email; return this; } /** * Get email * @return email */ @javax.annotation.Nonnull public String getEmail() { return email; } public void setEmail(@javax.annotation.Nonnull String email) { this.email = email; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueEmail createPagePropertyValueEmail = (CreatePagePropertyValueEmail) o; return Objects.equals(this.type, createPagePropertyValueEmail.type) && Objects.equals(this.email, createPagePropertyValueEmail.email); } @Override public int hashCode() { return Objects.hash(type, email); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueEmail {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "email")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "email")); } /** * 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 CreatePagePropertyValueEmail */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueEmail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueEmail is not found in the empty JSON string", CreatePagePropertyValueEmail.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueEmail.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueEmail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueEmail.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("email").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueEmail.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueEmail' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueEmail> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueEmail.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueEmail>() { @Override public void write(JsonWriter out, CreatePagePropertyValueEmail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueEmail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueEmail given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueEmail * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueEmail */ public static CreatePagePropertyValueEmail fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueEmail.class); } /** * Convert an instance of CreatePagePropertyValueEmail to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueFiles.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.CreatePagePropertyValueFilesFilesInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueFiles */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueFiles { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_FILES = "files"; @SerializedName(SERIALIZED_NAME_FILES) @javax.annotation.Nonnull private List<CreatePagePropertyValueFilesFilesInner> files = new ArrayList<>(); public CreatePagePropertyValueFiles() { } public CreatePagePropertyValueFiles type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueFiles files(@javax.annotation.Nonnull List<CreatePagePropertyValueFilesFilesInner> files) { this.files = files; return this; } public CreatePagePropertyValueFiles addFilesItem(CreatePagePropertyValueFilesFilesInner filesItem) { if (this.files == null) { this.files = new ArrayList<>(); } this.files.add(filesItem); return this; } /** * Get files * @return files */ @javax.annotation.Nonnull public List<CreatePagePropertyValueFilesFilesInner> getFiles() { return files; } public void setFiles(@javax.annotation.Nonnull List<CreatePagePropertyValueFilesFilesInner> files) { this.files = files; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueFiles createPagePropertyValueFiles = (CreatePagePropertyValueFiles) o; return Objects.equals(this.type, createPagePropertyValueFiles.type) && Objects.equals(this.files, createPagePropertyValueFiles.files); } @Override public int hashCode() { return Objects.hash(type, files); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueFiles {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" files: ").append(toIndentedString(files)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "files")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "files")); } /** * 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 CreatePagePropertyValueFiles */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueFiles.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueFiles is not found in the empty JSON string", CreatePagePropertyValueFiles.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueFiles.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueFiles` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueFiles.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("files").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); } JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); // validate the required field `files` (array) for (int i = 0; i < jsonArrayfiles.size(); i++) { CreatePagePropertyValueFilesFilesInner.validateJsonElement(jsonArrayfiles.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueFiles.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueFiles' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueFiles> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueFiles.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueFiles>() { @Override public void write(JsonWriter out, CreatePagePropertyValueFiles value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueFiles read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueFiles given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueFiles * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueFiles */ public static CreatePagePropertyValueFiles fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueFiles.class); } /** * Convert an instance of CreatePagePropertyValueFiles to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueFilesFilesInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.CreatePagePropertyValueFilesFilesInnerExternal; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueFilesFilesInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueFilesFilesInner { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { EXTERNAL("external"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private TypeEnum type; public static final String SERIALIZED_NAME_EXTERNAL = "external"; @SerializedName(SERIALIZED_NAME_EXTERNAL) @javax.annotation.Nullable private CreatePagePropertyValueFilesFilesInnerExternal external; public CreatePagePropertyValueFilesFilesInner() { } public CreatePagePropertyValueFilesFilesInner name(@javax.annotation.Nonnull String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nonnull public String getName() { return name; } public void setName(@javax.annotation.Nonnull String name) { this.name = name; } public CreatePagePropertyValueFilesFilesInner type(@javax.annotation.Nullable TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nullable TypeEnum type) { this.type = type; } public CreatePagePropertyValueFilesFilesInner external(@javax.annotation.Nullable CreatePagePropertyValueFilesFilesInnerExternal external) { this.external = external; return this; } /** * Get external * @return external */ @javax.annotation.Nullable public CreatePagePropertyValueFilesFilesInnerExternal getExternal() { return external; } public void setExternal(@javax.annotation.Nullable CreatePagePropertyValueFilesFilesInnerExternal external) { this.external = external; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueFilesFilesInner createPagePropertyValueFilesFilesInner = (CreatePagePropertyValueFilesFilesInner) o; return Objects.equals(this.name, createPagePropertyValueFilesFilesInner.name) && Objects.equals(this.type, createPagePropertyValueFilesFilesInner.type) && Objects.equals(this.external, createPagePropertyValueFilesFilesInner.external); } @Override public int hashCode() { return Objects.hash(name, type, external); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueFilesFilesInner {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" external: ").append(toIndentedString(external)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("name", "type", "external")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("name")); } /** * 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 CreatePagePropertyValueFilesFilesInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueFilesFilesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueFilesFilesInner is not found in the empty JSON string", CreatePagePropertyValueFilesFilesInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueFilesFilesInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueFilesFilesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueFilesFilesInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the optional field `type` if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { TypeEnum.validateJsonElement(jsonObj.get("type")); } // validate the optional field `external` if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { CreatePagePropertyValueFilesFilesInnerExternal.validateJsonElement(jsonObj.get("external")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueFilesFilesInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueFilesFilesInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueFilesFilesInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueFilesFilesInner.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueFilesFilesInner>() { @Override public void write(JsonWriter out, CreatePagePropertyValueFilesFilesInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueFilesFilesInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueFilesFilesInner given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueFilesFilesInner * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueFilesFilesInner */ public static CreatePagePropertyValueFilesFilesInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueFilesFilesInner.class); } /** * Convert an instance of CreatePagePropertyValueFilesFilesInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueFilesFilesInnerExternal.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.net.URI; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueFilesFilesInnerExternal */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueFilesFilesInnerExternal { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nonnull private URI url; public CreatePagePropertyValueFilesFilesInnerExternal() { } public CreatePagePropertyValueFilesFilesInnerExternal url(@javax.annotation.Nonnull URI url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nonnull public URI getUrl() { return url; } public void setUrl(@javax.annotation.Nonnull URI url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueFilesFilesInnerExternal createPagePropertyValueFilesFilesInnerExternal = (CreatePagePropertyValueFilesFilesInnerExternal) o; return Objects.equals(this.url, createPagePropertyValueFilesFilesInnerExternal.url); } @Override public int hashCode() { return Objects.hash(url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueFilesFilesInnerExternal {\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("url")); } /** * 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 CreatePagePropertyValueFilesFilesInnerExternal */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueFilesFilesInnerExternal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueFilesFilesInnerExternal is not found in the empty JSON string", CreatePagePropertyValueFilesFilesInnerExternal.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueFilesFilesInnerExternal.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueFilesFilesInnerExternal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueFilesFilesInnerExternal.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueFilesFilesInnerExternal.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueFilesFilesInnerExternal' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueFilesFilesInnerExternal> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueFilesFilesInnerExternal.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueFilesFilesInnerExternal>() { @Override public void write(JsonWriter out, CreatePagePropertyValueFilesFilesInnerExternal value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueFilesFilesInnerExternal read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueFilesFilesInnerExternal given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueFilesFilesInnerExternal * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueFilesFilesInnerExternal */ public static CreatePagePropertyValueFilesFilesInnerExternal fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueFilesFilesInnerExternal.class); } /** * Convert an instance of CreatePagePropertyValueFilesFilesInnerExternal to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueMultiSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.CreatePagePropertyValueSelectSelect; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueMultiSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueMultiSelect { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_MULTI_SELECT = "multi_select"; @SerializedName(SERIALIZED_NAME_MULTI_SELECT) @javax.annotation.Nonnull private List<CreatePagePropertyValueSelectSelect> multiSelect = new ArrayList<>(); public CreatePagePropertyValueMultiSelect() { } public CreatePagePropertyValueMultiSelect type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueMultiSelect multiSelect(@javax.annotation.Nonnull List<CreatePagePropertyValueSelectSelect> multiSelect) { this.multiSelect = multiSelect; return this; } public CreatePagePropertyValueMultiSelect addMultiSelectItem(CreatePagePropertyValueSelectSelect multiSelectItem) { if (this.multiSelect == null) { this.multiSelect = new ArrayList<>(); } this.multiSelect.add(multiSelectItem); return this; } /** * Get multiSelect * @return multiSelect */ @javax.annotation.Nonnull public List<CreatePagePropertyValueSelectSelect> getMultiSelect() { return multiSelect; } public void setMultiSelect(@javax.annotation.Nonnull List<CreatePagePropertyValueSelectSelect> multiSelect) { this.multiSelect = multiSelect; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueMultiSelect createPagePropertyValueMultiSelect = (CreatePagePropertyValueMultiSelect) o; return Objects.equals(this.type, createPagePropertyValueMultiSelect.type) && Objects.equals(this.multiSelect, createPagePropertyValueMultiSelect.multiSelect); } @Override public int hashCode() { return Objects.hash(type, multiSelect); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueMultiSelect {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" multiSelect: ").append(toIndentedString(multiSelect)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "multi_select")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "multi_select")); } /** * 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 CreatePagePropertyValueMultiSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueMultiSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueMultiSelect is not found in the empty JSON string", CreatePagePropertyValueMultiSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueMultiSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueMultiSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueMultiSelect.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("multi_select").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `multi_select` to be an array in the JSON string but got `%s`", jsonObj.get("multi_select").toString())); } JsonArray jsonArraymultiSelect = jsonObj.getAsJsonArray("multi_select"); // validate the required field `multi_select` (array) for (int i = 0; i < jsonArraymultiSelect.size(); i++) { CreatePagePropertyValueSelectSelect.validateJsonElement(jsonArraymultiSelect.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueMultiSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueMultiSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueMultiSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueMultiSelect.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueMultiSelect>() { @Override public void write(JsonWriter out, CreatePagePropertyValueMultiSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueMultiSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueMultiSelect given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueMultiSelect * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueMultiSelect */ public static CreatePagePropertyValueMultiSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueMultiSelect.class); } /** * Convert an instance of CreatePagePropertyValueMultiSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.math.BigDecimal; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueNumber { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) @javax.annotation.Nonnull private BigDecimal number; public CreatePagePropertyValueNumber() { } public CreatePagePropertyValueNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueNumber number(@javax.annotation.Nonnull BigDecimal number) { this.number = number; return this; } /** * Get number * @return number */ @javax.annotation.Nonnull public BigDecimal getNumber() { return number; } public void setNumber(@javax.annotation.Nonnull BigDecimal number) { this.number = number; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueNumber createPagePropertyValueNumber = (CreatePagePropertyValueNumber) o; return Objects.equals(this.type, createPagePropertyValueNumber.type) && Objects.equals(this.number, createPagePropertyValueNumber.number); } @Override public int hashCode() { return Objects.hash(type, number); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueNumber {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" number: ").append(toIndentedString(number)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "number")); } /** * 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 CreatePagePropertyValueNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueNumber is not found in the empty JSON string", CreatePagePropertyValueNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueNumber.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueNumber.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueNumber>() { @Override public void write(JsonWriter out, CreatePagePropertyValueNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueNumber given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueNumber * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueNumber */ public static CreatePagePropertyValueNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueNumber.class); } /** * Convert an instance of CreatePagePropertyValueNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValuePeople.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.CreatePagePropertyValuePeoplePeopleInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValuePeople */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValuePeople { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PEOPLE = "people"; @SerializedName(SERIALIZED_NAME_PEOPLE) @javax.annotation.Nonnull private List<CreatePagePropertyValuePeoplePeopleInner> people = new ArrayList<>(); public CreatePagePropertyValuePeople() { } public CreatePagePropertyValuePeople type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValuePeople people(@javax.annotation.Nonnull List<CreatePagePropertyValuePeoplePeopleInner> people) { this.people = people; return this; } public CreatePagePropertyValuePeople addPeopleItem(CreatePagePropertyValuePeoplePeopleInner peopleItem) { if (this.people == null) { this.people = new ArrayList<>(); } this.people.add(peopleItem); return this; } /** * Get people * @return people */ @javax.annotation.Nonnull public List<CreatePagePropertyValuePeoplePeopleInner> getPeople() { return people; } public void setPeople(@javax.annotation.Nonnull List<CreatePagePropertyValuePeoplePeopleInner> people) { this.people = people; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValuePeople createPagePropertyValuePeople = (CreatePagePropertyValuePeople) o; return Objects.equals(this.type, createPagePropertyValuePeople.type) && Objects.equals(this.people, createPagePropertyValuePeople.people); } @Override public int hashCode() { return Objects.hash(type, people); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValuePeople {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" people: ").append(toIndentedString(people)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "people")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "people")); } /** * 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 CreatePagePropertyValuePeople */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValuePeople.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValuePeople is not found in the empty JSON string", CreatePagePropertyValuePeople.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValuePeople.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValuePeople` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValuePeople.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("people").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `people` to be an array in the JSON string but got `%s`", jsonObj.get("people").toString())); } JsonArray jsonArraypeople = jsonObj.getAsJsonArray("people"); // validate the required field `people` (array) for (int i = 0; i < jsonArraypeople.size(); i++) { CreatePagePropertyValuePeoplePeopleInner.validateJsonElement(jsonArraypeople.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValuePeople.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValuePeople' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValuePeople> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValuePeople.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValuePeople>() { @Override public void write(JsonWriter out, CreatePagePropertyValuePeople value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValuePeople read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValuePeople given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValuePeople * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValuePeople */ public static CreatePagePropertyValuePeople fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValuePeople.class); } /** * Convert an instance of CreatePagePropertyValuePeople to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValuePeoplePeopleInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValuePeoplePeopleInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValuePeoplePeopleInner { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { USER("user"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nonnull private UUID id; public CreatePagePropertyValuePeoplePeopleInner() { } public CreatePagePropertyValuePeoplePeopleInner _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public CreatePagePropertyValuePeoplePeopleInner id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nonnull public UUID getId() { return id; } public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValuePeoplePeopleInner createPagePropertyValuePeoplePeopleInner = (CreatePagePropertyValuePeoplePeopleInner) o; return Objects.equals(this._object, createPagePropertyValuePeoplePeopleInner._object) && Objects.equals(this.id, createPagePropertyValuePeoplePeopleInner.id); } @Override public int hashCode() { return Objects.hash(_object, id); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValuePeoplePeopleInner {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("id")); } /** * 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 CreatePagePropertyValuePeoplePeopleInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValuePeoplePeopleInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValuePeoplePeopleInner is not found in the empty JSON string", CreatePagePropertyValuePeoplePeopleInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValuePeoplePeopleInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValuePeoplePeopleInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValuePeoplePeopleInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if (!jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValuePeoplePeopleInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValuePeoplePeopleInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValuePeoplePeopleInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValuePeoplePeopleInner.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValuePeoplePeopleInner>() { @Override public void write(JsonWriter out, CreatePagePropertyValuePeoplePeopleInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValuePeoplePeopleInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValuePeoplePeopleInner given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValuePeoplePeopleInner * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValuePeoplePeopleInner */ public static CreatePagePropertyValuePeoplePeopleInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValuePeoplePeopleInner.class); } /** * Convert an instance of CreatePagePropertyValuePeoplePeopleInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValuePhoneNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValuePhoneNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValuePhoneNumber { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PHONE_NUMBER = "phone_number"; @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) @javax.annotation.Nonnull private String phoneNumber; public CreatePagePropertyValuePhoneNumber() { } public CreatePagePropertyValuePhoneNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValuePhoneNumber phoneNumber(@javax.annotation.Nonnull String phoneNumber) { this.phoneNumber = phoneNumber; return this; } /** * Get phoneNumber * @return phoneNumber */ @javax.annotation.Nonnull public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(@javax.annotation.Nonnull String phoneNumber) { this.phoneNumber = phoneNumber; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValuePhoneNumber createPagePropertyValuePhoneNumber = (CreatePagePropertyValuePhoneNumber) o; return Objects.equals(this.type, createPagePropertyValuePhoneNumber.type) && Objects.equals(this.phoneNumber, createPagePropertyValuePhoneNumber.phoneNumber); } @Override public int hashCode() { return Objects.hash(type, phoneNumber); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValuePhoneNumber {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "phone_number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "phone_number")); } /** * 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 CreatePagePropertyValuePhoneNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValuePhoneNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValuePhoneNumber is not found in the empty JSON string", CreatePagePropertyValuePhoneNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValuePhoneNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValuePhoneNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValuePhoneNumber.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("phone_number").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `phone_number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone_number").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValuePhoneNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValuePhoneNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValuePhoneNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValuePhoneNumber.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValuePhoneNumber>() { @Override public void write(JsonWriter out, CreatePagePropertyValuePhoneNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValuePhoneNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValuePhoneNumber given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValuePhoneNumber * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValuePhoneNumber */ public static CreatePagePropertyValuePhoneNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValuePhoneNumber.class); } /** * Convert an instance of CreatePagePropertyValuePhoneNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueRelation.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.CreatePagePropertyValueRelationRelationInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueRelation */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueRelation { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RELATION = "relation"; @SerializedName(SERIALIZED_NAME_RELATION) @javax.annotation.Nonnull private List<CreatePagePropertyValueRelationRelationInner> relation = new ArrayList<>(); public CreatePagePropertyValueRelation() { } public CreatePagePropertyValueRelation type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueRelation relation(@javax.annotation.Nonnull List<CreatePagePropertyValueRelationRelationInner> relation) { this.relation = relation; return this; } public CreatePagePropertyValueRelation addRelationItem(CreatePagePropertyValueRelationRelationInner relationItem) { if (this.relation == null) { this.relation = new ArrayList<>(); } this.relation.add(relationItem); return this; } /** * Get relation * @return relation */ @javax.annotation.Nonnull public List<CreatePagePropertyValueRelationRelationInner> getRelation() { return relation; } public void setRelation(@javax.annotation.Nonnull List<CreatePagePropertyValueRelationRelationInner> relation) { this.relation = relation; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueRelation createPagePropertyValueRelation = (CreatePagePropertyValueRelation) o; return Objects.equals(this.type, createPagePropertyValueRelation.type) && Objects.equals(this.relation, createPagePropertyValueRelation.relation); } @Override public int hashCode() { return Objects.hash(type, relation); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueRelation {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" relation: ").append(toIndentedString(relation)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "relation")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "relation")); } /** * 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 CreatePagePropertyValueRelation */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueRelation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueRelation is not found in the empty JSON string", CreatePagePropertyValueRelation.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueRelation.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueRelation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueRelation.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("relation").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `relation` to be an array in the JSON string but got `%s`", jsonObj.get("relation").toString())); } JsonArray jsonArrayrelation = jsonObj.getAsJsonArray("relation"); // validate the required field `relation` (array) for (int i = 0; i < jsonArrayrelation.size(); i++) { CreatePagePropertyValueRelationRelationInner.validateJsonElement(jsonArrayrelation.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueRelation.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueRelation' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueRelation> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueRelation.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueRelation>() { @Override public void write(JsonWriter out, CreatePagePropertyValueRelation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueRelation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueRelation given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueRelation * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueRelation */ public static CreatePagePropertyValueRelation fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueRelation.class); } /** * Convert an instance of CreatePagePropertyValueRelation to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueRelationRelationInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueRelationRelationInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueRelationRelationInner { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nonnull private UUID id; public CreatePagePropertyValueRelationRelationInner() { } public CreatePagePropertyValueRelationRelationInner id(@javax.annotation.Nonnull UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nonnull public UUID getId() { return id; } public void setId(@javax.annotation.Nonnull UUID id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueRelationRelationInner createPagePropertyValueRelationRelationInner = (CreatePagePropertyValueRelationRelationInner) o; return Objects.equals(this.id, createPagePropertyValueRelationRelationInner.id); } @Override public int hashCode() { return Objects.hash(id); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueRelationRelationInner {\n"); sb.append(" id: ").append(toIndentedString(id)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("id")); } /** * 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 CreatePagePropertyValueRelationRelationInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueRelationRelationInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueRelationRelationInner is not found in the empty JSON string", CreatePagePropertyValueRelationRelationInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueRelationRelationInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueRelationRelationInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueRelationRelationInner.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueRelationRelationInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueRelationRelationInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueRelationRelationInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueRelationRelationInner.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueRelationRelationInner>() { @Override public void write(JsonWriter out, CreatePagePropertyValueRelationRelationInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueRelationRelationInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueRelationRelationInner given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueRelationRelationInner * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueRelationRelationInner */ public static CreatePagePropertyValueRelationRelationInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueRelationRelationInner.class); } /** * Convert an instance of CreatePagePropertyValueRelationRelationInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueRichText.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.RichTextItem; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueRichText */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueRichText { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RICH_TEXT = "rich_text"; @SerializedName(SERIALIZED_NAME_RICH_TEXT) @javax.annotation.Nonnull private List<RichTextItem> richText = new ArrayList<>(); public CreatePagePropertyValueRichText() { } public CreatePagePropertyValueRichText type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueRichText richText(@javax.annotation.Nonnull List<RichTextItem> richText) { this.richText = richText; return this; } public CreatePagePropertyValueRichText addRichTextItem(RichTextItem richTextItem) { if (this.richText == null) { this.richText = new ArrayList<>(); } this.richText.add(richTextItem); return this; } /** * Get richText * @return richText */ @javax.annotation.Nonnull public List<RichTextItem> getRichText() { return richText; } public void setRichText(@javax.annotation.Nonnull List<RichTextItem> richText) { this.richText = richText; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueRichText createPagePropertyValueRichText = (CreatePagePropertyValueRichText) o; return Objects.equals(this.type, createPagePropertyValueRichText.type) && Objects.equals(this.richText, createPagePropertyValueRichText.richText); } @Override public int hashCode() { return Objects.hash(type, richText); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueRichText {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" richText: ").append(toIndentedString(richText)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "rich_text")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "rich_text")); } /** * 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 CreatePagePropertyValueRichText */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueRichText.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueRichText is not found in the empty JSON string", CreatePagePropertyValueRichText.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueRichText.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueRichText` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueRichText.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("rich_text").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `rich_text` to be an array in the JSON string but got `%s`", jsonObj.get("rich_text").toString())); } JsonArray jsonArrayrichText = jsonObj.getAsJsonArray("rich_text"); // validate the required field `rich_text` (array) for (int i = 0; i < jsonArrayrichText.size(); i++) { RichTextItem.validateJsonElement(jsonArrayrichText.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueRichText.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueRichText' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueRichText> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueRichText.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueRichText>() { @Override public void write(JsonWriter out, CreatePagePropertyValueRichText value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueRichText read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueRichText given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueRichText * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueRichText */ public static CreatePagePropertyValueRichText fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueRichText.class); } /** * Convert an instance of CreatePagePropertyValueRichText to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.CreatePagePropertyValueSelectSelect; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueSelect { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_SELECT = "select"; @SerializedName(SERIALIZED_NAME_SELECT) @javax.annotation.Nonnull private CreatePagePropertyValueSelectSelect select; public CreatePagePropertyValueSelect() { } public CreatePagePropertyValueSelect type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueSelect select(@javax.annotation.Nonnull CreatePagePropertyValueSelectSelect select) { this.select = select; return this; } /** * Get select * @return select */ @javax.annotation.Nonnull public CreatePagePropertyValueSelectSelect getSelect() { return select; } public void setSelect(@javax.annotation.Nonnull CreatePagePropertyValueSelectSelect select) { this.select = select; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueSelect createPagePropertyValueSelect = (CreatePagePropertyValueSelect) o; return Objects.equals(this.type, createPagePropertyValueSelect.type) && Objects.equals(this.select, createPagePropertyValueSelect.select); } @Override public int hashCode() { return Objects.hash(type, select); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueSelect {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" select: ").append(toIndentedString(select)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "select")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "select")); } /** * 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 CreatePagePropertyValueSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueSelect is not found in the empty JSON string", CreatePagePropertyValueSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueSelect.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the required field `select` CreatePagePropertyValueSelectSelect.validateJsonElement(jsonObj.get("select")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueSelect.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueSelect>() { @Override public void write(JsonWriter out, CreatePagePropertyValueSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueSelect given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueSelect * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueSelect */ public static CreatePagePropertyValueSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueSelect.class); } /** * Convert an instance of CreatePagePropertyValueSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueSelectSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueSelectSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueSelectSelect { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nonnull private String name; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) @javax.annotation.Nullable private String color; public CreatePagePropertyValueSelectSelect() { } public CreatePagePropertyValueSelectSelect id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public CreatePagePropertyValueSelectSelect name(@javax.annotation.Nonnull String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nonnull public String getName() { return name; } public void setName(@javax.annotation.Nonnull String name) { this.name = name; } public CreatePagePropertyValueSelectSelect color(@javax.annotation.Nullable String color) { this.color = color; return this; } /** * Get color * @return color */ @javax.annotation.Nullable public String getColor() { return color; } public void setColor(@javax.annotation.Nullable String color) { this.color = color; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueSelectSelect createPagePropertyValueSelectSelect = (CreatePagePropertyValueSelectSelect) o; return Objects.equals(this.id, createPagePropertyValueSelectSelect.id) && Objects.equals(this.name, createPagePropertyValueSelectSelect.name) && Objects.equals(this.color, createPagePropertyValueSelectSelect.color); } @Override public int hashCode() { return Objects.hash(id, name, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueSelectSelect {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "color")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("name")); } /** * 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 CreatePagePropertyValueSelectSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueSelectSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueSelectSelect is not found in the empty JSON string", CreatePagePropertyValueSelectSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueSelectSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueSelectSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueSelectSelect.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if (!jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueSelectSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueSelectSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueSelectSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueSelectSelect.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueSelectSelect>() { @Override public void write(JsonWriter out, CreatePagePropertyValueSelectSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueSelectSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueSelectSelect given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueSelectSelect * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueSelectSelect */ public static CreatePagePropertyValueSelectSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueSelectSelect.class); } /** * Convert an instance of CreatePagePropertyValueSelectSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueTitle.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.RichTextItem; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueTitle */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueTitle { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @javax.annotation.Nonnull private List<RichTextItem> title = new ArrayList<>(); public CreatePagePropertyValueTitle() { } public CreatePagePropertyValueTitle type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueTitle title(@javax.annotation.Nonnull List<RichTextItem> title) { this.title = title; return this; } public CreatePagePropertyValueTitle addTitleItem(RichTextItem titleItem) { if (this.title == null) { this.title = new ArrayList<>(); } this.title.add(titleItem); return this; } /** * Get title * @return title */ @javax.annotation.Nonnull public List<RichTextItem> getTitle() { return title; } public void setTitle(@javax.annotation.Nonnull List<RichTextItem> title) { this.title = title; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueTitle createPagePropertyValueTitle = (CreatePagePropertyValueTitle) o; return Objects.equals(this.type, createPagePropertyValueTitle.type) && Objects.equals(this.title, createPagePropertyValueTitle.title); } @Override public int hashCode() { return Objects.hash(type, title); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueTitle {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "title")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "title")); } /** * 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 CreatePagePropertyValueTitle */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueTitle.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueTitle is not found in the empty JSON string", CreatePagePropertyValueTitle.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueTitle.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueTitle` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueTitle.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // ensure the json data is an array if (!jsonObj.get("title").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `title` to be an array in the JSON string but got `%s`", jsonObj.get("title").toString())); } JsonArray jsonArraytitle = jsonObj.getAsJsonArray("title"); // validate the required field `title` (array) for (int i = 0; i < jsonArraytitle.size(); i++) { RichTextItem.validateJsonElement(jsonArraytitle.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueTitle.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueTitle' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueTitle> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueTitle.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueTitle>() { @Override public void write(JsonWriter out, CreatePagePropertyValueTitle value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueTitle read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueTitle given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueTitle * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueTitle */ public static CreatePagePropertyValueTitle fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueTitle.class); } /** * Convert an instance of CreatePagePropertyValueTitle to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePagePropertyValueUrl.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.net.URI; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePagePropertyValueUrl */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePagePropertyValueUrl { public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nonnull private URI url; public CreatePagePropertyValueUrl() { } public CreatePagePropertyValueUrl type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public CreatePagePropertyValueUrl url(@javax.annotation.Nonnull URI url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nonnull public URI getUrl() { return url; } public void setUrl(@javax.annotation.Nonnull URI url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePagePropertyValueUrl createPagePropertyValueUrl = (CreatePagePropertyValueUrl) o; return Objects.equals(this.type, createPagePropertyValueUrl.type) && Objects.equals(this.url, createPagePropertyValueUrl.url); } @Override public int hashCode() { return Objects.hash(type, url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePagePropertyValueUrl {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "url")); } /** * 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 CreatePagePropertyValueUrl */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePagePropertyValueUrl.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePagePropertyValueUrl is not found in the empty JSON string", CreatePagePropertyValueUrl.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePagePropertyValueUrl.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePagePropertyValueUrl` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePagePropertyValueUrl.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePagePropertyValueUrl.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePagePropertyValueUrl' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePagePropertyValueUrl> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePagePropertyValueUrl.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePagePropertyValueUrl>() { @Override public void write(JsonWriter out, CreatePagePropertyValueUrl value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePagePropertyValueUrl read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePagePropertyValueUrl given an JSON string * * @param jsonString JSON string * @return An instance of CreatePagePropertyValueUrl * @throws IOException if the JSON string is invalid with respect to CreatePagePropertyValueUrl */ public static CreatePagePropertyValueUrl fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePagePropertyValueUrl.class); } /** * Convert an instance of CreatePagePropertyValueUrl to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageRequest.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.HashMap; import java.util.Map; import org.openapitools.client.model.Cover; import org.openapitools.client.model.CreatePagePropertyValue; import org.openapitools.client.model.Icon; import org.openapitools.client.model.Parent; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageRequest */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageRequest { public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private Parent parent; public static final String SERIALIZED_NAME_ICON = "icon"; @SerializedName(SERIALIZED_NAME_ICON) @javax.annotation.Nullable private Icon icon; public static final String SERIALIZED_NAME_COVER = "cover"; @SerializedName(SERIALIZED_NAME_COVER) @javax.annotation.Nullable private Cover cover; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) @javax.annotation.Nonnull private Map<String, CreatePagePropertyValue> properties = new HashMap<>(); public CreatePageRequest() { } public CreatePageRequest parent(@javax.annotation.Nullable Parent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public Parent getParent() { return parent; } public void setParent(@javax.annotation.Nullable Parent parent) { this.parent = parent; } public CreatePageRequest icon(@javax.annotation.Nullable Icon icon) { this.icon = icon; return this; } /** * Get icon * @return icon */ @javax.annotation.Nullable public Icon getIcon() { return icon; } public void setIcon(@javax.annotation.Nullable Icon icon) { this.icon = icon; } public CreatePageRequest cover(@javax.annotation.Nullable Cover cover) { this.cover = cover; return this; } /** * Get cover * @return cover */ @javax.annotation.Nullable public Cover getCover() { return cover; } public void setCover(@javax.annotation.Nullable Cover cover) { this.cover = cover; } public CreatePageRequest properties(@javax.annotation.Nonnull Map<String, CreatePagePropertyValue> properties) { this.properties = properties; return this; } public CreatePageRequest putPropertiesItem(String key, CreatePagePropertyValue propertiesItem) { if (this.properties == null) { this.properties = new HashMap<>(); } this.properties.put(key, propertiesItem); return this; } /** * 页面属性 * @return properties */ @javax.annotation.Nonnull public Map<String, CreatePagePropertyValue> getProperties() { return properties; } public void setProperties(@javax.annotation.Nonnull Map<String, CreatePagePropertyValue> properties) { this.properties = properties; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageRequest createPageRequest = (CreatePageRequest) o; return Objects.equals(this.parent, createPageRequest.parent) && Objects.equals(this.icon, createPageRequest.icon) && Objects.equals(this.cover, createPageRequest.cover) && Objects.equals(this.properties, createPageRequest.properties); } @Override public int hashCode() { return Objects.hash(parent, icon, cover, properties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageRequest {\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" cover: ").append(toIndentedString(cover)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("parent", "icon", "cover", "properties")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("properties")); } /** * 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 CreatePageRequest */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageRequest is not found in the empty JSON string", CreatePageRequest.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageRequest.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePageRequest.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { Parent.validateJsonElement(jsonObj.get("parent")); } // validate the optional field `icon` if (jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) { Icon.validateJsonElement(jsonObj.get("icon")); } // validate the optional field `cover` if (jsonObj.get("cover") != null && !jsonObj.get("cover").isJsonNull()) { Cover.validateJsonElement(jsonObj.get("cover")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageRequest.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageRequest' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageRequest> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageRequest.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageRequest>() { @Override public void write(JsonWriter out, CreatePageRequest value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageRequest read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageRequest given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageRequest * @throws IOException if the JSON string is invalid with respect to CreatePageRequest */ public static CreatePageRequest fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageRequest.class); } /** * Convert an instance of CreatePageRequest to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponse.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.net.URI; import java.time.OffsetDateTime; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.openapitools.client.model.CreatePageResponseCreatedBy; import org.openapitools.client.model.CreatePageResponseParent; import org.openapitools.client.model.CreatePageResponseUpdatedBy; import org.openapitools.client.model.PropertyValue; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponse { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { PAGE("page"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public static final String SERIALIZED_NAME_CREATED_AT = "createdAt"; @SerializedName(SERIALIZED_NAME_CREATED_AT) @javax.annotation.Nullable private OffsetDateTime createdAt; public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; @SerializedName(SERIALIZED_NAME_CREATED_BY) @javax.annotation.Nullable private CreatePageResponseCreatedBy createdBy; public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt"; @SerializedName(SERIALIZED_NAME_UPDATED_AT) @javax.annotation.Nullable private OffsetDateTime updatedAt; public static final String SERIALIZED_NAME_UPDATED_BY = "updatedBy"; @SerializedName(SERIALIZED_NAME_UPDATED_BY) @javax.annotation.Nullable private CreatePageResponseUpdatedBy updatedBy; public static final String SERIALIZED_NAME_ARCHIVED = "archived"; @SerializedName(SERIALIZED_NAME_ARCHIVED) @javax.annotation.Nullable private Boolean archived; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) @javax.annotation.Nullable private Map<String, PropertyValue> properties = new HashMap<>(); public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private CreatePageResponseParent parent; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private URI url; public CreatePageResponse() { } public CreatePageResponse _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public CreatePageResponse id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * 页面ID * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } public CreatePageResponse createdAt(@javax.annotation.Nullable OffsetDateTime createdAt) { this.createdAt = createdAt; return this; } /** * 创建时间 * @return createdAt */ @javax.annotation.Nullable public OffsetDateTime getCreatedAt() { return createdAt; } public void setCreatedAt(@javax.annotation.Nullable OffsetDateTime createdAt) { this.createdAt = createdAt; } public CreatePageResponse createdBy(@javax.annotation.Nullable CreatePageResponseCreatedBy createdBy) { this.createdBy = createdBy; return this; } /** * Get createdBy * @return createdBy */ @javax.annotation.Nullable public CreatePageResponseCreatedBy getCreatedBy() { return createdBy; } public void setCreatedBy(@javax.annotation.Nullable CreatePageResponseCreatedBy createdBy) { this.createdBy = createdBy; } public CreatePageResponse updatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { this.updatedAt = updatedAt; return this; } /** * 更新时间 * @return updatedAt */ @javax.annotation.Nullable public OffsetDateTime getUpdatedAt() { return updatedAt; } public void setUpdatedAt(@javax.annotation.Nullable OffsetDateTime updatedAt) { this.updatedAt = updatedAt; } public CreatePageResponse updatedBy(@javax.annotation.Nullable CreatePageResponseUpdatedBy updatedBy) { this.updatedBy = updatedBy; return this; } /** * Get updatedBy * @return updatedBy */ @javax.annotation.Nullable public CreatePageResponseUpdatedBy getUpdatedBy() { return updatedBy; } public void setUpdatedBy(@javax.annotation.Nullable CreatePageResponseUpdatedBy updatedBy) { this.updatedBy = updatedBy; } public CreatePageResponse archived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; return this; } /** * 是否已归档 * @return archived */ @javax.annotation.Nullable public Boolean getArchived() { return archived; } public void setArchived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; } public CreatePageResponse properties(@javax.annotation.Nullable Map<String, PropertyValue> properties) { this.properties = properties; return this; } public CreatePageResponse putPropertiesItem(String key, PropertyValue propertiesItem) { if (this.properties == null) { this.properties = new HashMap<>(); } this.properties.put(key, propertiesItem); return this; } /** * 页面属性值 * @return properties */ @javax.annotation.Nullable public Map<String, PropertyValue> getProperties() { return properties; } public void setProperties(@javax.annotation.Nullable Map<String, PropertyValue> properties) { this.properties = properties; } public CreatePageResponse parent(@javax.annotation.Nullable CreatePageResponseParent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public CreatePageResponseParent getParent() { return parent; } public void setParent(@javax.annotation.Nullable CreatePageResponseParent parent) { this.parent = parent; } public CreatePageResponse url(@javax.annotation.Nullable URI url) { this.url = url; return this; } /** * 页面访问URL * @return url */ @javax.annotation.Nullable public URI getUrl() { return url; } public void setUrl(@javax.annotation.Nullable URI url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageResponse createPageResponse = (CreatePageResponse) o; return Objects.equals(this._object, createPageResponse._object) && Objects.equals(this.id, createPageResponse.id) && Objects.equals(this.createdAt, createPageResponse.createdAt) && Objects.equals(this.createdBy, createPageResponse.createdBy) && Objects.equals(this.updatedAt, createPageResponse.updatedAt) && Objects.equals(this.updatedBy, createPageResponse.updatedBy) && Objects.equals(this.archived, createPageResponse.archived) && Objects.equals(this.properties, createPageResponse.properties) && Objects.equals(this.parent, createPageResponse.parent) && Objects.equals(this.url, createPageResponse.url); } @Override public int hashCode() { return Objects.hash(_object, id, createdAt, createdBy, updatedAt, updatedBy, archived, properties, parent, url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageResponse {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); sb.append(" updatedBy: ").append(toIndentedString(updatedBy)).append("\n"); sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id", "createdAt", "createdBy", "updatedAt", "updatedBy", "archived", "properties", "parent", "url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 CreatePageResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageResponse is not found in the empty JSON string", CreatePageResponse.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageResponse.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the optional field `createdBy` if (jsonObj.get("createdBy") != null && !jsonObj.get("createdBy").isJsonNull()) { CreatePageResponseCreatedBy.validateJsonElement(jsonObj.get("createdBy")); } // validate the optional field `updatedBy` if (jsonObj.get("updatedBy") != null && !jsonObj.get("updatedBy").isJsonNull()) { CreatePageResponseUpdatedBy.validateJsonElement(jsonObj.get("updatedBy")); } // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { CreatePageResponseParent.validateJsonElement(jsonObj.get("parent")); } 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponse.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponse' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponse> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponse.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponse>() { @Override public void write(JsonWriter out, CreatePageResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageResponse given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponse * @throws IOException if the JSON string is invalid with respect to CreatePageResponse */ public static CreatePageResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponse.class); } /** * Convert an instance of CreatePageResponse to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponseCreatedBy.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageResponseCreatedBy */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponseCreatedBy { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { USER("user"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public CreatePageResponseCreatedBy() { } public CreatePageResponseCreatedBy _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public CreatePageResponseCreatedBy id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * 创建者ID * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageResponseCreatedBy createPageResponseCreatedBy = (CreatePageResponseCreatedBy) o; return Objects.equals(this._object, createPageResponseCreatedBy._object) && Objects.equals(this.id, createPageResponseCreatedBy.id); } @Override public int hashCode() { return Objects.hash(_object, id); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageResponseCreatedBy {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 CreatePageResponseCreatedBy */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageResponseCreatedBy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageResponseCreatedBy is not found in the empty JSON string", CreatePageResponseCreatedBy.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageResponseCreatedBy.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageResponseCreatedBy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponseCreatedBy.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponseCreatedBy' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponseCreatedBy> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseCreatedBy.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponseCreatedBy>() { @Override public void write(JsonWriter out, CreatePageResponseCreatedBy value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageResponseCreatedBy read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageResponseCreatedBy given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponseCreatedBy * @throws IOException if the JSON string is invalid with respect to CreatePageResponseCreatedBy */ public static CreatePageResponseCreatedBy fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponseCreatedBy.class); } /** * Convert an instance of CreatePageResponseCreatedBy to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponseParent.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; import org.openapitools.client.model.CreatePageResponseParentOneOf; import org.openapitools.client.model.CreatePageResponseParentOneOf1; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponseParent extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(CreatePageResponseParent.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponseParent.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponseParent' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponseParentOneOf> adapterCreatePageResponseParentOneOf = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseParentOneOf.class)); final TypeAdapter<CreatePageResponseParentOneOf1> adapterCreatePageResponseParentOneOf1 = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseParentOneOf1.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponseParent>() { @Override public void write(JsonWriter out, CreatePageResponseParent value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `CreatePageResponseParentOneOf` if (value.getActualInstance() instanceof CreatePageResponseParentOneOf) { JsonElement element = adapterCreatePageResponseParentOneOf.toJsonTree((CreatePageResponseParentOneOf)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `CreatePageResponseParentOneOf1` if (value.getActualInstance() instanceof CreatePageResponseParentOneOf1) { JsonElement element = adapterCreatePageResponseParentOneOf1.toJsonTree((CreatePageResponseParentOneOf1)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1"); } @Override public CreatePageResponseParent read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); int match = 0; ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize CreatePageResponseParentOneOf try { // validate the JSON object to see if any exception is thrown CreatePageResponseParentOneOf.validateJsonElement(jsonElement); actualAdapter = adapterCreatePageResponseParentOneOf; match++; log.log(Level.FINER, "Input data matches schema 'CreatePageResponseParentOneOf'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePageResponseParentOneOf failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePageResponseParentOneOf'", e); } // deserialize CreatePageResponseParentOneOf1 try { // validate the JSON object to see if any exception is thrown CreatePageResponseParentOneOf1.validateJsonElement(jsonElement); actualAdapter = adapterCreatePageResponseParentOneOf1; match++; log.log(Level.FINER, "Input data matches schema 'CreatePageResponseParentOneOf1'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for CreatePageResponseParentOneOf1 failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'CreatePageResponseParentOneOf1'", e); } if (match == 1) { CreatePageResponseParent ret = new CreatePageResponseParent(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } throw new IOException(String.format("Failed deserialization for CreatePageResponseParent: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in oneOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public CreatePageResponseParent() { super("oneOf", Boolean.FALSE); } public CreatePageResponseParent(Object o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("CreatePageResponseParentOneOf", CreatePageResponseParentOneOf.class); schemas.put("CreatePageResponseParentOneOf1", CreatePageResponseParentOneOf1.class); } @Override public Map<String, Class<?>> getSchemas() { return CreatePageResponseParent.schemas; } /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: * CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1 * * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof CreatePageResponseParentOneOf) { super.setActualInstance(instance); return; } if (instance instanceof CreatePageResponseParentOneOf1) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1"); } /** * Get the actual instance, which can be the following: * CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1 * * @return The actual instance (CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `CreatePageResponseParentOneOf`. If the actual instance is not `CreatePageResponseParentOneOf`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePageResponseParentOneOf` * @throws ClassCastException if the instance is not `CreatePageResponseParentOneOf` */ public CreatePageResponseParentOneOf getCreatePageResponseParentOneOf() throws ClassCastException { return (CreatePageResponseParentOneOf)super.getActualInstance(); } /** * Get the actual instance of `CreatePageResponseParentOneOf1`. If the actual instance is not `CreatePageResponseParentOneOf1`, * the ClassCastException will be thrown. * * @return The actual instance of `CreatePageResponseParentOneOf1` * @throws ClassCastException if the instance is not `CreatePageResponseParentOneOf1` */ public CreatePageResponseParentOneOf1 getCreatePageResponseParentOneOf1() throws ClassCastException { return (CreatePageResponseParentOneOf1)super.getActualInstance(); } /** * 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 CreatePageResponseParent */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate oneOf schemas one by one int validCount = 0; ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with CreatePageResponseParentOneOf try { CreatePageResponseParentOneOf.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePageResponseParentOneOf failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with CreatePageResponseParentOneOf1 try { CreatePageResponseParentOneOf1.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for CreatePageResponseParentOneOf1 failed with `%s`.", e.getMessage())); // continue to the next one } if (validCount != 1) { throw new IOException(String.format("The JSON string is invalid for CreatePageResponseParent with oneOf schemas: CreatePageResponseParentOneOf, CreatePageResponseParentOneOf1. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } /** * Create an instance of CreatePageResponseParent given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponseParent * @throws IOException if the JSON string is invalid with respect to CreatePageResponseParent */ public static CreatePageResponseParent fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponseParent.class); } /** * Convert an instance of CreatePageResponseParent to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponseParentOneOf.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageResponseParentOneOf */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponseParentOneOf { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DATABASE_ID("database_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_DATABASE_ID = "database_id"; @SerializedName(SERIALIZED_NAME_DATABASE_ID) @javax.annotation.Nonnull private UUID databaseId; public CreatePageResponseParentOneOf() { } public CreatePageResponseParentOneOf type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public CreatePageResponseParentOneOf databaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; return this; } /** * Get databaseId * @return databaseId */ @javax.annotation.Nonnull public UUID getDatabaseId() { return databaseId; } public void setDatabaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageResponseParentOneOf createPageResponseParentOneOf = (CreatePageResponseParentOneOf) o; return Objects.equals(this.type, createPageResponseParentOneOf.type) && Objects.equals(this.databaseId, createPageResponseParentOneOf.databaseId); } @Override public int hashCode() { return Objects.hash(type, databaseId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageResponseParentOneOf {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" databaseId: ").append(toIndentedString(databaseId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "database_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "database_id")); } /** * 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 CreatePageResponseParentOneOf */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageResponseParentOneOf.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageResponseParentOneOf is not found in the empty JSON string", CreatePageResponseParentOneOf.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageResponseParentOneOf.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageResponseParentOneOf` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePageResponseParentOneOf.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("database_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `database_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("database_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponseParentOneOf.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponseParentOneOf' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponseParentOneOf> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseParentOneOf.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponseParentOneOf>() { @Override public void write(JsonWriter out, CreatePageResponseParentOneOf value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageResponseParentOneOf read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageResponseParentOneOf given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponseParentOneOf * @throws IOException if the JSON string is invalid with respect to CreatePageResponseParentOneOf */ public static CreatePageResponseParentOneOf fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponseParentOneOf.class); } /** * Convert an instance of CreatePageResponseParentOneOf to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponseParentOneOf1.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageResponseParentOneOf1 */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponseParentOneOf1 { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { PAGE_ID("page_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_PAGE_ID = "page_id"; @SerializedName(SERIALIZED_NAME_PAGE_ID) @javax.annotation.Nonnull private UUID pageId; public CreatePageResponseParentOneOf1() { } public CreatePageResponseParentOneOf1 type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public CreatePageResponseParentOneOf1 pageId(@javax.annotation.Nonnull UUID pageId) { this.pageId = pageId; return this; } /** * Get pageId * @return pageId */ @javax.annotation.Nonnull public UUID getPageId() { return pageId; } public void setPageId(@javax.annotation.Nonnull UUID pageId) { this.pageId = pageId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageResponseParentOneOf1 createPageResponseParentOneOf1 = (CreatePageResponseParentOneOf1) o; return Objects.equals(this.type, createPageResponseParentOneOf1.type) && Objects.equals(this.pageId, createPageResponseParentOneOf1.pageId); } @Override public int hashCode() { return Objects.hash(type, pageId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageResponseParentOneOf1 {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" pageId: ").append(toIndentedString(pageId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "page_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "page_id")); } /** * 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 CreatePageResponseParentOneOf1 */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageResponseParentOneOf1.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageResponseParentOneOf1 is not found in the empty JSON string", CreatePageResponseParentOneOf1.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageResponseParentOneOf1.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageResponseParentOneOf1` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : CreatePageResponseParentOneOf1.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("page_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `page_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("page_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponseParentOneOf1.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponseParentOneOf1' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponseParentOneOf1> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseParentOneOf1.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponseParentOneOf1>() { @Override public void write(JsonWriter out, CreatePageResponseParentOneOf1 value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageResponseParentOneOf1 read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageResponseParentOneOf1 given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponseParentOneOf1 * @throws IOException if the JSON string is invalid with respect to CreatePageResponseParentOneOf1 */ public static CreatePageResponseParentOneOf1 fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponseParentOneOf1.class); } /** * Convert an instance of CreatePageResponseParentOneOf1 to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/CreatePageResponseUpdatedBy.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * CreatePageResponseUpdatedBy */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class CreatePageResponseUpdatedBy { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { USER("user"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public CreatePageResponseUpdatedBy() { } public CreatePageResponseUpdatedBy _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public CreatePageResponseUpdatedBy id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * 更新者ID * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } CreatePageResponseUpdatedBy createPageResponseUpdatedBy = (CreatePageResponseUpdatedBy) o; return Objects.equals(this._object, createPageResponseUpdatedBy._object) && Objects.equals(this.id, createPageResponseUpdatedBy.id); } @Override public int hashCode() { return Objects.hash(_object, id); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class CreatePageResponseUpdatedBy {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 CreatePageResponseUpdatedBy */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!CreatePageResponseUpdatedBy.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in CreatePageResponseUpdatedBy is not found in the empty JSON string", CreatePageResponseUpdatedBy.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!CreatePageResponseUpdatedBy.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreatePageResponseUpdatedBy` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!CreatePageResponseUpdatedBy.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'CreatePageResponseUpdatedBy' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<CreatePageResponseUpdatedBy> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(CreatePageResponseUpdatedBy.class)); return (TypeAdapter<T>) new TypeAdapter<CreatePageResponseUpdatedBy>() { @Override public void write(JsonWriter out, CreatePageResponseUpdatedBy value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public CreatePageResponseUpdatedBy read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of CreatePageResponseUpdatedBy given an JSON string * * @param jsonString JSON string * @return An instance of CreatePageResponseUpdatedBy * @throws IOException if the JSON string is invalid with respect to CreatePageResponseUpdatedBy */ public static CreatePageResponseUpdatedBy fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, CreatePageResponseUpdatedBy.class); } /** * Convert an instance of CreatePageResponseUpdatedBy to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Database.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.time.OffsetDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; import org.openapitools.client.model.Cover; import org.openapitools.client.model.Icon; import org.openapitools.client.model.Parent; import org.openapitools.client.model.PropertySchema; import org.openapitools.client.model.RichTextItem; import org.openapitools.client.model.User; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * Database */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Database { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { DATABASE("database"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public static final String SERIALIZED_NAME_CREATED_TIME = "created_time"; @SerializedName(SERIALIZED_NAME_CREATED_TIME) @javax.annotation.Nullable private OffsetDateTime createdTime; public static final String SERIALIZED_NAME_CREATED_BY = "created_by"; @SerializedName(SERIALIZED_NAME_CREATED_BY) @javax.annotation.Nullable private User createdBy; public static final String SERIALIZED_NAME_LAST_EDITED_TIME = "last_edited_time"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_TIME) @javax.annotation.Nullable private OffsetDateTime lastEditedTime; public static final String SERIALIZED_NAME_LAST_EDITED_BY = "last_edited_by"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_BY) @javax.annotation.Nullable private User lastEditedBy; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @javax.annotation.Nullable private List<RichTextItem> title = new ArrayList<>(); public static final String SERIALIZED_NAME_ICON = "icon"; @SerializedName(SERIALIZED_NAME_ICON) @javax.annotation.Nullable private Icon icon; public static final String SERIALIZED_NAME_COVER = "cover"; @SerializedName(SERIALIZED_NAME_COVER) @javax.annotation.Nullable private Cover cover; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) @javax.annotation.Nullable private Map<String, PropertySchema> properties = new HashMap<>(); public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private Parent parent; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_ARCHIVED = "archived"; @SerializedName(SERIALIZED_NAME_ARCHIVED) @javax.annotation.Nullable private Boolean archived; public static final String SERIALIZED_NAME_IS_INLINE = "is_inline"; @SerializedName(SERIALIZED_NAME_IS_INLINE) @javax.annotation.Nullable private Boolean isInline; public Database() { } public Database _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public Database id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } public Database createdTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; return this; } /** * Get createdTime * @return createdTime */ @javax.annotation.Nullable public OffsetDateTime getCreatedTime() { return createdTime; } public void setCreatedTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; } public Database createdBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; return this; } /** * Get createdBy * @return createdBy */ @javax.annotation.Nullable public User getCreatedBy() { return createdBy; } public void setCreatedBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; } public Database lastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; return this; } /** * Get lastEditedTime * @return lastEditedTime */ @javax.annotation.Nullable public OffsetDateTime getLastEditedTime() { return lastEditedTime; } public void setLastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; } public Database lastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; return this; } /** * Get lastEditedBy * @return lastEditedBy */ @javax.annotation.Nullable public User getLastEditedBy() { return lastEditedBy; } public void setLastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; } public Database title(@javax.annotation.Nullable List<RichTextItem> title) { this.title = title; return this; } public Database addTitleItem(RichTextItem titleItem) { if (this.title == null) { this.title = new ArrayList<>(); } this.title.add(titleItem); return this; } /** * Get title * @return title */ @javax.annotation.Nullable public List<RichTextItem> getTitle() { return title; } public void setTitle(@javax.annotation.Nullable List<RichTextItem> title) { this.title = title; } public Database icon(@javax.annotation.Nullable Icon icon) { this.icon = icon; return this; } /** * Get icon * @return icon */ @javax.annotation.Nullable public Icon getIcon() { return icon; } public void setIcon(@javax.annotation.Nullable Icon icon) { this.icon = icon; } public Database cover(@javax.annotation.Nullable Cover cover) { this.cover = cover; return this; } /** * Get cover * @return cover */ @javax.annotation.Nullable public Cover getCover() { return cover; } public void setCover(@javax.annotation.Nullable Cover cover) { this.cover = cover; } public Database properties(@javax.annotation.Nullable Map<String, PropertySchema> properties) { this.properties = properties; return this; } public Database putPropertiesItem(String key, PropertySchema propertiesItem) { if (this.properties == null) { this.properties = new HashMap<>(); } this.properties.put(key, propertiesItem); return this; } /** * Get properties * @return properties */ @javax.annotation.Nullable public Map<String, PropertySchema> getProperties() { return properties; } public void setProperties(@javax.annotation.Nullable Map<String, PropertySchema> properties) { this.properties = properties; } public Database parent(@javax.annotation.Nullable Parent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public Parent getParent() { return parent; } public void setParent(@javax.annotation.Nullable Parent parent) { this.parent = parent; } public Database url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } public Database archived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; return this; } /** * Get archived * @return archived */ @javax.annotation.Nullable public Boolean getArchived() { return archived; } public void setArchived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; } public Database isInline(@javax.annotation.Nullable Boolean isInline) { this.isInline = isInline; return this; } /** * Get isInline * @return isInline */ @javax.annotation.Nullable public Boolean getIsInline() { return isInline; } public void setIsInline(@javax.annotation.Nullable Boolean isInline) { this.isInline = isInline; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Database database = (Database) o; return Objects.equals(this._object, database._object) && Objects.equals(this.id, database.id) && Objects.equals(this.createdTime, database.createdTime) && Objects.equals(this.createdBy, database.createdBy) && Objects.equals(this.lastEditedTime, database.lastEditedTime) && Objects.equals(this.lastEditedBy, database.lastEditedBy) && Objects.equals(this.title, database.title) && Objects.equals(this.icon, database.icon) && Objects.equals(this.cover, database.cover) && Objects.equals(this.properties, database.properties) && Objects.equals(this.parent, database.parent) && Objects.equals(this.url, database.url) && Objects.equals(this.archived, database.archived) && Objects.equals(this.isInline, database.isInline); } @Override public int hashCode() { return Objects.hash(_object, id, createdTime, createdBy, lastEditedTime, lastEditedBy, title, icon, cover, properties, parent, url, archived, isInline); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Database {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" lastEditedTime: ").append(toIndentedString(lastEditedTime)).append("\n"); sb.append(" lastEditedBy: ").append(toIndentedString(lastEditedBy)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" cover: ").append(toIndentedString(cover)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); sb.append(" isInline: ").append(toIndentedString(isInline)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id", "created_time", "created_by", "last_edited_time", "last_edited_by", "title", "icon", "cover", "properties", "parent", "url", "archived", "is_inline")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 Database */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Database.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in Database is not found in the empty JSON string", Database.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!Database.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Database` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the optional field `created_by` if (jsonObj.get("created_by") != null && !jsonObj.get("created_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("created_by")); } // validate the optional field `last_edited_by` if (jsonObj.get("last_edited_by") != null && !jsonObj.get("last_edited_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("last_edited_by")); } if (jsonObj.get("title") != null && !jsonObj.get("title").isJsonNull()) { JsonArray jsonArraytitle = jsonObj.getAsJsonArray("title"); if (jsonArraytitle != null) { // ensure the json data is an array if (!jsonObj.get("title").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `title` to be an array in the JSON string but got `%s`", jsonObj.get("title").toString())); } // validate the optional field `title` (array) for (int i = 0; i < jsonArraytitle.size(); i++) { RichTextItem.validateJsonElement(jsonArraytitle.get(i)); }; } } // validate the optional field `icon` if (jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) { Icon.validateJsonElement(jsonObj.get("icon")); } // validate the optional field `cover` if (jsonObj.get("cover") != null && !jsonObj.get("cover").isJsonNull()) { Cover.validateJsonElement(jsonObj.get("cover")); } // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { Parent.validateJsonElement(jsonObj.get("parent")); } 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Database.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Database' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<Database> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Database.class)); return (TypeAdapter<T>) new TypeAdapter<Database>() { @Override public void write(JsonWriter out, Database value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public Database read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of Database given an JSON string * * @param jsonString JSON string * @return An instance of Database * @throws IOException if the JSON string is invalid with respect to Database */ public static Database fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Database.class); } /** * Convert an instance of Database to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/DeleteBlockResponse.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * DeleteBlockResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class DeleteBlockResponse { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { BLOCK("block"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public static final String SERIALIZED_NAME_DELETED = "deleted"; @SerializedName(SERIALIZED_NAME_DELETED) @javax.annotation.Nullable private Boolean deleted; public DeleteBlockResponse() { } public DeleteBlockResponse _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public DeleteBlockResponse id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } public DeleteBlockResponse deleted(@javax.annotation.Nullable Boolean deleted) { this.deleted = deleted; return this; } /** * Get deleted * @return deleted */ @javax.annotation.Nullable public Boolean getDeleted() { return deleted; } public void setDeleted(@javax.annotation.Nullable Boolean deleted) { this.deleted = deleted; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DeleteBlockResponse deleteBlockResponse = (DeleteBlockResponse) o; return Objects.equals(this._object, deleteBlockResponse._object) && Objects.equals(this.id, deleteBlockResponse.id) && Objects.equals(this.deleted, deleteBlockResponse.deleted); } @Override public int hashCode() { return Objects.hash(_object, id, deleted); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class DeleteBlockResponse {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" deleted: ").append(toIndentedString(deleted)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id", "deleted")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 DeleteBlockResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!DeleteBlockResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in DeleteBlockResponse is not found in the empty JSON string", DeleteBlockResponse.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!DeleteBlockResponse.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DeleteBlockResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!DeleteBlockResponse.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'DeleteBlockResponse' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<DeleteBlockResponse> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(DeleteBlockResponse.class)); return (TypeAdapter<T>) new TypeAdapter<DeleteBlockResponse>() { @Override public void write(JsonWriter out, DeleteBlockResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public DeleteBlockResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of DeleteBlockResponse given an JSON string * * @param jsonString JSON string * @return An instance of DeleteBlockResponse * @throws IOException if the JSON string is invalid with respect to DeleteBlockResponse */ public static DeleteBlockResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, DeleteBlockResponse.class); } /** * Convert an instance of DeleteBlockResponse to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Error.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * Error */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Error { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { ERROR("error"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) @javax.annotation.Nullable private Integer status; /** * Gets or Sets code */ @JsonAdapter(CodeEnum.Adapter.class) public enum CodeEnum { VALIDATION_ERROR("validation_error"), UNAUTHORIZED("unauthorized"), FORBIDDEN("forbidden"), NOT_FOUND("not_found"), RATE_LIMIT("rate_limit"), INTERNAL_ERROR("internal_error"); private String value; CodeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static CodeEnum fromValue(String value) { for (CodeEnum b : CodeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<CodeEnum> { @Override public void write(final JsonWriter jsonWriter, final CodeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public CodeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return CodeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); CodeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) @javax.annotation.Nullable private CodeEnum code; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) @javax.annotation.Nullable private String message; public Error() { } public Error _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public Error status(@javax.annotation.Nullable Integer status) { this.status = status; return this; } /** * Get status * @return status */ @javax.annotation.Nullable public Integer getStatus() { return status; } public void setStatus(@javax.annotation.Nullable Integer status) { this.status = status; } public Error code(@javax.annotation.Nullable CodeEnum code) { this.code = code; return this; } /** * Get code * @return code */ @javax.annotation.Nullable public CodeEnum getCode() { return code; } public void setCode(@javax.annotation.Nullable CodeEnum code) { this.code = code; } public Error message(@javax.annotation.Nullable String message) { this.message = message; return this; } /** * Get message * @return message */ @javax.annotation.Nullable public String getMessage() { return message; } public void setMessage(@javax.annotation.Nullable String message) { this.message = message; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Error error = (Error) o; return Objects.equals(this._object, error._object) && Objects.equals(this.status, error.status) && Objects.equals(this.code, error.code) && Objects.equals(this.message, error.message); } @Override public int hashCode() { return Objects.hash(_object, status, code, message); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Error {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); sb.append(" code: ").append(toIndentedString(code)).append("\n"); sb.append(" message: ").append(toIndentedString(message)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "status", "code", "message")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 Error */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Error.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in Error is not found in the empty JSON string", Error.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!Error.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Error` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) && !jsonObj.get("code").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("code").toString())); } // validate the optional field `code` if (jsonObj.get("code") != null && !jsonObj.get("code").isJsonNull()) { CodeEnum.validateJsonElement(jsonObj.get("code")); } if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Error.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Error' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<Error> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Error.class)); return (TypeAdapter<T>) new TypeAdapter<Error>() { @Override public void write(JsonWriter out, Error value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public Error read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of Error given an JSON string * * @param jsonString JSON string * @return An instance of Error * @throws IOException if the JSON string is invalid with respect to Error */ public static Error fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Error.class); } /** * Convert an instance of Error to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/GetBlockChildrenResponse.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.Block; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * GetBlockChildrenResponse */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class GetBlockChildrenResponse { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { LIST("list"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) @javax.annotation.Nullable private List<Block> results = new ArrayList<>(); public static final String SERIALIZED_NAME_NEXT_CURSOR = "next_cursor"; @SerializedName(SERIALIZED_NAME_NEXT_CURSOR) @javax.annotation.Nullable private String nextCursor; public static final String SERIALIZED_NAME_HAS_MORE = "has_more"; @SerializedName(SERIALIZED_NAME_HAS_MORE) @javax.annotation.Nullable private Boolean hasMore; public GetBlockChildrenResponse() { } public GetBlockChildrenResponse _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public GetBlockChildrenResponse results(@javax.annotation.Nullable List<Block> results) { this.results = results; return this; } public GetBlockChildrenResponse addResultsItem(Block resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } this.results.add(resultsItem); return this; } /** * Get results * @return results */ @javax.annotation.Nullable public List<Block> getResults() { return results; } public void setResults(@javax.annotation.Nullable List<Block> results) { this.results = results; } public GetBlockChildrenResponse nextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; return this; } /** * 下一页游标,使用最后一个项目的ID作为游标值 * @return nextCursor */ @javax.annotation.Nullable public String getNextCursor() { return nextCursor; } public void setNextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; } public GetBlockChildrenResponse hasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; return this; } /** * Get hasMore * @return hasMore */ @javax.annotation.Nullable public Boolean getHasMore() { return hasMore; } public void setHasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GetBlockChildrenResponse getBlockChildrenResponse = (GetBlockChildrenResponse) o; return Objects.equals(this._object, getBlockChildrenResponse._object) && Objects.equals(this.results, getBlockChildrenResponse.results) && Objects.equals(this.nextCursor, getBlockChildrenResponse.nextCursor) && Objects.equals(this.hasMore, getBlockChildrenResponse.hasMore); } @Override public int hashCode() { return Objects.hash(_object, results, nextCursor, hasMore); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GetBlockChildrenResponse {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" results: ").append(toIndentedString(results)).append("\n"); sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); sb.append(" hasMore: ").append(toIndentedString(hasMore)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "results", "next_cursor", "has_more")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 GetBlockChildrenResponse */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!GetBlockChildrenResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in GetBlockChildrenResponse is not found in the empty JSON string", GetBlockChildrenResponse.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!GetBlockChildrenResponse.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GetBlockChildrenResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull()) { JsonArray jsonArrayresults = jsonObj.getAsJsonArray("results"); if (jsonArrayresults != null) { // ensure the json data is an array if (!jsonObj.get("results").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); } // validate the optional field `results` (array) for (int i = 0; i < jsonArrayresults.size(); i++) { Block.validateJsonElement(jsonArrayresults.get(i)); }; } } if ((jsonObj.get("next_cursor") != null && !jsonObj.get("next_cursor").isJsonNull()) && !jsonObj.get("next_cursor").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `next_cursor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next_cursor").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!GetBlockChildrenResponse.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'GetBlockChildrenResponse' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<GetBlockChildrenResponse> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(GetBlockChildrenResponse.class)); return (TypeAdapter<T>) new TypeAdapter<GetBlockChildrenResponse>() { @Override public void write(JsonWriter out, GetBlockChildrenResponse value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public GetBlockChildrenResponse read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of GetBlockChildrenResponse given an JSON string * * @param jsonString JSON string * @return An instance of GetBlockChildrenResponse * @throws IOException if the JSON string is invalid with respect to GetBlockChildrenResponse */ public static GetBlockChildrenResponse fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, GetBlockChildrenResponse.class); } /** * Convert an instance of GetBlockChildrenResponse to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Icon.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.IconEmoji; import org.openapitools.client.model.IconExternal; import org.openapitools.client.model.IconExternalDetail; import org.openapitools.client.model.IconFile; import org.openapitools.client.model.IconFileDetail; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Icon extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Icon.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Icon.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Icon' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconEmoji> adapterIconEmoji = gson.getDelegateAdapter(this, TypeToken.get(IconEmoji.class)); final TypeAdapter<IconExternal> adapterIconExternal = gson.getDelegateAdapter(this, TypeToken.get(IconExternal.class)); final TypeAdapter<IconFile> adapterIconFile = gson.getDelegateAdapter(this, TypeToken.get(IconFile.class)); return (TypeAdapter<T>) new TypeAdapter<Icon>() { @Override public void write(JsonWriter out, Icon value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `IconEmoji` if (value.getActualInstance() instanceof IconEmoji) { JsonElement element = adapterIconEmoji.toJsonTree((IconEmoji)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `IconExternal` if (value.getActualInstance() instanceof IconExternal) { JsonElement element = adapterIconExternal.toJsonTree((IconExternal)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `IconFile` if (value.getActualInstance() instanceof IconFile) { JsonElement element = adapterIconFile.toJsonTree((IconFile)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: IconEmoji, IconExternal, IconFile"); } @Override public Icon read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); int match = 0; ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize IconEmoji try { // validate the JSON object to see if any exception is thrown IconEmoji.validateJsonElement(jsonElement); actualAdapter = adapterIconEmoji; match++; log.log(Level.FINER, "Input data matches schema 'IconEmoji'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for IconEmoji failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'IconEmoji'", e); } // deserialize IconExternal try { // validate the JSON object to see if any exception is thrown IconExternal.validateJsonElement(jsonElement); actualAdapter = adapterIconExternal; match++; log.log(Level.FINER, "Input data matches schema 'IconExternal'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for IconExternal failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'IconExternal'", e); } // deserialize IconFile try { // validate the JSON object to see if any exception is thrown IconFile.validateJsonElement(jsonElement); actualAdapter = adapterIconFile; match++; log.log(Level.FINER, "Input data matches schema 'IconFile'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for IconFile failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'IconFile'", e); } if (match == 1) { Icon ret = new Icon(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } throw new IOException(String.format("Failed deserialization for Icon: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in oneOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public Icon() { super("oneOf", Boolean.FALSE); } public Icon(Object o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("IconEmoji", IconEmoji.class); schemas.put("IconExternal", IconExternal.class); schemas.put("IconFile", IconFile.class); } @Override public Map<String, Class<?>> getSchemas() { return Icon.schemas; } /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: * IconEmoji, IconExternal, IconFile * * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof IconEmoji) { super.setActualInstance(instance); return; } if (instance instanceof IconExternal) { super.setActualInstance(instance); return; } if (instance instanceof IconFile) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be IconEmoji, IconExternal, IconFile"); } /** * Get the actual instance, which can be the following: * IconEmoji, IconExternal, IconFile * * @return The actual instance (IconEmoji, IconExternal, IconFile) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `IconEmoji`. If the actual instance is not `IconEmoji`, * the ClassCastException will be thrown. * * @return The actual instance of `IconEmoji` * @throws ClassCastException if the instance is not `IconEmoji` */ public IconEmoji getIconEmoji() throws ClassCastException { return (IconEmoji)super.getActualInstance(); } /** * Get the actual instance of `IconExternal`. If the actual instance is not `IconExternal`, * the ClassCastException will be thrown. * * @return The actual instance of `IconExternal` * @throws ClassCastException if the instance is not `IconExternal` */ public IconExternal getIconExternal() throws ClassCastException { return (IconExternal)super.getActualInstance(); } /** * Get the actual instance of `IconFile`. If the actual instance is not `IconFile`, * the ClassCastException will be thrown. * * @return The actual instance of `IconFile` * @throws ClassCastException if the instance is not `IconFile` */ public IconFile getIconFile() throws ClassCastException { return (IconFile)super.getActualInstance(); } /** * 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 Icon */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate oneOf schemas one by one int validCount = 0; ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with IconEmoji try { IconEmoji.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for IconEmoji failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with IconExternal try { IconExternal.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for IconExternal failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with IconFile try { IconFile.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for IconFile failed with `%s`.", e.getMessage())); // continue to the next one } if (validCount != 1) { throw new IOException(String.format("The JSON string is invalid for Icon with oneOf schemas: IconEmoji, IconExternal, IconFile. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } /** * Create an instance of Icon given an JSON string * * @param jsonString JSON string * @return An instance of Icon * @throws IOException if the JSON string is invalid with respect to Icon */ public static Icon fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Icon.class); } /** * Convert an instance of Icon to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/IconEmoji.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * IconEmoji */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class IconEmoji { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { EMOJI("emoji"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_EMOJI = "emoji"; @SerializedName(SERIALIZED_NAME_EMOJI) @javax.annotation.Nonnull private String emoji; public IconEmoji() { } public IconEmoji type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public IconEmoji emoji(@javax.annotation.Nonnull String emoji) { this.emoji = emoji; return this; } /** * Get emoji * @return emoji */ @javax.annotation.Nonnull public String getEmoji() { return emoji; } public void setEmoji(@javax.annotation.Nonnull String emoji) { this.emoji = emoji; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IconEmoji iconEmoji = (IconEmoji) o; return Objects.equals(this.type, iconEmoji.type) && Objects.equals(this.emoji, iconEmoji.emoji); } @Override public int hashCode() { return Objects.hash(type, emoji); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IconEmoji {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" emoji: ").append(toIndentedString(emoji)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "emoji")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "emoji")); } /** * 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 IconEmoji */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!IconEmoji.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in IconEmoji is not found in the empty JSON string", IconEmoji.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!IconEmoji.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IconEmoji` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IconEmoji.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("emoji").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `emoji` to be a primitive type in the JSON string but got `%s`", jsonObj.get("emoji").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!IconEmoji.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'IconEmoji' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconEmoji> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(IconEmoji.class)); return (TypeAdapter<T>) new TypeAdapter<IconEmoji>() { @Override public void write(JsonWriter out, IconEmoji value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public IconEmoji read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of IconEmoji given an JSON string * * @param jsonString JSON string * @return An instance of IconEmoji * @throws IOException if the JSON string is invalid with respect to IconEmoji */ public static IconEmoji fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, IconEmoji.class); } /** * Convert an instance of IconEmoji to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/IconExternal.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.IconExternalDetail; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * IconExternal */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class IconExternal { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { EXTERNAL("external"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_EXTERNAL = "external"; @SerializedName(SERIALIZED_NAME_EXTERNAL) @javax.annotation.Nonnull private IconExternalDetail external; public IconExternal() { } public IconExternal type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public IconExternal external(@javax.annotation.Nonnull IconExternalDetail external) { this.external = external; return this; } /** * Get external * @return external */ @javax.annotation.Nonnull public IconExternalDetail getExternal() { return external; } public void setExternal(@javax.annotation.Nonnull IconExternalDetail external) { this.external = external; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IconExternal iconExternal = (IconExternal) o; return Objects.equals(this.type, iconExternal.type) && Objects.equals(this.external, iconExternal.external); } @Override public int hashCode() { return Objects.hash(type, external); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IconExternal {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" external: ").append(toIndentedString(external)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "external")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "external")); } /** * 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 IconExternal */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!IconExternal.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in IconExternal is not found in the empty JSON string", IconExternal.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!IconExternal.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IconExternal` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IconExternal.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); // validate the required field `external` IconExternalDetail.validateJsonElement(jsonObj.get("external")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!IconExternal.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'IconExternal' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconExternal> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(IconExternal.class)); return (TypeAdapter<T>) new TypeAdapter<IconExternal>() { @Override public void write(JsonWriter out, IconExternal value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public IconExternal read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of IconExternal given an JSON string * * @param jsonString JSON string * @return An instance of IconExternal * @throws IOException if the JSON string is invalid with respect to IconExternal */ public static IconExternal fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, IconExternal.class); } /** * Convert an instance of IconExternal to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/IconExternalDetail.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * IconExternalDetail */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class IconExternalDetail { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public IconExternalDetail() { } public IconExternalDetail url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IconExternalDetail iconExternalDetail = (IconExternalDetail) o; return Objects.equals(this.url, iconExternalDetail.url); } @Override public int hashCode() { return Objects.hash(url); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IconExternalDetail {\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 IconExternalDetail */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!IconExternalDetail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in IconExternalDetail is not found in the empty JSON string", IconExternalDetail.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!IconExternalDetail.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IconExternalDetail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!IconExternalDetail.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'IconExternalDetail' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconExternalDetail> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(IconExternalDetail.class)); return (TypeAdapter<T>) new TypeAdapter<IconExternalDetail>() { @Override public void write(JsonWriter out, IconExternalDetail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public IconExternalDetail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of IconExternalDetail given an JSON string * * @param jsonString JSON string * @return An instance of IconExternalDetail * @throws IOException if the JSON string is invalid with respect to IconExternalDetail */ public static IconExternalDetail fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, IconExternalDetail.class); } /** * Convert an instance of IconExternalDetail to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/IconFile.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.IconFileDetail; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * IconFile */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class IconFile { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { FILE("file"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_FILE = "file"; @SerializedName(SERIALIZED_NAME_FILE) @javax.annotation.Nonnull private IconFileDetail _file; public IconFile() { } public IconFile type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public IconFile _file(@javax.annotation.Nonnull IconFileDetail _file) { this._file = _file; return this; } /** * Get _file * @return _file */ @javax.annotation.Nonnull public IconFileDetail getFile() { return _file; } public void setFile(@javax.annotation.Nonnull IconFileDetail _file) { this._file = _file; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IconFile iconFile = (IconFile) o; return Objects.equals(this.type, iconFile.type) && Objects.equals(this._file, iconFile._file); } @Override public int hashCode() { return Objects.hash(type, _file); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IconFile {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" _file: ").append(toIndentedString(_file)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "file")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "file")); } /** * 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 IconFile */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!IconFile.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in IconFile is not found in the empty JSON string", IconFile.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!IconFile.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IconFile` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : IconFile.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); // validate the required field `file` IconFileDetail.validateJsonElement(jsonObj.get("file")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!IconFile.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'IconFile' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconFile> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(IconFile.class)); return (TypeAdapter<T>) new TypeAdapter<IconFile>() { @Override public void write(JsonWriter out, IconFile value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public IconFile read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of IconFile given an JSON string * * @param jsonString JSON string * @return An instance of IconFile * @throws IOException if the JSON string is invalid with respect to IconFile */ public static IconFile fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, IconFile.class); } /** * Convert an instance of IconFile to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/IconFileDetail.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.time.OffsetDateTime; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * IconFileDetail */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class IconFileDetail { public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_EXPIRY_TIME = "expiry_time"; @SerializedName(SERIALIZED_NAME_EXPIRY_TIME) @javax.annotation.Nullable private OffsetDateTime expiryTime; public IconFileDetail() { } public IconFileDetail url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } public IconFileDetail expiryTime(@javax.annotation.Nullable OffsetDateTime expiryTime) { this.expiryTime = expiryTime; return this; } /** * Get expiryTime * @return expiryTime */ @javax.annotation.Nullable public OffsetDateTime getExpiryTime() { return expiryTime; } public void setExpiryTime(@javax.annotation.Nullable OffsetDateTime expiryTime) { this.expiryTime = expiryTime; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } IconFileDetail iconFileDetail = (IconFileDetail) o; return Objects.equals(this.url, iconFileDetail.url) && Objects.equals(this.expiryTime, iconFileDetail.expiryTime); } @Override public int hashCode() { return Objects.hash(url, expiryTime); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class IconFileDetail {\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" expiryTime: ").append(toIndentedString(expiryTime)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("url", "expiry_time")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 IconFileDetail */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!IconFileDetail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in IconFileDetail is not found in the empty JSON string", IconFileDetail.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!IconFileDetail.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `IconFileDetail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); 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())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!IconFileDetail.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'IconFileDetail' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<IconFileDetail> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(IconFileDetail.class)); return (TypeAdapter<T>) new TypeAdapter<IconFileDetail>() { @Override public void write(JsonWriter out, IconFileDetail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public IconFileDetail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of IconFileDetail given an JSON string * * @param jsonString JSON string * @return An instance of IconFileDetail * @throws IOException if the JSON string is invalid with respect to IconFileDetail */ public static IconFileDetail fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, IconFileDetail.class); } /** * Convert an instance of IconFileDetail to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Page.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.time.OffsetDateTime; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.openapitools.client.model.Cover; import org.openapitools.client.model.Icon; import org.openapitools.client.model.Parent; import org.openapitools.client.model.PropertyValue; import org.openapitools.client.model.User; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * Page */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Page { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { PAGE("page"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public static final String SERIALIZED_NAME_CREATED_TIME = "created_time"; @SerializedName(SERIALIZED_NAME_CREATED_TIME) @javax.annotation.Nullable private OffsetDateTime createdTime; public static final String SERIALIZED_NAME_CREATED_BY = "created_by"; @SerializedName(SERIALIZED_NAME_CREATED_BY) @javax.annotation.Nullable private User createdBy; public static final String SERIALIZED_NAME_LAST_EDITED_TIME = "last_edited_time"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_TIME) @javax.annotation.Nullable private OffsetDateTime lastEditedTime; public static final String SERIALIZED_NAME_LAST_EDITED_BY = "last_edited_by"; @SerializedName(SERIALIZED_NAME_LAST_EDITED_BY) @javax.annotation.Nullable private User lastEditedBy; public static final String SERIALIZED_NAME_ARCHIVED = "archived"; @SerializedName(SERIALIZED_NAME_ARCHIVED) @javax.annotation.Nullable private Boolean archived; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) @javax.annotation.Nullable private Map<String, PropertyValue> properties = new HashMap<>(); public static final String SERIALIZED_NAME_PARENT = "parent"; @SerializedName(SERIALIZED_NAME_PARENT) @javax.annotation.Nullable private Parent parent; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_ICON = "icon"; @SerializedName(SERIALIZED_NAME_ICON) @javax.annotation.Nullable private Icon icon; public static final String SERIALIZED_NAME_COVER = "cover"; @SerializedName(SERIALIZED_NAME_COVER) @javax.annotation.Nullable private Cover cover; public Page() { } public Page _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public Page id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } public Page createdTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; return this; } /** * Get createdTime * @return createdTime */ @javax.annotation.Nullable public OffsetDateTime getCreatedTime() { return createdTime; } public void setCreatedTime(@javax.annotation.Nullable OffsetDateTime createdTime) { this.createdTime = createdTime; } public Page createdBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; return this; } /** * Get createdBy * @return createdBy */ @javax.annotation.Nullable public User getCreatedBy() { return createdBy; } public void setCreatedBy(@javax.annotation.Nullable User createdBy) { this.createdBy = createdBy; } public Page lastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; return this; } /** * Get lastEditedTime * @return lastEditedTime */ @javax.annotation.Nullable public OffsetDateTime getLastEditedTime() { return lastEditedTime; } public void setLastEditedTime(@javax.annotation.Nullable OffsetDateTime lastEditedTime) { this.lastEditedTime = lastEditedTime; } public Page lastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; return this; } /** * Get lastEditedBy * @return lastEditedBy */ @javax.annotation.Nullable public User getLastEditedBy() { return lastEditedBy; } public void setLastEditedBy(@javax.annotation.Nullable User lastEditedBy) { this.lastEditedBy = lastEditedBy; } public Page archived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; return this; } /** * Get archived * @return archived */ @javax.annotation.Nullable public Boolean getArchived() { return archived; } public void setArchived(@javax.annotation.Nullable Boolean archived) { this.archived = archived; } public Page properties(@javax.annotation.Nullable Map<String, PropertyValue> properties) { this.properties = properties; return this; } public Page putPropertiesItem(String key, PropertyValue propertiesItem) { if (this.properties == null) { this.properties = new HashMap<>(); } this.properties.put(key, propertiesItem); return this; } /** * Get properties * @return properties */ @javax.annotation.Nullable public Map<String, PropertyValue> getProperties() { return properties; } public void setProperties(@javax.annotation.Nullable Map<String, PropertyValue> properties) { this.properties = properties; } public Page parent(@javax.annotation.Nullable Parent parent) { this.parent = parent; return this; } /** * Get parent * @return parent */ @javax.annotation.Nullable public Parent getParent() { return parent; } public void setParent(@javax.annotation.Nullable Parent parent) { this.parent = parent; } public Page url(@javax.annotation.Nullable String url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public String getUrl() { return url; } public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } public Page icon(@javax.annotation.Nullable Icon icon) { this.icon = icon; return this; } /** * Get icon * @return icon */ @javax.annotation.Nullable public Icon getIcon() { return icon; } public void setIcon(@javax.annotation.Nullable Icon icon) { this.icon = icon; } public Page cover(@javax.annotation.Nullable Cover cover) { this.cover = cover; return this; } /** * Get cover * @return cover */ @javax.annotation.Nullable public Cover getCover() { return cover; } public void setCover(@javax.annotation.Nullable Cover cover) { this.cover = cover; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Page page = (Page) o; return Objects.equals(this._object, page._object) && Objects.equals(this.id, page.id) && Objects.equals(this.createdTime, page.createdTime) && Objects.equals(this.createdBy, page.createdBy) && Objects.equals(this.lastEditedTime, page.lastEditedTime) && Objects.equals(this.lastEditedBy, page.lastEditedBy) && Objects.equals(this.archived, page.archived) && Objects.equals(this.properties, page.properties) && Objects.equals(this.parent, page.parent) && Objects.equals(this.url, page.url) && Objects.equals(this.icon, page.icon) && Objects.equals(this.cover, page.cover); } @Override public int hashCode() { return Objects.hash(_object, id, createdTime, createdBy, lastEditedTime, lastEditedBy, archived, properties, parent, url, icon, cover); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Page {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" createdTime: ").append(toIndentedString(createdTime)).append("\n"); sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); sb.append(" lastEditedTime: ").append(toIndentedString(lastEditedTime)).append("\n"); sb.append(" lastEditedBy: ").append(toIndentedString(lastEditedBy)).append("\n"); sb.append(" archived: ").append(toIndentedString(archived)).append("\n"); sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); sb.append(" parent: ").append(toIndentedString(parent)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).append("\n"); sb.append(" icon: ").append(toIndentedString(icon)).append("\n"); sb.append(" cover: ").append(toIndentedString(cover)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id", "created_time", "created_by", "last_edited_time", "last_edited_by", "archived", "properties", "parent", "url", "icon", "cover")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 Page */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!Page.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in Page is not found in the empty JSON string", Page.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!Page.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Page` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the optional field `created_by` if (jsonObj.get("created_by") != null && !jsonObj.get("created_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("created_by")); } // validate the optional field `last_edited_by` if (jsonObj.get("last_edited_by") != null && !jsonObj.get("last_edited_by").isJsonNull()) { User.validateJsonElement(jsonObj.get("last_edited_by")); } // validate the optional field `parent` if (jsonObj.get("parent") != null && !jsonObj.get("parent").isJsonNull()) { Parent.validateJsonElement(jsonObj.get("parent")); } 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())); } // validate the optional field `icon` if (jsonObj.get("icon") != null && !jsonObj.get("icon").isJsonNull()) { Icon.validateJsonElement(jsonObj.get("icon")); } // validate the optional field `cover` if (jsonObj.get("cover") != null && !jsonObj.get("cover").isJsonNull()) { Cover.validateJsonElement(jsonObj.get("cover")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Page.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Page' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<Page> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(Page.class)); return (TypeAdapter<T>) new TypeAdapter<Page>() { @Override public void write(JsonWriter out, Page value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public Page read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of Page given an JSON string * * @param jsonString JSON string * @return An instance of Page * @throws IOException if the JSON string is invalid with respect to Page */ public static Page fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Page.class); } /** * Convert an instance of Page to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PaginatedList.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PaginatedList */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PaginatedList { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { LIST("list"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_RESULTS = "results"; @SerializedName(SERIALIZED_NAME_RESULTS) @javax.annotation.Nullable private List<Object> results = new ArrayList<>(); public static final String SERIALIZED_NAME_NEXT_CURSOR = "next_cursor"; @SerializedName(SERIALIZED_NAME_NEXT_CURSOR) @javax.annotation.Nullable private String nextCursor; public static final String SERIALIZED_NAME_HAS_MORE = "has_more"; @SerializedName(SERIALIZED_NAME_HAS_MORE) @javax.annotation.Nullable private Boolean hasMore; public PaginatedList() { } public PaginatedList _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public PaginatedList results(@javax.annotation.Nullable List<Object> results) { this.results = results; return this; } public PaginatedList addResultsItem(Object resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } this.results.add(resultsItem); return this; } /** * Get results * @return results */ @javax.annotation.Nullable public List<Object> getResults() { return results; } public void setResults(@javax.annotation.Nullable List<Object> results) { this.results = results; } public PaginatedList nextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; return this; } /** * 下一页游标,使用最后一个项目的ID作为游标值 * @return nextCursor */ @javax.annotation.Nullable public String getNextCursor() { return nextCursor; } public void setNextCursor(@javax.annotation.Nullable String nextCursor) { this.nextCursor = nextCursor; } public PaginatedList hasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; return this; } /** * Get hasMore * @return hasMore */ @javax.annotation.Nullable public Boolean getHasMore() { return hasMore; } public void setHasMore(@javax.annotation.Nullable Boolean hasMore) { this.hasMore = hasMore; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PaginatedList paginatedList = (PaginatedList) o; return Objects.equals(this._object, paginatedList._object) && Objects.equals(this.results, paginatedList.results) && Objects.equals(this.nextCursor, paginatedList.nextCursor) && Objects.equals(this.hasMore, paginatedList.hasMore); } @Override public int hashCode() { return Objects.hash(_object, results, nextCursor, hasMore); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PaginatedList {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" results: ").append(toIndentedString(results)).append("\n"); sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).append("\n"); sb.append(" hasMore: ").append(toIndentedString(hasMore)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "results", "next_cursor", "has_more")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PaginatedList */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PaginatedList.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PaginatedList is not found in the empty JSON string", PaginatedList.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PaginatedList.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PaginatedList` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } // ensure the optional json data is an array if present if (jsonObj.get("results") != null && !jsonObj.get("results").isJsonNull() && !jsonObj.get("results").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `results` to be an array in the JSON string but got `%s`", jsonObj.get("results").toString())); } if ((jsonObj.get("next_cursor") != null && !jsonObj.get("next_cursor").isJsonNull()) && !jsonObj.get("next_cursor").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `next_cursor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("next_cursor").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PaginatedList.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PaginatedList' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PaginatedList> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PaginatedList.class)); return (TypeAdapter<T>) new TypeAdapter<PaginatedList>() { @Override public void write(JsonWriter out, PaginatedList value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PaginatedList read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PaginatedList given an JSON string * * @param jsonString JSON string * @return An instance of PaginatedList * @throws IOException if the JSON string is invalid with respect to PaginatedList */ public static PaginatedList fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PaginatedList.class); } /** * Convert an instance of PaginatedList to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/Parent.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; import org.openapitools.client.model.ParentBlockId; import org.openapitools.client.model.ParentDatabaseId; import org.openapitools.client.model.ParentPageId; import org.openapitools.client.model.ParentSpaceId; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class Parent extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(Parent.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!Parent.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'Parent' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<ParentDatabaseId> adapterParentDatabaseId = gson.getDelegateAdapter(this, TypeToken.get(ParentDatabaseId.class)); final TypeAdapter<ParentPageId> adapterParentPageId = gson.getDelegateAdapter(this, TypeToken.get(ParentPageId.class)); final TypeAdapter<ParentBlockId> adapterParentBlockId = gson.getDelegateAdapter(this, TypeToken.get(ParentBlockId.class)); final TypeAdapter<ParentSpaceId> adapterParentSpaceId = gson.getDelegateAdapter(this, TypeToken.get(ParentSpaceId.class)); return (TypeAdapter<T>) new TypeAdapter<Parent>() { @Override public void write(JsonWriter out, Parent value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `ParentDatabaseId` if (value.getActualInstance() instanceof ParentDatabaseId) { JsonElement element = adapterParentDatabaseId.toJsonTree((ParentDatabaseId)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `ParentPageId` if (value.getActualInstance() instanceof ParentPageId) { JsonElement element = adapterParentPageId.toJsonTree((ParentPageId)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `ParentBlockId` if (value.getActualInstance() instanceof ParentBlockId) { JsonElement element = adapterParentBlockId.toJsonTree((ParentBlockId)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `ParentSpaceId` if (value.getActualInstance() instanceof ParentSpaceId) { JsonElement element = adapterParentSpaceId.toJsonTree((ParentSpaceId)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId"); } @Override public Parent read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); int match = 0; ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize ParentDatabaseId try { // validate the JSON object to see if any exception is thrown ParentDatabaseId.validateJsonElement(jsonElement); actualAdapter = adapterParentDatabaseId; match++; log.log(Level.FINER, "Input data matches schema 'ParentDatabaseId'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for ParentDatabaseId failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'ParentDatabaseId'", e); } // deserialize ParentPageId try { // validate the JSON object to see if any exception is thrown ParentPageId.validateJsonElement(jsonElement); actualAdapter = adapterParentPageId; match++; log.log(Level.FINER, "Input data matches schema 'ParentPageId'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for ParentPageId failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'ParentPageId'", e); } // deserialize ParentBlockId try { // validate the JSON object to see if any exception is thrown ParentBlockId.validateJsonElement(jsonElement); actualAdapter = adapterParentBlockId; match++; log.log(Level.FINER, "Input data matches schema 'ParentBlockId'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for ParentBlockId failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'ParentBlockId'", e); } // deserialize ParentSpaceId try { // validate the JSON object to see if any exception is thrown ParentSpaceId.validateJsonElement(jsonElement); actualAdapter = adapterParentSpaceId; match++; log.log(Level.FINER, "Input data matches schema 'ParentSpaceId'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for ParentSpaceId failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'ParentSpaceId'", e); } if (match == 1) { Parent ret = new Parent(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } throw new IOException(String.format("Failed deserialization for Parent: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in oneOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public Parent() { super("oneOf", Boolean.FALSE); } public Parent(Object o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("ParentDatabaseId", ParentDatabaseId.class); schemas.put("ParentPageId", ParentPageId.class); schemas.put("ParentBlockId", ParentBlockId.class); schemas.put("ParentSpaceId", ParentSpaceId.class); } @Override public Map<String, Class<?>> getSchemas() { return Parent.schemas; } /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: * ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId * * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof ParentDatabaseId) { super.setActualInstance(instance); return; } if (instance instanceof ParentPageId) { super.setActualInstance(instance); return; } if (instance instanceof ParentBlockId) { super.setActualInstance(instance); return; } if (instance instanceof ParentSpaceId) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId"); } /** * Get the actual instance, which can be the following: * ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId * * @return The actual instance (ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `ParentDatabaseId`. If the actual instance is not `ParentDatabaseId`, * the ClassCastException will be thrown. * * @return The actual instance of `ParentDatabaseId` * @throws ClassCastException if the instance is not `ParentDatabaseId` */ public ParentDatabaseId getParentDatabaseId() throws ClassCastException { return (ParentDatabaseId)super.getActualInstance(); } /** * Get the actual instance of `ParentPageId`. If the actual instance is not `ParentPageId`, * the ClassCastException will be thrown. * * @return The actual instance of `ParentPageId` * @throws ClassCastException if the instance is not `ParentPageId` */ public ParentPageId getParentPageId() throws ClassCastException { return (ParentPageId)super.getActualInstance(); } /** * Get the actual instance of `ParentBlockId`. If the actual instance is not `ParentBlockId`, * the ClassCastException will be thrown. * * @return The actual instance of `ParentBlockId` * @throws ClassCastException if the instance is not `ParentBlockId` */ public ParentBlockId getParentBlockId() throws ClassCastException { return (ParentBlockId)super.getActualInstance(); } /** * Get the actual instance of `ParentSpaceId`. If the actual instance is not `ParentSpaceId`, * the ClassCastException will be thrown. * * @return The actual instance of `ParentSpaceId` * @throws ClassCastException if the instance is not `ParentSpaceId` */ public ParentSpaceId getParentSpaceId() throws ClassCastException { return (ParentSpaceId)super.getActualInstance(); } /** * 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 Parent */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate oneOf schemas one by one int validCount = 0; ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with ParentDatabaseId try { ParentDatabaseId.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for ParentDatabaseId failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with ParentPageId try { ParentPageId.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for ParentPageId failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with ParentBlockId try { ParentBlockId.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for ParentBlockId failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with ParentSpaceId try { ParentSpaceId.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for ParentSpaceId failed with `%s`.", e.getMessage())); // continue to the next one } if (validCount != 1) { throw new IOException(String.format("The JSON string is invalid for Parent with oneOf schemas: ParentBlockId, ParentDatabaseId, ParentPageId, ParentSpaceId. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } /** * Create an instance of Parent given an JSON string * * @param jsonString JSON string * @return An instance of Parent * @throws IOException if the JSON string is invalid with respect to Parent */ public static Parent fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, Parent.class); } /** * Convert an instance of Parent to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/ParentBlockId.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * ParentBlockId */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ParentBlockId { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { BLOCK_ID("block_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_BLOCK_ID = "block_id"; @SerializedName(SERIALIZED_NAME_BLOCK_ID) @javax.annotation.Nonnull private UUID blockId; public ParentBlockId() { } public ParentBlockId type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public ParentBlockId blockId(@javax.annotation.Nonnull UUID blockId) { this.blockId = blockId; return this; } /** * Get blockId * @return blockId */ @javax.annotation.Nonnull public UUID getBlockId() { return blockId; } public void setBlockId(@javax.annotation.Nonnull UUID blockId) { this.blockId = blockId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ParentBlockId parentBlockId = (ParentBlockId) o; return Objects.equals(this.type, parentBlockId.type) && Objects.equals(this.blockId, parentBlockId.blockId); } @Override public int hashCode() { return Objects.hash(type, blockId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ParentBlockId {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" blockId: ").append(toIndentedString(blockId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "block_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "block_id")); } /** * 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 ParentBlockId */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ParentBlockId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in ParentBlockId is not found in the empty JSON string", ParentBlockId.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!ParentBlockId.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParentBlockId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ParentBlockId.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("block_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `block_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("block_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!ParentBlockId.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'ParentBlockId' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<ParentBlockId> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ParentBlockId.class)); return (TypeAdapter<T>) new TypeAdapter<ParentBlockId>() { @Override public void write(JsonWriter out, ParentBlockId value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public ParentBlockId read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of ParentBlockId given an JSON string * * @param jsonString JSON string * @return An instance of ParentBlockId * @throws IOException if the JSON string is invalid with respect to ParentBlockId */ public static ParentBlockId fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ParentBlockId.class); } /** * Convert an instance of ParentBlockId to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/ParentDatabaseId.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * ParentDatabaseId */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ParentDatabaseId { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { DATABASE_ID("database_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_DATABASE_ID = "database_id"; @SerializedName(SERIALIZED_NAME_DATABASE_ID) @javax.annotation.Nonnull private UUID databaseId; public ParentDatabaseId() { } public ParentDatabaseId type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public ParentDatabaseId databaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; return this; } /** * Get databaseId * @return databaseId */ @javax.annotation.Nonnull public UUID getDatabaseId() { return databaseId; } public void setDatabaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ParentDatabaseId parentDatabaseId = (ParentDatabaseId) o; return Objects.equals(this.type, parentDatabaseId.type) && Objects.equals(this.databaseId, parentDatabaseId.databaseId); } @Override public int hashCode() { return Objects.hash(type, databaseId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ParentDatabaseId {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" databaseId: ").append(toIndentedString(databaseId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "database_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "database_id")); } /** * 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 ParentDatabaseId */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ParentDatabaseId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in ParentDatabaseId is not found in the empty JSON string", ParentDatabaseId.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!ParentDatabaseId.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParentDatabaseId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ParentDatabaseId.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("database_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `database_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("database_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!ParentDatabaseId.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'ParentDatabaseId' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<ParentDatabaseId> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ParentDatabaseId.class)); return (TypeAdapter<T>) new TypeAdapter<ParentDatabaseId>() { @Override public void write(JsonWriter out, ParentDatabaseId value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public ParentDatabaseId read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of ParentDatabaseId given an JSON string * * @param jsonString JSON string * @return An instance of ParentDatabaseId * @throws IOException if the JSON string is invalid with respect to ParentDatabaseId */ public static ParentDatabaseId fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ParentDatabaseId.class); } /** * Convert an instance of ParentDatabaseId to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/ParentPageId.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * ParentPageId */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ParentPageId { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { PAGE_ID("page_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_PAGE_ID = "page_id"; @SerializedName(SERIALIZED_NAME_PAGE_ID) @javax.annotation.Nonnull private UUID pageId; public ParentPageId() { } public ParentPageId type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public ParentPageId pageId(@javax.annotation.Nonnull UUID pageId) { this.pageId = pageId; return this; } /** * Get pageId * @return pageId */ @javax.annotation.Nonnull public UUID getPageId() { return pageId; } public void setPageId(@javax.annotation.Nonnull UUID pageId) { this.pageId = pageId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ParentPageId parentPageId = (ParentPageId) o; return Objects.equals(this.type, parentPageId.type) && Objects.equals(this.pageId, parentPageId.pageId); } @Override public int hashCode() { return Objects.hash(type, pageId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ParentPageId {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" pageId: ").append(toIndentedString(pageId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "page_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "page_id")); } /** * 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 ParentPageId */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ParentPageId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in ParentPageId is not found in the empty JSON string", ParentPageId.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!ParentPageId.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParentPageId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ParentPageId.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("page_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `page_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("page_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!ParentPageId.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'ParentPageId' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<ParentPageId> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ParentPageId.class)); return (TypeAdapter<T>) new TypeAdapter<ParentPageId>() { @Override public void write(JsonWriter out, ParentPageId value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public ParentPageId read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of ParentPageId given an JSON string * * @param jsonString JSON string * @return An instance of ParentPageId * @throws IOException if the JSON string is invalid with respect to ParentPageId */ public static ParentPageId fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ParentPageId.class); } /** * Convert an instance of ParentPageId to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/ParentSpaceId.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * ParentSpaceId */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class ParentSpaceId { /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { SPACE_ID("space_id"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nonnull private TypeEnum type; public static final String SERIALIZED_NAME_SPACE_ID = "space_id"; @SerializedName(SERIALIZED_NAME_SPACE_ID) @javax.annotation.Nonnull private UUID spaceId; public ParentSpaceId() { } public ParentSpaceId type(@javax.annotation.Nonnull TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nonnull public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nonnull TypeEnum type) { this.type = type; } public ParentSpaceId spaceId(@javax.annotation.Nonnull UUID spaceId) { this.spaceId = spaceId; return this; } /** * Get spaceId * @return spaceId */ @javax.annotation.Nonnull public UUID getSpaceId() { return spaceId; } public void setSpaceId(@javax.annotation.Nonnull UUID spaceId) { this.spaceId = spaceId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ParentSpaceId parentSpaceId = (ParentSpaceId) o; return Objects.equals(this.type, parentSpaceId.type) && Objects.equals(this.spaceId, parentSpaceId.spaceId); } @Override public int hashCode() { return Objects.hash(type, spaceId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ParentSpaceId {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" spaceId: ").append(toIndentedString(spaceId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("type", "space_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "space_id")); } /** * 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 ParentSpaceId */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!ParentSpaceId.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in ParentSpaceId is not found in the empty JSON string", ParentSpaceId.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!ParentSpaceId.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ParentSpaceId` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : ParentSpaceId.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the required field `type` TypeEnum.validateJsonElement(jsonObj.get("type")); if (!jsonObj.get("space_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `space_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("space_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!ParentSpaceId.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'ParentSpaceId' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<ParentSpaceId> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(ParentSpaceId.class)); return (TypeAdapter<T>) new TypeAdapter<ParentSpaceId>() { @Override public void write(JsonWriter out, ParentSpaceId value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public ParentSpaceId read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of ParentSpaceId given an JSON string * * @param jsonString JSON string * @return An instance of ParentSpaceId * @throws IOException if the JSON string is invalid with respect to ParentSpaceId */ public static ParentSpaceId fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, ParentSpaceId.class); } /** * Convert an instance of ParentSpaceId to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchema.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaCheckbox; import org.openapitools.client.model.PropertySchemaDate; import org.openapitools.client.model.PropertySchemaEmail; import org.openapitools.client.model.PropertySchemaFiles; import org.openapitools.client.model.PropertySchemaFormula; import org.openapitools.client.model.PropertySchemaFormulaFormula; import org.openapitools.client.model.PropertySchemaMultiSelect; import org.openapitools.client.model.PropertySchemaNumber; import org.openapitools.client.model.PropertySchemaNumberNumber; import org.openapitools.client.model.PropertySchemaPeople; import org.openapitools.client.model.PropertySchemaPhoneNumber; import org.openapitools.client.model.PropertySchemaRelation; import org.openapitools.client.model.PropertySchemaRelationRelation; import org.openapitools.client.model.PropertySchemaRichText; import org.openapitools.client.model.PropertySchemaSelect; import org.openapitools.client.model.PropertySchemaSelectSelect; import org.openapitools.client.model.PropertySchemaTitle; import org.openapitools.client.model.PropertySchemaUrl; import org.openapitools.jackson.nullable.JsonNullable; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchema extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(PropertySchema.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchema.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchema' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaTitle> adapterPropertySchemaTitle = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaTitle.class)); final TypeAdapter<PropertySchemaRichText> adapterPropertySchemaRichText = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaRichText.class)); final TypeAdapter<PropertySchemaNumber> adapterPropertySchemaNumber = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaNumber.class)); final TypeAdapter<PropertySchemaSelect> adapterPropertySchemaSelect = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaSelect.class)); final TypeAdapter<PropertySchemaMultiSelect> adapterPropertySchemaMultiSelect = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaMultiSelect.class)); final TypeAdapter<PropertySchemaDate> adapterPropertySchemaDate = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaDate.class)); final TypeAdapter<PropertySchemaPeople> adapterPropertySchemaPeople = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaPeople.class)); final TypeAdapter<PropertySchemaFiles> adapterPropertySchemaFiles = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaFiles.class)); final TypeAdapter<PropertySchemaCheckbox> adapterPropertySchemaCheckbox = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaCheckbox.class)); final TypeAdapter<PropertySchemaUrl> adapterPropertySchemaUrl = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaUrl.class)); final TypeAdapter<PropertySchemaEmail> adapterPropertySchemaEmail = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaEmail.class)); final TypeAdapter<PropertySchemaPhoneNumber> adapterPropertySchemaPhoneNumber = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaPhoneNumber.class)); final TypeAdapter<PropertySchemaFormula> adapterPropertySchemaFormula = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaFormula.class)); final TypeAdapter<PropertySchemaRelation> adapterPropertySchemaRelation = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaRelation.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchema>() { @Override public void write(JsonWriter out, PropertySchema value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `PropertySchemaTitle` if (value.getActualInstance() instanceof PropertySchemaTitle) { JsonElement element = adapterPropertySchemaTitle.toJsonTree((PropertySchemaTitle)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaRichText` if (value.getActualInstance() instanceof PropertySchemaRichText) { JsonElement element = adapterPropertySchemaRichText.toJsonTree((PropertySchemaRichText)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaNumber` if (value.getActualInstance() instanceof PropertySchemaNumber) { JsonElement element = adapterPropertySchemaNumber.toJsonTree((PropertySchemaNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaSelect` if (value.getActualInstance() instanceof PropertySchemaSelect) { JsonElement element = adapterPropertySchemaSelect.toJsonTree((PropertySchemaSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaMultiSelect` if (value.getActualInstance() instanceof PropertySchemaMultiSelect) { JsonElement element = adapterPropertySchemaMultiSelect.toJsonTree((PropertySchemaMultiSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaDate` if (value.getActualInstance() instanceof PropertySchemaDate) { JsonElement element = adapterPropertySchemaDate.toJsonTree((PropertySchemaDate)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaPeople` if (value.getActualInstance() instanceof PropertySchemaPeople) { JsonElement element = adapterPropertySchemaPeople.toJsonTree((PropertySchemaPeople)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaFiles` if (value.getActualInstance() instanceof PropertySchemaFiles) { JsonElement element = adapterPropertySchemaFiles.toJsonTree((PropertySchemaFiles)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaCheckbox` if (value.getActualInstance() instanceof PropertySchemaCheckbox) { JsonElement element = adapterPropertySchemaCheckbox.toJsonTree((PropertySchemaCheckbox)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaUrl` if (value.getActualInstance() instanceof PropertySchemaUrl) { JsonElement element = adapterPropertySchemaUrl.toJsonTree((PropertySchemaUrl)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaEmail` if (value.getActualInstance() instanceof PropertySchemaEmail) { JsonElement element = adapterPropertySchemaEmail.toJsonTree((PropertySchemaEmail)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaPhoneNumber` if (value.getActualInstance() instanceof PropertySchemaPhoneNumber) { JsonElement element = adapterPropertySchemaPhoneNumber.toJsonTree((PropertySchemaPhoneNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaFormula` if (value.getActualInstance() instanceof PropertySchemaFormula) { JsonElement element = adapterPropertySchemaFormula.toJsonTree((PropertySchemaFormula)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertySchemaRelation` if (value.getActualInstance() instanceof PropertySchemaRelation) { JsonElement element = adapterPropertySchemaRelation.toJsonTree((PropertySchemaRelation)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl"); } @Override public PropertySchema read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize PropertySchemaTitle try { // validate the JSON object to see if any exception is thrown PropertySchemaTitle.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaTitle; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaTitle failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaTitle'", e); } // deserialize PropertySchemaRichText try { // validate the JSON object to see if any exception is thrown PropertySchemaRichText.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaRichText; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaRichText failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaRichText'", e); } // deserialize PropertySchemaNumber try { // validate the JSON object to see if any exception is thrown PropertySchemaNumber.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaNumber; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaNumber'", e); } // deserialize PropertySchemaSelect try { // validate the JSON object to see if any exception is thrown PropertySchemaSelect.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaSelect; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaSelect'", e); } // deserialize PropertySchemaMultiSelect try { // validate the JSON object to see if any exception is thrown PropertySchemaMultiSelect.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaMultiSelect; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaMultiSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaMultiSelect'", e); } // deserialize PropertySchemaDate try { // validate the JSON object to see if any exception is thrown PropertySchemaDate.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaDate; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaDate failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaDate'", e); } // deserialize PropertySchemaPeople try { // validate the JSON object to see if any exception is thrown PropertySchemaPeople.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaPeople; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaPeople failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaPeople'", e); } // deserialize PropertySchemaFiles try { // validate the JSON object to see if any exception is thrown PropertySchemaFiles.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaFiles; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaFiles failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaFiles'", e); } // deserialize PropertySchemaCheckbox try { // validate the JSON object to see if any exception is thrown PropertySchemaCheckbox.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaCheckbox; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaCheckbox failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaCheckbox'", e); } // deserialize PropertySchemaUrl try { // validate the JSON object to see if any exception is thrown PropertySchemaUrl.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaUrl; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaUrl failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaUrl'", e); } // deserialize PropertySchemaEmail try { // validate the JSON object to see if any exception is thrown PropertySchemaEmail.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaEmail; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaEmail failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaEmail'", e); } // deserialize PropertySchemaPhoneNumber try { // validate the JSON object to see if any exception is thrown PropertySchemaPhoneNumber.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaPhoneNumber; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaPhoneNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaPhoneNumber'", e); } // deserialize PropertySchemaFormula try { // validate the JSON object to see if any exception is thrown PropertySchemaFormula.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaFormula; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaFormula failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaFormula'", e); } // deserialize PropertySchemaRelation try { // validate the JSON object to see if any exception is thrown PropertySchemaRelation.validateJsonElement(jsonElement); actualAdapter = adapterPropertySchemaRelation; PropertySchema ret = new PropertySchema(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertySchemaRelation failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertySchemaRelation'", e); } throw new IOException(String.format("Failed deserialization for PropertySchema: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in anyOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public PropertySchema() { super("anyOf", Boolean.FALSE); } public PropertySchema(Object o) { super("anyOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("PropertySchemaTitle", PropertySchemaTitle.class); schemas.put("PropertySchemaRichText", PropertySchemaRichText.class); schemas.put("PropertySchemaNumber", PropertySchemaNumber.class); schemas.put("PropertySchemaSelect", PropertySchemaSelect.class); schemas.put("PropertySchemaMultiSelect", PropertySchemaMultiSelect.class); schemas.put("PropertySchemaDate", PropertySchemaDate.class); schemas.put("PropertySchemaPeople", PropertySchemaPeople.class); schemas.put("PropertySchemaFiles", PropertySchemaFiles.class); schemas.put("PropertySchemaCheckbox", PropertySchemaCheckbox.class); schemas.put("PropertySchemaUrl", PropertySchemaUrl.class); schemas.put("PropertySchemaEmail", PropertySchemaEmail.class); schemas.put("PropertySchemaPhoneNumber", PropertySchemaPhoneNumber.class); schemas.put("PropertySchemaFormula", PropertySchemaFormula.class); schemas.put("PropertySchemaRelation", PropertySchemaRelation.class); } @Override public Map<String, Class<?>> getSchemas() { return PropertySchema.schemas; } /** * Set the instance that matches the anyOf child schema, check * the instance parameter is valid against the anyOf child schemas: * PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl * * It could be an instance of the 'anyOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof PropertySchemaTitle) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaRichText) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaNumber) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaSelect) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaMultiSelect) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaDate) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaPeople) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaFiles) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaCheckbox) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaUrl) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaEmail) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaPhoneNumber) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaFormula) { super.setActualInstance(instance); return; } if (instance instanceof PropertySchemaRelation) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl"); } /** * Get the actual instance, which can be the following: * PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl * * @return The actual instance (PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaTitle`. If the actual instance is not `PropertySchemaTitle`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaTitle` * @throws ClassCastException if the instance is not `PropertySchemaTitle` */ public PropertySchemaTitle getPropertySchemaTitle() throws ClassCastException { return (PropertySchemaTitle)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaRichText`. If the actual instance is not `PropertySchemaRichText`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaRichText` * @throws ClassCastException if the instance is not `PropertySchemaRichText` */ public PropertySchemaRichText getPropertySchemaRichText() throws ClassCastException { return (PropertySchemaRichText)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaNumber`. If the actual instance is not `PropertySchemaNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaNumber` * @throws ClassCastException if the instance is not `PropertySchemaNumber` */ public PropertySchemaNumber getPropertySchemaNumber() throws ClassCastException { return (PropertySchemaNumber)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaSelect`. If the actual instance is not `PropertySchemaSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaSelect` * @throws ClassCastException if the instance is not `PropertySchemaSelect` */ public PropertySchemaSelect getPropertySchemaSelect() throws ClassCastException { return (PropertySchemaSelect)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaMultiSelect`. If the actual instance is not `PropertySchemaMultiSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaMultiSelect` * @throws ClassCastException if the instance is not `PropertySchemaMultiSelect` */ public PropertySchemaMultiSelect getPropertySchemaMultiSelect() throws ClassCastException { return (PropertySchemaMultiSelect)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaDate`. If the actual instance is not `PropertySchemaDate`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaDate` * @throws ClassCastException if the instance is not `PropertySchemaDate` */ public PropertySchemaDate getPropertySchemaDate() throws ClassCastException { return (PropertySchemaDate)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaPeople`. If the actual instance is not `PropertySchemaPeople`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaPeople` * @throws ClassCastException if the instance is not `PropertySchemaPeople` */ public PropertySchemaPeople getPropertySchemaPeople() throws ClassCastException { return (PropertySchemaPeople)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaFiles`. If the actual instance is not `PropertySchemaFiles`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaFiles` * @throws ClassCastException if the instance is not `PropertySchemaFiles` */ public PropertySchemaFiles getPropertySchemaFiles() throws ClassCastException { return (PropertySchemaFiles)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaCheckbox`. If the actual instance is not `PropertySchemaCheckbox`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaCheckbox` * @throws ClassCastException if the instance is not `PropertySchemaCheckbox` */ public PropertySchemaCheckbox getPropertySchemaCheckbox() throws ClassCastException { return (PropertySchemaCheckbox)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaUrl`. If the actual instance is not `PropertySchemaUrl`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaUrl` * @throws ClassCastException if the instance is not `PropertySchemaUrl` */ public PropertySchemaUrl getPropertySchemaUrl() throws ClassCastException { return (PropertySchemaUrl)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaEmail`. If the actual instance is not `PropertySchemaEmail`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaEmail` * @throws ClassCastException if the instance is not `PropertySchemaEmail` */ public PropertySchemaEmail getPropertySchemaEmail() throws ClassCastException { return (PropertySchemaEmail)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaPhoneNumber`. If the actual instance is not `PropertySchemaPhoneNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaPhoneNumber` * @throws ClassCastException if the instance is not `PropertySchemaPhoneNumber` */ public PropertySchemaPhoneNumber getPropertySchemaPhoneNumber() throws ClassCastException { return (PropertySchemaPhoneNumber)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaFormula`. If the actual instance is not `PropertySchemaFormula`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaFormula` * @throws ClassCastException if the instance is not `PropertySchemaFormula` */ public PropertySchemaFormula getPropertySchemaFormula() throws ClassCastException { return (PropertySchemaFormula)super.getActualInstance(); } /** * Get the actual instance of `PropertySchemaRelation`. If the actual instance is not `PropertySchemaRelation`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertySchemaRelation` * @throws ClassCastException if the instance is not `PropertySchemaRelation` */ public PropertySchemaRelation getPropertySchemaRelation() throws ClassCastException { return (PropertySchemaRelation)super.getActualInstance(); } /** * 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 PropertySchema */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate anyOf schemas one by one ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with PropertySchemaTitle try { PropertySchemaTitle.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaTitle failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaRichText try { PropertySchemaRichText.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaRichText failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaNumber try { PropertySchemaNumber.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaSelect try { PropertySchemaSelect.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaMultiSelect try { PropertySchemaMultiSelect.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaMultiSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaDate try { PropertySchemaDate.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaDate failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaPeople try { PropertySchemaPeople.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaPeople failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaFiles try { PropertySchemaFiles.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaFiles failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaCheckbox try { PropertySchemaCheckbox.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaCheckbox failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaUrl try { PropertySchemaUrl.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaUrl failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaEmail try { PropertySchemaEmail.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaEmail failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaPhoneNumber try { PropertySchemaPhoneNumber.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaPhoneNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaFormula try { PropertySchemaFormula.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaFormula failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertySchemaRelation try { PropertySchemaRelation.validateJsonElement(jsonElement); return; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertySchemaRelation failed with `%s`.", e.getMessage())); // continue to the next one } throw new IOException(String.format("The JSON string is invalid for PropertySchema with anyOf schemas: PropertySchemaCheckbox, PropertySchemaDate, PropertySchemaEmail, PropertySchemaFiles, PropertySchemaFormula, PropertySchemaMultiSelect, PropertySchemaNumber, PropertySchemaPeople, PropertySchemaPhoneNumber, PropertySchemaRelation, PropertySchemaRichText, PropertySchemaSelect, PropertySchemaTitle, PropertySchemaUrl. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); } /** * Create an instance of PropertySchema given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchema * @throws IOException if the JSON string is invalid with respect to PropertySchema */ public static PropertySchema fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchema.class); } /** * Convert an instance of PropertySchema to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaCheckbox.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaCheckbox */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaCheckbox { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_CHECKBOX = "checkbox"; @SerializedName(SERIALIZED_NAME_CHECKBOX) @javax.annotation.Nullable private Object checkbox; public PropertySchemaCheckbox() { } public PropertySchemaCheckbox id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaCheckbox name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaCheckbox type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaCheckbox checkbox(@javax.annotation.Nullable Object checkbox) { this.checkbox = checkbox; return this; } /** * Get checkbox * @return checkbox */ @javax.annotation.Nullable public Object getCheckbox() { return checkbox; } public void setCheckbox(@javax.annotation.Nullable Object checkbox) { this.checkbox = checkbox; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaCheckbox propertySchemaCheckbox = (PropertySchemaCheckbox) o; return Objects.equals(this.id, propertySchemaCheckbox.id) && Objects.equals(this.name, propertySchemaCheckbox.name) && Objects.equals(this.type, propertySchemaCheckbox.type) && Objects.equals(this.checkbox, propertySchemaCheckbox.checkbox); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, checkbox); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaCheckbox {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" checkbox: ").append(toIndentedString(checkbox)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "checkbox")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaCheckbox */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaCheckbox.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaCheckbox is not found in the empty JSON string", PropertySchemaCheckbox.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaCheckbox.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaCheckbox` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaCheckbox.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaCheckbox' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaCheckbox> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaCheckbox.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaCheckbox>() { @Override public void write(JsonWriter out, PropertySchemaCheckbox value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaCheckbox read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaCheckbox given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaCheckbox * @throws IOException if the JSON string is invalid with respect to PropertySchemaCheckbox */ public static PropertySchemaCheckbox fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaCheckbox.class); } /** * Convert an instance of PropertySchemaCheckbox to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaDate.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaDate */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaDate { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) @javax.annotation.Nullable private Object date; public PropertySchemaDate() { } public PropertySchemaDate id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaDate name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaDate type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaDate date(@javax.annotation.Nullable Object date) { this.date = date; return this; } /** * Get date * @return date */ @javax.annotation.Nullable public Object getDate() { return date; } public void setDate(@javax.annotation.Nullable Object date) { this.date = date; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaDate propertySchemaDate = (PropertySchemaDate) o; return Objects.equals(this.id, propertySchemaDate.id) && Objects.equals(this.name, propertySchemaDate.name) && Objects.equals(this.type, propertySchemaDate.type) && Objects.equals(this.date, propertySchemaDate.date); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, date); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaDate {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "date")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaDate */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaDate is not found in the empty JSON string", PropertySchemaDate.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaDate.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaDate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaDate.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaDate' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaDate> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaDate.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaDate>() { @Override public void write(JsonWriter out, PropertySchemaDate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaDate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaDate given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaDate * @throws IOException if the JSON string is invalid with respect to PropertySchemaDate */ public static PropertySchemaDate fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaDate.class); } /** * Convert an instance of PropertySchemaDate to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaEmail.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaEmail */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaEmail { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @javax.annotation.Nullable private Object email; public PropertySchemaEmail() { } public PropertySchemaEmail id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaEmail name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaEmail type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaEmail email(@javax.annotation.Nullable Object email) { this.email = email; return this; } /** * Get email * @return email */ @javax.annotation.Nullable public Object getEmail() { return email; } public void setEmail(@javax.annotation.Nullable Object email) { this.email = email; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaEmail propertySchemaEmail = (PropertySchemaEmail) o; return Objects.equals(this.id, propertySchemaEmail.id) && Objects.equals(this.name, propertySchemaEmail.name) && Objects.equals(this.type, propertySchemaEmail.type) && Objects.equals(this.email, propertySchemaEmail.email); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, email); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaEmail {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "email")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaEmail */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaEmail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaEmail is not found in the empty JSON string", PropertySchemaEmail.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaEmail.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaEmail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaEmail.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaEmail' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaEmail> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaEmail.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaEmail>() { @Override public void write(JsonWriter out, PropertySchemaEmail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaEmail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaEmail given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaEmail * @throws IOException if the JSON string is invalid with respect to PropertySchemaEmail */ public static PropertySchemaEmail fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaEmail.class); } /** * Convert an instance of PropertySchemaEmail to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaFiles.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaFiles */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaFiles { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_FILES = "files"; @SerializedName(SERIALIZED_NAME_FILES) @javax.annotation.Nullable private Object files; public PropertySchemaFiles() { } public PropertySchemaFiles id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaFiles name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaFiles type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaFiles files(@javax.annotation.Nullable Object files) { this.files = files; return this; } /** * Get files * @return files */ @javax.annotation.Nullable public Object getFiles() { return files; } public void setFiles(@javax.annotation.Nullable Object files) { this.files = files; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaFiles propertySchemaFiles = (PropertySchemaFiles) o; return Objects.equals(this.id, propertySchemaFiles.id) && Objects.equals(this.name, propertySchemaFiles.name) && Objects.equals(this.type, propertySchemaFiles.type) && Objects.equals(this.files, propertySchemaFiles.files); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, files); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaFiles {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" files: ").append(toIndentedString(files)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "files")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaFiles */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaFiles.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaFiles is not found in the empty JSON string", PropertySchemaFiles.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaFiles.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaFiles` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaFiles.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaFiles' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaFiles> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaFiles.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaFiles>() { @Override public void write(JsonWriter out, PropertySchemaFiles value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaFiles read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaFiles given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaFiles * @throws IOException if the JSON string is invalid with respect to PropertySchemaFiles */ public static PropertySchemaFiles fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaFiles.class); } /** * Convert an instance of PropertySchemaFiles to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaFormula.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaFormulaFormula; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaFormula */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaFormula { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_FORMULA = "formula"; @SerializedName(SERIALIZED_NAME_FORMULA) @javax.annotation.Nullable private PropertySchemaFormulaFormula formula; public PropertySchemaFormula() { } public PropertySchemaFormula id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaFormula name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaFormula type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaFormula formula(@javax.annotation.Nullable PropertySchemaFormulaFormula formula) { this.formula = formula; return this; } /** * Get formula * @return formula */ @javax.annotation.Nullable public PropertySchemaFormulaFormula getFormula() { return formula; } public void setFormula(@javax.annotation.Nullable PropertySchemaFormulaFormula formula) { this.formula = formula; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaFormula propertySchemaFormula = (PropertySchemaFormula) o; return Objects.equals(this.id, propertySchemaFormula.id) && Objects.equals(this.name, propertySchemaFormula.name) && Objects.equals(this.type, propertySchemaFormula.type) && Objects.equals(this.formula, propertySchemaFormula.formula); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, formula); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaFormula {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" formula: ").append(toIndentedString(formula)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "formula")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaFormula */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaFormula.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaFormula is not found in the empty JSON string", PropertySchemaFormula.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaFormula.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaFormula` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // validate the optional field `formula` if (jsonObj.get("formula") != null && !jsonObj.get("formula").isJsonNull()) { PropertySchemaFormulaFormula.validateJsonElement(jsonObj.get("formula")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaFormula.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaFormula' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaFormula> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaFormula.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaFormula>() { @Override public void write(JsonWriter out, PropertySchemaFormula value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaFormula read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaFormula given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaFormula * @throws IOException if the JSON string is invalid with respect to PropertySchemaFormula */ public static PropertySchemaFormula fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaFormula.class); } /** * Convert an instance of PropertySchemaFormula to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaFormulaFormula.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaFormulaFormula */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaFormulaFormula { public static final String SERIALIZED_NAME_EXPRESSION = "expression"; @SerializedName(SERIALIZED_NAME_EXPRESSION) @javax.annotation.Nonnull private String expression; public PropertySchemaFormulaFormula() { } public PropertySchemaFormulaFormula expression(@javax.annotation.Nonnull String expression) { this.expression = expression; return this; } /** * 公式表达式 * @return expression */ @javax.annotation.Nonnull public String getExpression() { return expression; } public void setExpression(@javax.annotation.Nonnull String expression) { this.expression = expression; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaFormulaFormula propertySchemaFormulaFormula = (PropertySchemaFormulaFormula) o; return Objects.equals(this.expression, propertySchemaFormulaFormula.expression); } @Override public int hashCode() { return Objects.hash(expression); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertySchemaFormulaFormula {\n"); sb.append(" expression: ").append(toIndentedString(expression)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("expression")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("expression")); } /** * 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 PropertySchemaFormulaFormula */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaFormulaFormula.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaFormulaFormula is not found in the empty JSON string", PropertySchemaFormulaFormula.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaFormulaFormula.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaFormulaFormula` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertySchemaFormulaFormula.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("expression").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `expression` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expression").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaFormulaFormula.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaFormulaFormula' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaFormulaFormula> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaFormulaFormula.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaFormulaFormula>() { @Override public void write(JsonWriter out, PropertySchemaFormulaFormula value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaFormulaFormula read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaFormulaFormula given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaFormulaFormula * @throws IOException if the JSON string is invalid with respect to PropertySchemaFormulaFormula */ public static PropertySchemaFormulaFormula fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaFormulaFormula.class); } /** * Convert an instance of PropertySchemaFormulaFormula to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaMultiSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaSelectSelect; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaMultiSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaMultiSelect { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_MULTI_SELECT = "multi_select"; @SerializedName(SERIALIZED_NAME_MULTI_SELECT) @javax.annotation.Nullable private PropertySchemaSelectSelect multiSelect; public PropertySchemaMultiSelect() { } public PropertySchemaMultiSelect id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaMultiSelect name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaMultiSelect type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaMultiSelect multiSelect(@javax.annotation.Nullable PropertySchemaSelectSelect multiSelect) { this.multiSelect = multiSelect; return this; } /** * Get multiSelect * @return multiSelect */ @javax.annotation.Nullable public PropertySchemaSelectSelect getMultiSelect() { return multiSelect; } public void setMultiSelect(@javax.annotation.Nullable PropertySchemaSelectSelect multiSelect) { this.multiSelect = multiSelect; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaMultiSelect propertySchemaMultiSelect = (PropertySchemaMultiSelect) o; return Objects.equals(this.id, propertySchemaMultiSelect.id) && Objects.equals(this.name, propertySchemaMultiSelect.name) && Objects.equals(this.type, propertySchemaMultiSelect.type) && Objects.equals(this.multiSelect, propertySchemaMultiSelect.multiSelect); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, multiSelect); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaMultiSelect {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" multiSelect: ").append(toIndentedString(multiSelect)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "multi_select")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaMultiSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaMultiSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaMultiSelect is not found in the empty JSON string", PropertySchemaMultiSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaMultiSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaMultiSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // validate the optional field `multi_select` if (jsonObj.get("multi_select") != null && !jsonObj.get("multi_select").isJsonNull()) { PropertySchemaSelectSelect.validateJsonElement(jsonObj.get("multi_select")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaMultiSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaMultiSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaMultiSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaMultiSelect.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaMultiSelect>() { @Override public void write(JsonWriter out, PropertySchemaMultiSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaMultiSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaMultiSelect given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaMultiSelect * @throws IOException if the JSON string is invalid with respect to PropertySchemaMultiSelect */ public static PropertySchemaMultiSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaMultiSelect.class); } /** * Convert an instance of PropertySchemaMultiSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaNumberNumber; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaNumber { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) @javax.annotation.Nullable private PropertySchemaNumberNumber number; public PropertySchemaNumber() { } public PropertySchemaNumber id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaNumber name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaNumber number(@javax.annotation.Nullable PropertySchemaNumberNumber number) { this.number = number; return this; } /** * Get number * @return number */ @javax.annotation.Nullable public PropertySchemaNumberNumber getNumber() { return number; } public void setNumber(@javax.annotation.Nullable PropertySchemaNumberNumber number) { this.number = number; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaNumber propertySchemaNumber = (PropertySchemaNumber) o; return Objects.equals(this.id, propertySchemaNumber.id) && Objects.equals(this.name, propertySchemaNumber.name) && Objects.equals(this.type, propertySchemaNumber.type) && Objects.equals(this.number, propertySchemaNumber.number); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, number); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaNumber {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" number: ").append(toIndentedString(number)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaNumber is not found in the empty JSON string", PropertySchemaNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // validate the optional field `number` if (jsonObj.get("number") != null && !jsonObj.get("number").isJsonNull()) { PropertySchemaNumberNumber.validateJsonElement(jsonObj.get("number")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaNumber.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaNumber>() { @Override public void write(JsonWriter out, PropertySchemaNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaNumber given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaNumber * @throws IOException if the JSON string is invalid with respect to PropertySchemaNumber */ public static PropertySchemaNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaNumber.class); } /** * Convert an instance of PropertySchemaNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaNumberNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaNumberNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaNumberNumber { /** * Gets or Sets format */ @JsonAdapter(FormatEnum.Adapter.class) public enum FormatEnum { NUMBER("number"), NUMBER_WITH_COMMAS("number_with_commas"), PERCENT("percent"), DOLLAR("dollar"), EURO("euro"), POUND("pound"), YEN("yen"), YUAN("yuan"); private String value; FormatEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static FormatEnum fromValue(String value) { for (FormatEnum b : FormatEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<FormatEnum> { @Override public void write(final JsonWriter jsonWriter, final FormatEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public FormatEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return FormatEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); FormatEnum.fromValue(value); } } public static final String SERIALIZED_NAME_FORMAT = "format"; @SerializedName(SERIALIZED_NAME_FORMAT) @javax.annotation.Nullable private FormatEnum format; public PropertySchemaNumberNumber() { } public PropertySchemaNumberNumber format(@javax.annotation.Nullable FormatEnum format) { this.format = format; return this; } /** * Get format * @return format */ @javax.annotation.Nullable public FormatEnum getFormat() { return format; } public void setFormat(@javax.annotation.Nullable FormatEnum format) { this.format = format; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaNumberNumber propertySchemaNumberNumber = (PropertySchemaNumberNumber) o; return Objects.equals(this.format, propertySchemaNumberNumber.format); } @Override public int hashCode() { return Objects.hash(format); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertySchemaNumberNumber {\n"); sb.append(" format: ").append(toIndentedString(format)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("format")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaNumberNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaNumberNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaNumberNumber is not found in the empty JSON string", PropertySchemaNumberNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaNumberNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaNumberNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) && !jsonObj.get("format").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `format` to be a primitive type in the JSON string but got `%s`", jsonObj.get("format").toString())); } // validate the optional field `format` if (jsonObj.get("format") != null && !jsonObj.get("format").isJsonNull()) { FormatEnum.validateJsonElement(jsonObj.get("format")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaNumberNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaNumberNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaNumberNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaNumberNumber.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaNumberNumber>() { @Override public void write(JsonWriter out, PropertySchemaNumberNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaNumberNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaNumberNumber given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaNumberNumber * @throws IOException if the JSON string is invalid with respect to PropertySchemaNumberNumber */ public static PropertySchemaNumberNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaNumberNumber.class); } /** * Convert an instance of PropertySchemaNumberNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaPeople.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaPeople */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaPeople { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PEOPLE = "people"; @SerializedName(SERIALIZED_NAME_PEOPLE) @javax.annotation.Nullable private Object people; public PropertySchemaPeople() { } public PropertySchemaPeople id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaPeople name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaPeople type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaPeople people(@javax.annotation.Nullable Object people) { this.people = people; return this; } /** * Get people * @return people */ @javax.annotation.Nullable public Object getPeople() { return people; } public void setPeople(@javax.annotation.Nullable Object people) { this.people = people; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaPeople propertySchemaPeople = (PropertySchemaPeople) o; return Objects.equals(this.id, propertySchemaPeople.id) && Objects.equals(this.name, propertySchemaPeople.name) && Objects.equals(this.type, propertySchemaPeople.type) && Objects.equals(this.people, propertySchemaPeople.people); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, people); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaPeople {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" people: ").append(toIndentedString(people)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "people")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaPeople */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaPeople.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaPeople is not found in the empty JSON string", PropertySchemaPeople.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaPeople.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaPeople` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaPeople.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaPeople' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaPeople> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaPeople.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaPeople>() { @Override public void write(JsonWriter out, PropertySchemaPeople value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaPeople read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaPeople given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaPeople * @throws IOException if the JSON string is invalid with respect to PropertySchemaPeople */ public static PropertySchemaPeople fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaPeople.class); } /** * Convert an instance of PropertySchemaPeople to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaPhoneNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaPhoneNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaPhoneNumber { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PHONE_NUMBER = "phone_number"; @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) @javax.annotation.Nullable private Object phoneNumber; public PropertySchemaPhoneNumber() { } public PropertySchemaPhoneNumber id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaPhoneNumber name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaPhoneNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaPhoneNumber phoneNumber(@javax.annotation.Nullable Object phoneNumber) { this.phoneNumber = phoneNumber; return this; } /** * Get phoneNumber * @return phoneNumber */ @javax.annotation.Nullable public Object getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(@javax.annotation.Nullable Object phoneNumber) { this.phoneNumber = phoneNumber; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaPhoneNumber propertySchemaPhoneNumber = (PropertySchemaPhoneNumber) o; return Objects.equals(this.id, propertySchemaPhoneNumber.id) && Objects.equals(this.name, propertySchemaPhoneNumber.name) && Objects.equals(this.type, propertySchemaPhoneNumber.type) && Objects.equals(this.phoneNumber, propertySchemaPhoneNumber.phoneNumber); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, phoneNumber); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaPhoneNumber {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "phone_number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaPhoneNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaPhoneNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaPhoneNumber is not found in the empty JSON string", PropertySchemaPhoneNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaPhoneNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaPhoneNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaPhoneNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaPhoneNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaPhoneNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaPhoneNumber.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaPhoneNumber>() { @Override public void write(JsonWriter out, PropertySchemaPhoneNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaPhoneNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaPhoneNumber given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaPhoneNumber * @throws IOException if the JSON string is invalid with respect to PropertySchemaPhoneNumber */ public static PropertySchemaPhoneNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaPhoneNumber.class); } /** * Convert an instance of PropertySchemaPhoneNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaRelation.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaRelationRelation; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaRelation */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaRelation { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RELATION = "relation"; @SerializedName(SERIALIZED_NAME_RELATION) @javax.annotation.Nullable private PropertySchemaRelationRelation relation; public PropertySchemaRelation() { } public PropertySchemaRelation id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaRelation name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaRelation type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaRelation relation(@javax.annotation.Nullable PropertySchemaRelationRelation relation) { this.relation = relation; return this; } /** * Get relation * @return relation */ @javax.annotation.Nullable public PropertySchemaRelationRelation getRelation() { return relation; } public void setRelation(@javax.annotation.Nullable PropertySchemaRelationRelation relation) { this.relation = relation; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaRelation propertySchemaRelation = (PropertySchemaRelation) o; return Objects.equals(this.id, propertySchemaRelation.id) && Objects.equals(this.name, propertySchemaRelation.name) && Objects.equals(this.type, propertySchemaRelation.type) && Objects.equals(this.relation, propertySchemaRelation.relation); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, relation); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaRelation {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" relation: ").append(toIndentedString(relation)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "relation")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaRelation */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaRelation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaRelation is not found in the empty JSON string", PropertySchemaRelation.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaRelation.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaRelation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // validate the optional field `relation` if (jsonObj.get("relation") != null && !jsonObj.get("relation").isJsonNull()) { PropertySchemaRelationRelation.validateJsonElement(jsonObj.get("relation")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaRelation.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaRelation' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaRelation> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaRelation.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaRelation>() { @Override public void write(JsonWriter out, PropertySchemaRelation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaRelation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaRelation given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaRelation * @throws IOException if the JSON string is invalid with respect to PropertySchemaRelation */ public static PropertySchemaRelation fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaRelation.class); } /** * Convert an instance of PropertySchemaRelation to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaRelationRelation.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaRelationRelation */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaRelationRelation { public static final String SERIALIZED_NAME_DATABASE_ID = "database_id"; @SerializedName(SERIALIZED_NAME_DATABASE_ID) @javax.annotation.Nonnull private UUID databaseId; public static final String SERIALIZED_NAME_SYNCED_PROPERTY_ID = "synced_property_id"; @SerializedName(SERIALIZED_NAME_SYNCED_PROPERTY_ID) @javax.annotation.Nullable private String syncedPropertyId; public PropertySchemaRelationRelation() { } public PropertySchemaRelationRelation databaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; return this; } /** * 关联的数据库ID * @return databaseId */ @javax.annotation.Nonnull public UUID getDatabaseId() { return databaseId; } public void setDatabaseId(@javax.annotation.Nonnull UUID databaseId) { this.databaseId = databaseId; } public PropertySchemaRelationRelation syncedPropertyId(@javax.annotation.Nullable String syncedPropertyId) { this.syncedPropertyId = syncedPropertyId; return this; } /** * 同步属性ID * @return syncedPropertyId */ @javax.annotation.Nullable public String getSyncedPropertyId() { return syncedPropertyId; } public void setSyncedPropertyId(@javax.annotation.Nullable String syncedPropertyId) { this.syncedPropertyId = syncedPropertyId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaRelationRelation propertySchemaRelationRelation = (PropertySchemaRelationRelation) o; return Objects.equals(this.databaseId, propertySchemaRelationRelation.databaseId) && Objects.equals(this.syncedPropertyId, propertySchemaRelationRelation.syncedPropertyId); } @Override public int hashCode() { return Objects.hash(databaseId, syncedPropertyId); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertySchemaRelationRelation {\n"); sb.append(" databaseId: ").append(toIndentedString(databaseId)).append("\n"); sb.append(" syncedPropertyId: ").append(toIndentedString(syncedPropertyId)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("database_id", "synced_property_id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("database_id")); } /** * 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 PropertySchemaRelationRelation */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaRelationRelation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaRelationRelation is not found in the empty JSON string", PropertySchemaRelationRelation.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaRelationRelation.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaRelationRelation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertySchemaRelationRelation.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (!jsonObj.get("database_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `database_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("database_id").toString())); } if ((jsonObj.get("synced_property_id") != null && !jsonObj.get("synced_property_id").isJsonNull()) && !jsonObj.get("synced_property_id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `synced_property_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("synced_property_id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaRelationRelation.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaRelationRelation' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaRelationRelation> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaRelationRelation.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaRelationRelation>() { @Override public void write(JsonWriter out, PropertySchemaRelationRelation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaRelationRelation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaRelationRelation given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaRelationRelation * @throws IOException if the JSON string is invalid with respect to PropertySchemaRelationRelation */ public static PropertySchemaRelationRelation fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaRelationRelation.class); } /** * Convert an instance of PropertySchemaRelationRelation to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaRichText.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaRichText */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaRichText { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RICH_TEXT = "rich_text"; @SerializedName(SERIALIZED_NAME_RICH_TEXT) @javax.annotation.Nullable private Object richText; public PropertySchemaRichText() { } public PropertySchemaRichText id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaRichText name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaRichText type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaRichText richText(@javax.annotation.Nullable Object richText) { this.richText = richText; return this; } /** * Get richText * @return richText */ @javax.annotation.Nullable public Object getRichText() { return richText; } public void setRichText(@javax.annotation.Nullable Object richText) { this.richText = richText; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaRichText propertySchemaRichText = (PropertySchemaRichText) o; return Objects.equals(this.id, propertySchemaRichText.id) && Objects.equals(this.name, propertySchemaRichText.name) && Objects.equals(this.type, propertySchemaRichText.type) && Objects.equals(this.richText, propertySchemaRichText.richText); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, richText); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaRichText {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" richText: ").append(toIndentedString(richText)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "rich_text")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaRichText */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaRichText.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaRichText is not found in the empty JSON string", PropertySchemaRichText.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaRichText.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaRichText` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaRichText.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaRichText' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaRichText> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaRichText.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaRichText>() { @Override public void write(JsonWriter out, PropertySchemaRichText value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaRichText read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaRichText given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaRichText * @throws IOException if the JSON string is invalid with respect to PropertySchemaRichText */ public static PropertySchemaRichText fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaRichText.class); } /** * Convert an instance of PropertySchemaRichText to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertySchemaSelectSelect; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaSelect { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_SELECT = "select"; @SerializedName(SERIALIZED_NAME_SELECT) @javax.annotation.Nullable private PropertySchemaSelectSelect select; public PropertySchemaSelect() { } public PropertySchemaSelect id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaSelect name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaSelect type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaSelect select(@javax.annotation.Nullable PropertySchemaSelectSelect select) { this.select = select; return this; } /** * Get select * @return select */ @javax.annotation.Nullable public PropertySchemaSelectSelect getSelect() { return select; } public void setSelect(@javax.annotation.Nullable PropertySchemaSelectSelect select) { this.select = select; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaSelect propertySchemaSelect = (PropertySchemaSelect) o; return Objects.equals(this.id, propertySchemaSelect.id) && Objects.equals(this.name, propertySchemaSelect.name) && Objects.equals(this.type, propertySchemaSelect.type) && Objects.equals(this.select, propertySchemaSelect.select); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, select); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaSelect {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" select: ").append(toIndentedString(select)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "select")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaSelect is not found in the empty JSON string", PropertySchemaSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } // validate the optional field `select` if (jsonObj.get("select") != null && !jsonObj.get("select").isJsonNull()) { PropertySchemaSelectSelect.validateJsonElement(jsonObj.get("select")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaSelect.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaSelect>() { @Override public void write(JsonWriter out, PropertySchemaSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaSelect given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaSelect * @throws IOException if the JSON string is invalid with respect to PropertySchemaSelect */ public static PropertySchemaSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaSelect.class); } /** * Convert an instance of PropertySchemaSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaSelectOption.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaSelectOption */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaSelectOption { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; /** * Gets or Sets color */ @JsonAdapter(ColorEnum.Adapter.class) public enum ColorEnum { DEFAULT("default"), GRAY("gray"), BROWN("brown"), ORANGE("orange"), YELLOW("yellow"), GREEN("green"), BLUE("blue"), PURPLE("purple"), PINK("pink"), RED("red"); private String value; ColorEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ColorEnum fromValue(String value) { for (ColorEnum b : ColorEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ColorEnum> { @Override public void write(final JsonWriter jsonWriter, final ColorEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ColorEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ColorEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ColorEnum.fromValue(value); } } public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) @javax.annotation.Nullable private ColorEnum color; public PropertySchemaSelectOption() { } public PropertySchemaSelectOption id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaSelectOption name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaSelectOption color(@javax.annotation.Nullable ColorEnum color) { this.color = color; return this; } /** * Get color * @return color */ @javax.annotation.Nullable public ColorEnum getColor() { return color; } public void setColor(@javax.annotation.Nullable ColorEnum color) { this.color = color; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaSelectOption propertySchemaSelectOption = (PropertySchemaSelectOption) o; return Objects.equals(this.id, propertySchemaSelectOption.id) && Objects.equals(this.name, propertySchemaSelectOption.name) && Objects.equals(this.color, propertySchemaSelectOption.color); } @Override public int hashCode() { return Objects.hash(id, name, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertySchemaSelectOption {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "color")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaSelectOption */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaSelectOption.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaSelectOption is not found in the empty JSON string", PropertySchemaSelectOption.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaSelectOption.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaSelectOption` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); } // validate the optional field `color` if (jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) { ColorEnum.validateJsonElement(jsonObj.get("color")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaSelectOption.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaSelectOption' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaSelectOption> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaSelectOption.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaSelectOption>() { @Override public void write(JsonWriter out, PropertySchemaSelectOption value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaSelectOption read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaSelectOption given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaSelectOption * @throws IOException if the JSON string is invalid with respect to PropertySchemaSelectOption */ public static PropertySchemaSelectOption fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaSelectOption.class); } /** * Convert an instance of PropertySchemaSelectOption to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaSelectSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.PropertySchemaSelectOption; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaSelectSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaSelectSelect { public static final String SERIALIZED_NAME_OPTIONS = "options"; @SerializedName(SERIALIZED_NAME_OPTIONS) @javax.annotation.Nullable private List<PropertySchemaSelectOption> options = new ArrayList<>(); public PropertySchemaSelectSelect() { } public PropertySchemaSelectSelect options(@javax.annotation.Nullable List<PropertySchemaSelectOption> options) { this.options = options; return this; } public PropertySchemaSelectSelect addOptionsItem(PropertySchemaSelectOption optionsItem) { if (this.options == null) { this.options = new ArrayList<>(); } this.options.add(optionsItem); return this; } /** * Get options * @return options */ @javax.annotation.Nullable public List<PropertySchemaSelectOption> getOptions() { return options; } public void setOptions(@javax.annotation.Nullable List<PropertySchemaSelectOption> options) { this.options = options; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaSelectSelect propertySchemaSelectSelect = (PropertySchemaSelectSelect) o; return Objects.equals(this.options, propertySchemaSelectSelect.options); } @Override public int hashCode() { return Objects.hash(options); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertySchemaSelectSelect {\n"); sb.append(" options: ").append(toIndentedString(options)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("options")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaSelectSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaSelectSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaSelectSelect is not found in the empty JSON string", PropertySchemaSelectSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaSelectSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaSelectSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull()) { JsonArray jsonArrayoptions = jsonObj.getAsJsonArray("options"); if (jsonArrayoptions != null) { // ensure the json data is an array if (!jsonObj.get("options").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); } // validate the optional field `options` (array) for (int i = 0; i < jsonArrayoptions.size(); i++) { PropertySchemaSelectOption.validateJsonElement(jsonArrayoptions.get(i)); }; } } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaSelectSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaSelectSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaSelectSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaSelectSelect.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaSelectSelect>() { @Override public void write(JsonWriter out, PropertySchemaSelectSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaSelectSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaSelectSelect given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaSelectSelect * @throws IOException if the JSON string is invalid with respect to PropertySchemaSelectSelect */ public static PropertySchemaSelectSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaSelectSelect.class); } /** * Convert an instance of PropertySchemaSelectSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaTitle.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaTitle */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaTitle { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_TITLE = "title"; @SerializedName(SERIALIZED_NAME_TITLE) @javax.annotation.Nullable private Object title; public PropertySchemaTitle() { } public PropertySchemaTitle id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaTitle name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaTitle type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaTitle title(@javax.annotation.Nullable Object title) { this.title = title; return this; } /** * Get title * @return title */ @javax.annotation.Nullable public Object getTitle() { return title; } public void setTitle(@javax.annotation.Nullable Object title) { this.title = title; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaTitle propertySchemaTitle = (PropertySchemaTitle) o; return Objects.equals(this.id, propertySchemaTitle.id) && Objects.equals(this.name, propertySchemaTitle.name) && Objects.equals(this.type, propertySchemaTitle.type) && Objects.equals(this.title, propertySchemaTitle.title); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, title); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaTitle {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "title")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaTitle */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaTitle.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaTitle is not found in the empty JSON string", PropertySchemaTitle.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaTitle.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaTitle` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaTitle.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaTitle' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaTitle> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaTitle.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaTitle>() { @Override public void write(JsonWriter out, PropertySchemaTitle value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaTitle read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaTitle given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaTitle * @throws IOException if the JSON string is invalid with respect to PropertySchemaTitle */ public static PropertySchemaTitle fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaTitle.class); } /** * Convert an instance of PropertySchemaTitle to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertySchemaUrl.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertySchemaUrl */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertySchemaUrl { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) @javax.annotation.Nullable private Object url; public PropertySchemaUrl() { } public PropertySchemaUrl id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertySchemaUrl name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertySchemaUrl type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertySchemaUrl url(@javax.annotation.Nullable Object url) { this.url = url; return this; } /** * Get url * @return url */ @javax.annotation.Nullable public Object getUrl() { return url; } public void setUrl(@javax.annotation.Nullable Object url) { this.url = url; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertySchemaUrl propertySchemaUrl = (PropertySchemaUrl) o; return Objects.equals(this.id, propertySchemaUrl.id) && Objects.equals(this.name, propertySchemaUrl.name) && Objects.equals(this.type, propertySchemaUrl.type) && Objects.equals(this.url, propertySchemaUrl.url); } private static <T> boolean equalsNullable(JsonNullable<T> a, JsonNullable<T> 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(id, name, type, url); } private static <T> int hashCodeNullable(JsonNullable<T> 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 PropertySchemaUrl {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" url: ").append(toIndentedString(url)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "type", "url")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertySchemaUrl */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertySchemaUrl.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertySchemaUrl is not found in the empty JSON string", PropertySchemaUrl.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertySchemaUrl.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertySchemaUrl` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertySchemaUrl.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertySchemaUrl' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertySchemaUrl> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertySchemaUrl.class)); return (TypeAdapter<T>) new TypeAdapter<PropertySchemaUrl>() { @Override public void write(JsonWriter out, PropertySchemaUrl value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertySchemaUrl read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertySchemaUrl given an JSON string * * @param jsonString JSON string * @return An instance of PropertySchemaUrl * @throws IOException if the JSON string is invalid with respect to PropertySchemaUrl */ public static PropertySchemaUrl fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertySchemaUrl.class); } /** * Convert an instance of PropertySchemaUrl to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValue.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.openapitools.client.model.CreatePagePropertyValueRelationRelationInner; import org.openapitools.client.model.PropertyValueCheckbox; import org.openapitools.client.model.PropertyValueDate; import org.openapitools.client.model.PropertyValueDateDate; import org.openapitools.client.model.PropertyValueEmail; import org.openapitools.client.model.PropertyValueFiles; import org.openapitools.client.model.PropertyValueFilesFilesInner; import org.openapitools.client.model.PropertyValueMultiSelect; import org.openapitools.client.model.PropertyValueMultiSelectMultiSelectInner; import org.openapitools.client.model.PropertyValueNumber; import org.openapitools.client.model.PropertyValuePeople; import org.openapitools.client.model.PropertyValuePeoplePeopleInner; import org.openapitools.client.model.PropertyValuePhoneNumber; import org.openapitools.client.model.PropertyValueRelation; import org.openapitools.client.model.PropertyValueRichText; import org.openapitools.client.model.PropertyValueSelect; import org.openapitools.client.model.PropertyValueSelectSelect; import org.openapitools.client.model.PropertyValueTitle; import org.openapitools.client.model.PropertyValueUrl; import org.openapitools.client.model.RichTextItem; import java.io.IOException; import java.lang.reflect.Type; import java.util.logging.Level; import java.util.logging.Logger; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.HashMap; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonParseException; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.JsonPrimitive; 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 com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonArray; import com.google.gson.JsonParseException; import org.openapitools.client.JSON; @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValue extends AbstractOpenApiSchema { private static final Logger log = Logger.getLogger(PropertyValue.class.getName()); public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValue.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValue' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueTitle> adapterPropertyValueTitle = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueTitle.class)); final TypeAdapter<PropertyValueRichText> adapterPropertyValueRichText = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueRichText.class)); final TypeAdapter<PropertyValueNumber> adapterPropertyValueNumber = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueNumber.class)); final TypeAdapter<PropertyValueSelect> adapterPropertyValueSelect = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueSelect.class)); final TypeAdapter<PropertyValueMultiSelect> adapterPropertyValueMultiSelect = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueMultiSelect.class)); final TypeAdapter<PropertyValueDate> adapterPropertyValueDate = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueDate.class)); final TypeAdapter<PropertyValuePeople> adapterPropertyValuePeople = gson.getDelegateAdapter(this, TypeToken.get(PropertyValuePeople.class)); final TypeAdapter<PropertyValueFiles> adapterPropertyValueFiles = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueFiles.class)); final TypeAdapter<PropertyValueCheckbox> adapterPropertyValueCheckbox = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueCheckbox.class)); final TypeAdapter<PropertyValueUrl> adapterPropertyValueUrl = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueUrl.class)); final TypeAdapter<PropertyValueEmail> adapterPropertyValueEmail = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueEmail.class)); final TypeAdapter<PropertyValuePhoneNumber> adapterPropertyValuePhoneNumber = gson.getDelegateAdapter(this, TypeToken.get(PropertyValuePhoneNumber.class)); final TypeAdapter<PropertyValueRelation> adapterPropertyValueRelation = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueRelation.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValue>() { @Override public void write(JsonWriter out, PropertyValue value) throws IOException { if (value == null || value.getActualInstance() == null) { elementAdapter.write(out, null); return; } // check if the actual instance is of the type `PropertyValueTitle` if (value.getActualInstance() instanceof PropertyValueTitle) { JsonElement element = adapterPropertyValueTitle.toJsonTree((PropertyValueTitle)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueRichText` if (value.getActualInstance() instanceof PropertyValueRichText) { JsonElement element = adapterPropertyValueRichText.toJsonTree((PropertyValueRichText)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueNumber` if (value.getActualInstance() instanceof PropertyValueNumber) { JsonElement element = adapterPropertyValueNumber.toJsonTree((PropertyValueNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueSelect` if (value.getActualInstance() instanceof PropertyValueSelect) { JsonElement element = adapterPropertyValueSelect.toJsonTree((PropertyValueSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueMultiSelect` if (value.getActualInstance() instanceof PropertyValueMultiSelect) { JsonElement element = adapterPropertyValueMultiSelect.toJsonTree((PropertyValueMultiSelect)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueDate` if (value.getActualInstance() instanceof PropertyValueDate) { JsonElement element = adapterPropertyValueDate.toJsonTree((PropertyValueDate)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValuePeople` if (value.getActualInstance() instanceof PropertyValuePeople) { JsonElement element = adapterPropertyValuePeople.toJsonTree((PropertyValuePeople)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueFiles` if (value.getActualInstance() instanceof PropertyValueFiles) { JsonElement element = adapterPropertyValueFiles.toJsonTree((PropertyValueFiles)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueCheckbox` if (value.getActualInstance() instanceof PropertyValueCheckbox) { JsonElement element = adapterPropertyValueCheckbox.toJsonTree((PropertyValueCheckbox)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueUrl` if (value.getActualInstance() instanceof PropertyValueUrl) { JsonElement element = adapterPropertyValueUrl.toJsonTree((PropertyValueUrl)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueEmail` if (value.getActualInstance() instanceof PropertyValueEmail) { JsonElement element = adapterPropertyValueEmail.toJsonTree((PropertyValueEmail)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValuePhoneNumber` if (value.getActualInstance() instanceof PropertyValuePhoneNumber) { JsonElement element = adapterPropertyValuePhoneNumber.toJsonTree((PropertyValuePhoneNumber)value.getActualInstance()); elementAdapter.write(out, element); return; } // check if the actual instance is of the type `PropertyValueRelation` if (value.getActualInstance() instanceof PropertyValueRelation) { JsonElement element = adapterPropertyValueRelation.toJsonTree((PropertyValueRelation)value.getActualInstance()); elementAdapter.write(out, element); return; } throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl"); } @Override public PropertyValue read(JsonReader in) throws IOException { Object deserialized = null; JsonElement jsonElement = elementAdapter.read(in); int match = 0; ArrayList<String> errorMessages = new ArrayList<>(); TypeAdapter actualAdapter = elementAdapter; // deserialize PropertyValueTitle try { // validate the JSON object to see if any exception is thrown PropertyValueTitle.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueTitle; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueTitle'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueTitle failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueTitle'", e); } // deserialize PropertyValueRichText try { // validate the JSON object to see if any exception is thrown PropertyValueRichText.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueRichText; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueRichText'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueRichText failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueRichText'", e); } // deserialize PropertyValueNumber try { // validate the JSON object to see if any exception is thrown PropertyValueNumber.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueNumber; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueNumber'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueNumber'", e); } // deserialize PropertyValueSelect try { // validate the JSON object to see if any exception is thrown PropertyValueSelect.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueSelect; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueSelect'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueSelect'", e); } // deserialize PropertyValueMultiSelect try { // validate the JSON object to see if any exception is thrown PropertyValueMultiSelect.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueMultiSelect; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueMultiSelect'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueMultiSelect failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueMultiSelect'", e); } // deserialize PropertyValueDate try { // validate the JSON object to see if any exception is thrown PropertyValueDate.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueDate; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueDate'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueDate failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueDate'", e); } // deserialize PropertyValuePeople try { // validate the JSON object to see if any exception is thrown PropertyValuePeople.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValuePeople; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValuePeople'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValuePeople failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValuePeople'", e); } // deserialize PropertyValueFiles try { // validate the JSON object to see if any exception is thrown PropertyValueFiles.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueFiles; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueFiles'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueFiles failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueFiles'", e); } // deserialize PropertyValueCheckbox try { // validate the JSON object to see if any exception is thrown PropertyValueCheckbox.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueCheckbox; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueCheckbox'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueCheckbox failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueCheckbox'", e); } // deserialize PropertyValueUrl try { // validate the JSON object to see if any exception is thrown PropertyValueUrl.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueUrl; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueUrl'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueUrl failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueUrl'", e); } // deserialize PropertyValueEmail try { // validate the JSON object to see if any exception is thrown PropertyValueEmail.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueEmail; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueEmail'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueEmail failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueEmail'", e); } // deserialize PropertyValuePhoneNumber try { // validate the JSON object to see if any exception is thrown PropertyValuePhoneNumber.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValuePhoneNumber; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValuePhoneNumber'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValuePhoneNumber failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValuePhoneNumber'", e); } // deserialize PropertyValueRelation try { // validate the JSON object to see if any exception is thrown PropertyValueRelation.validateJsonElement(jsonElement); actualAdapter = adapterPropertyValueRelation; match++; log.log(Level.FINER, "Input data matches schema 'PropertyValueRelation'"); } catch (Exception e) { // deserialization failed, continue errorMessages.add(String.format("Deserialization for PropertyValueRelation failed with `%s`.", e.getMessage())); log.log(Level.FINER, "Input data does not match schema 'PropertyValueRelation'", e); } if (match == 1) { PropertyValue ret = new PropertyValue(); ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); return ret; } throw new IOException(String.format("Failed deserialization for PropertyValue: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); } }.nullSafe(); } } // store a list of schema names defined in oneOf public static final Map<String, Class<?>> schemas = new HashMap<String, Class<?>>(); public PropertyValue() { super("oneOf", Boolean.FALSE); } public PropertyValue(Object o) { super("oneOf", Boolean.FALSE); setActualInstance(o); } static { schemas.put("PropertyValueTitle", PropertyValueTitle.class); schemas.put("PropertyValueRichText", PropertyValueRichText.class); schemas.put("PropertyValueNumber", PropertyValueNumber.class); schemas.put("PropertyValueSelect", PropertyValueSelect.class); schemas.put("PropertyValueMultiSelect", PropertyValueMultiSelect.class); schemas.put("PropertyValueDate", PropertyValueDate.class); schemas.put("PropertyValuePeople", PropertyValuePeople.class); schemas.put("PropertyValueFiles", PropertyValueFiles.class); schemas.put("PropertyValueCheckbox", PropertyValueCheckbox.class); schemas.put("PropertyValueUrl", PropertyValueUrl.class); schemas.put("PropertyValueEmail", PropertyValueEmail.class); schemas.put("PropertyValuePhoneNumber", PropertyValuePhoneNumber.class); schemas.put("PropertyValueRelation", PropertyValueRelation.class); } @Override public Map<String, Class<?>> getSchemas() { return PropertyValue.schemas; } /** * Set the instance that matches the oneOf child schema, check * the instance parameter is valid against the oneOf child schemas: * PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl * * It could be an instance of the 'oneOf' schemas. */ @Override public void setActualInstance(Object instance) { if (instance instanceof PropertyValueTitle) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueRichText) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueNumber) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueSelect) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueMultiSelect) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueDate) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValuePeople) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueFiles) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueCheckbox) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueUrl) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueEmail) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValuePhoneNumber) { super.setActualInstance(instance); return; } if (instance instanceof PropertyValueRelation) { super.setActualInstance(instance); return; } throw new RuntimeException("Invalid instance type. Must be PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl"); } /** * Get the actual instance, which can be the following: * PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl * * @return The actual instance (PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl) */ @SuppressWarnings("unchecked") @Override public Object getActualInstance() { return super.getActualInstance(); } /** * Get the actual instance of `PropertyValueTitle`. If the actual instance is not `PropertyValueTitle`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueTitle` * @throws ClassCastException if the instance is not `PropertyValueTitle` */ public PropertyValueTitle getPropertyValueTitle() throws ClassCastException { return (PropertyValueTitle)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueRichText`. If the actual instance is not `PropertyValueRichText`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueRichText` * @throws ClassCastException if the instance is not `PropertyValueRichText` */ public PropertyValueRichText getPropertyValueRichText() throws ClassCastException { return (PropertyValueRichText)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueNumber`. If the actual instance is not `PropertyValueNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueNumber` * @throws ClassCastException if the instance is not `PropertyValueNumber` */ public PropertyValueNumber getPropertyValueNumber() throws ClassCastException { return (PropertyValueNumber)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueSelect`. If the actual instance is not `PropertyValueSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueSelect` * @throws ClassCastException if the instance is not `PropertyValueSelect` */ public PropertyValueSelect getPropertyValueSelect() throws ClassCastException { return (PropertyValueSelect)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueMultiSelect`. If the actual instance is not `PropertyValueMultiSelect`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueMultiSelect` * @throws ClassCastException if the instance is not `PropertyValueMultiSelect` */ public PropertyValueMultiSelect getPropertyValueMultiSelect() throws ClassCastException { return (PropertyValueMultiSelect)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueDate`. If the actual instance is not `PropertyValueDate`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueDate` * @throws ClassCastException if the instance is not `PropertyValueDate` */ public PropertyValueDate getPropertyValueDate() throws ClassCastException { return (PropertyValueDate)super.getActualInstance(); } /** * Get the actual instance of `PropertyValuePeople`. If the actual instance is not `PropertyValuePeople`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValuePeople` * @throws ClassCastException if the instance is not `PropertyValuePeople` */ public PropertyValuePeople getPropertyValuePeople() throws ClassCastException { return (PropertyValuePeople)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueFiles`. If the actual instance is not `PropertyValueFiles`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueFiles` * @throws ClassCastException if the instance is not `PropertyValueFiles` */ public PropertyValueFiles getPropertyValueFiles() throws ClassCastException { return (PropertyValueFiles)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueCheckbox`. If the actual instance is not `PropertyValueCheckbox`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueCheckbox` * @throws ClassCastException if the instance is not `PropertyValueCheckbox` */ public PropertyValueCheckbox getPropertyValueCheckbox() throws ClassCastException { return (PropertyValueCheckbox)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueUrl`. If the actual instance is not `PropertyValueUrl`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueUrl` * @throws ClassCastException if the instance is not `PropertyValueUrl` */ public PropertyValueUrl getPropertyValueUrl() throws ClassCastException { return (PropertyValueUrl)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueEmail`. If the actual instance is not `PropertyValueEmail`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueEmail` * @throws ClassCastException if the instance is not `PropertyValueEmail` */ public PropertyValueEmail getPropertyValueEmail() throws ClassCastException { return (PropertyValueEmail)super.getActualInstance(); } /** * Get the actual instance of `PropertyValuePhoneNumber`. If the actual instance is not `PropertyValuePhoneNumber`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValuePhoneNumber` * @throws ClassCastException if the instance is not `PropertyValuePhoneNumber` */ public PropertyValuePhoneNumber getPropertyValuePhoneNumber() throws ClassCastException { return (PropertyValuePhoneNumber)super.getActualInstance(); } /** * Get the actual instance of `PropertyValueRelation`. If the actual instance is not `PropertyValueRelation`, * the ClassCastException will be thrown. * * @return The actual instance of `PropertyValueRelation` * @throws ClassCastException if the instance is not `PropertyValueRelation` */ public PropertyValueRelation getPropertyValueRelation() throws ClassCastException { return (PropertyValueRelation)super.getActualInstance(); } /** * 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 PropertyValue */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { // validate oneOf schemas one by one int validCount = 0; ArrayList<String> errorMessages = new ArrayList<>(); // validate the json string with PropertyValueTitle try { PropertyValueTitle.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueTitle failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueRichText try { PropertyValueRichText.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueRichText failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueNumber try { PropertyValueNumber.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueSelect try { PropertyValueSelect.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueMultiSelect try { PropertyValueMultiSelect.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueMultiSelect failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueDate try { PropertyValueDate.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueDate failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValuePeople try { PropertyValuePeople.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValuePeople failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueFiles try { PropertyValueFiles.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueFiles failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueCheckbox try { PropertyValueCheckbox.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueCheckbox failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueUrl try { PropertyValueUrl.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueUrl failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueEmail try { PropertyValueEmail.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueEmail failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValuePhoneNumber try { PropertyValuePhoneNumber.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValuePhoneNumber failed with `%s`.", e.getMessage())); // continue to the next one } // validate the json string with PropertyValueRelation try { PropertyValueRelation.validateJsonElement(jsonElement); validCount++; } catch (Exception e) { errorMessages.add(String.format("Deserialization for PropertyValueRelation failed with `%s`.", e.getMessage())); // continue to the next one } if (validCount != 1) { throw new IOException(String.format("The JSON string is invalid for PropertyValue with oneOf schemas: PropertyValueCheckbox, PropertyValueDate, PropertyValueEmail, PropertyValueFiles, PropertyValueMultiSelect, PropertyValueNumber, PropertyValuePeople, PropertyValuePhoneNumber, PropertyValueRelation, PropertyValueRichText, PropertyValueSelect, PropertyValueTitle, PropertyValueUrl. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } /** * Create an instance of PropertyValue given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValue * @throws IOException if the JSON string is invalid with respect to PropertyValue */ public static PropertyValue fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValue.class); } /** * Convert an instance of PropertyValue to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueCheckbox.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueCheckbox */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueCheckbox { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_CHECKBOX = "checkbox"; @SerializedName(SERIALIZED_NAME_CHECKBOX) @javax.annotation.Nonnull private Boolean checkbox; public PropertyValueCheckbox() { } public PropertyValueCheckbox id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueCheckbox type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueCheckbox checkbox(@javax.annotation.Nonnull Boolean checkbox) { this.checkbox = checkbox; return this; } /** * Get checkbox * @return checkbox */ @javax.annotation.Nonnull public Boolean getCheckbox() { return checkbox; } public void setCheckbox(@javax.annotation.Nonnull Boolean checkbox) { this.checkbox = checkbox; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueCheckbox propertyValueCheckbox = (PropertyValueCheckbox) o; return Objects.equals(this.id, propertyValueCheckbox.id) && Objects.equals(this.type, propertyValueCheckbox.type) && Objects.equals(this.checkbox, propertyValueCheckbox.checkbox); } @Override public int hashCode() { return Objects.hash(id, type, checkbox); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueCheckbox {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" checkbox: ").append(toIndentedString(checkbox)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "checkbox")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "checkbox")); } /** * 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 PropertyValueCheckbox */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueCheckbox.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueCheckbox is not found in the empty JSON string", PropertyValueCheckbox.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueCheckbox.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueCheckbox` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueCheckbox.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueCheckbox.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueCheckbox' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueCheckbox> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueCheckbox.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueCheckbox>() { @Override public void write(JsonWriter out, PropertyValueCheckbox value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueCheckbox read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueCheckbox given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueCheckbox * @throws IOException if the JSON string is invalid with respect to PropertyValueCheckbox */ public static PropertyValueCheckbox fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueCheckbox.class); } /** * Convert an instance of PropertyValueCheckbox to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueDate.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.PropertyValueDateDate; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueDate */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueDate { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) @javax.annotation.Nonnull private PropertyValueDateDate date; public PropertyValueDate() { } public PropertyValueDate id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueDate type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueDate date(@javax.annotation.Nonnull PropertyValueDateDate date) { this.date = date; return this; } /** * Get date * @return date */ @javax.annotation.Nonnull public PropertyValueDateDate getDate() { return date; } public void setDate(@javax.annotation.Nonnull PropertyValueDateDate date) { this.date = date; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueDate propertyValueDate = (PropertyValueDate) o; return Objects.equals(this.id, propertyValueDate.id) && Objects.equals(this.type, propertyValueDate.type) && Objects.equals(this.date, propertyValueDate.date); } @Override public int hashCode() { return Objects.hash(id, type, date); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueDate {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" date: ").append(toIndentedString(date)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "date")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "date")); } /** * 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 PropertyValueDate */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueDate is not found in the empty JSON string", PropertyValueDate.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueDate.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueDate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueDate.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // validate the required field `date` PropertyValueDateDate.validateJsonElement(jsonObj.get("date")); } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueDate.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueDate' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueDate> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueDate.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueDate>() { @Override public void write(JsonWriter out, PropertyValueDate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueDate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueDate given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueDate * @throws IOException if the JSON string is invalid with respect to PropertyValueDate */ public static PropertyValueDate fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueDate.class); } /** * Convert an instance of PropertyValueDate to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueDateDate.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueDateDate */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueDateDate { public static final String SERIALIZED_NAME_START = "start"; @SerializedName(SERIALIZED_NAME_START) @javax.annotation.Nullable private String start; public static final String SERIALIZED_NAME_END = "end"; @SerializedName(SERIALIZED_NAME_END) @javax.annotation.Nullable private String end; public static final String SERIALIZED_NAME_TIME_ZONE = "time_zone"; @SerializedName(SERIALIZED_NAME_TIME_ZONE) @javax.annotation.Nullable private String timeZone; public PropertyValueDateDate() { } public PropertyValueDateDate start(@javax.annotation.Nullable String start) { this.start = start; return this; } /** * 开始日期 * @return start */ @javax.annotation.Nullable public String getStart() { return start; } public void setStart(@javax.annotation.Nullable String start) { this.start = start; } public PropertyValueDateDate end(@javax.annotation.Nullable String end) { this.end = end; return this; } /** * 结束日期(可选) * @return end */ @javax.annotation.Nullable public String getEnd() { return end; } public void setEnd(@javax.annotation.Nullable String end) { this.end = end; } public PropertyValueDateDate timeZone(@javax.annotation.Nullable String timeZone) { this.timeZone = timeZone; return this; } /** * 时区 * @return timeZone */ @javax.annotation.Nullable public String getTimeZone() { return timeZone; } public void setTimeZone(@javax.annotation.Nullable String timeZone) { this.timeZone = timeZone; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueDateDate propertyValueDateDate = (PropertyValueDateDate) o; return Objects.equals(this.start, propertyValueDateDate.start) && Objects.equals(this.end, propertyValueDateDate.end) && Objects.equals(this.timeZone, propertyValueDateDate.timeZone); } @Override public int hashCode() { return Objects.hash(start, end, timeZone); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueDateDate {\n"); sb.append(" start: ").append(toIndentedString(start)).append("\n"); sb.append(" end: ").append(toIndentedString(end)).append("\n"); sb.append(" timeZone: ").append(toIndentedString(timeZone)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("start", "end", "time_zone")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertyValueDateDate */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueDateDate.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueDateDate is not found in the empty JSON string", PropertyValueDateDate.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueDateDate.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueDateDate` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("start") != null && !jsonObj.get("start").isJsonNull()) && !jsonObj.get("start").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `start` to be a primitive type in the JSON string but got `%s`", jsonObj.get("start").toString())); } if ((jsonObj.get("end") != null && !jsonObj.get("end").isJsonNull()) && !jsonObj.get("end").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `end` to be a primitive type in the JSON string but got `%s`", jsonObj.get("end").toString())); } if ((jsonObj.get("time_zone") != null && !jsonObj.get("time_zone").isJsonNull()) && !jsonObj.get("time_zone").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `time_zone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("time_zone").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueDateDate.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueDateDate' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueDateDate> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueDateDate.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueDateDate>() { @Override public void write(JsonWriter out, PropertyValueDateDate value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueDateDate read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueDateDate given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueDateDate * @throws IOException if the JSON string is invalid with respect to PropertyValueDateDate */ public static PropertyValueDateDate fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueDateDate.class); } /** * Convert an instance of PropertyValueDateDate to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueEmail.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueEmail */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueEmail { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) @javax.annotation.Nonnull private String email; public PropertyValueEmail() { } public PropertyValueEmail id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueEmail type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueEmail email(@javax.annotation.Nonnull String email) { this.email = email; return this; } /** * Get email * @return email */ @javax.annotation.Nonnull public String getEmail() { return email; } public void setEmail(@javax.annotation.Nonnull String email) { this.email = email; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueEmail propertyValueEmail = (PropertyValueEmail) o; return Objects.equals(this.id, propertyValueEmail.id) && Objects.equals(this.type, propertyValueEmail.type) && Objects.equals(this.email, propertyValueEmail.email); } @Override public int hashCode() { return Objects.hash(id, type, email); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueEmail {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" email: ").append(toIndentedString(email)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "email")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "email")); } /** * 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 PropertyValueEmail */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueEmail.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueEmail is not found in the empty JSON string", PropertyValueEmail.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueEmail.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueEmail` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueEmail.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if (!jsonObj.get("email").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueEmail.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueEmail' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueEmail> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueEmail.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueEmail>() { @Override public void write(JsonWriter out, PropertyValueEmail value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueEmail read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueEmail given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueEmail * @throws IOException if the JSON string is invalid with respect to PropertyValueEmail */ public static PropertyValueEmail fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueEmail.class); } /** * Convert an instance of PropertyValueEmail to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueFiles.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.PropertyValueFilesFilesInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueFiles */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueFiles { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_FILES = "files"; @SerializedName(SERIALIZED_NAME_FILES) @javax.annotation.Nonnull private List<PropertyValueFilesFilesInner> files = new ArrayList<>(); public PropertyValueFiles() { } public PropertyValueFiles id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueFiles type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueFiles files(@javax.annotation.Nonnull List<PropertyValueFilesFilesInner> files) { this.files = files; return this; } public PropertyValueFiles addFilesItem(PropertyValueFilesFilesInner filesItem) { if (this.files == null) { this.files = new ArrayList<>(); } this.files.add(filesItem); return this; } /** * Get files * @return files */ @javax.annotation.Nonnull public List<PropertyValueFilesFilesInner> getFiles() { return files; } public void setFiles(@javax.annotation.Nonnull List<PropertyValueFilesFilesInner> files) { this.files = files; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueFiles propertyValueFiles = (PropertyValueFiles) o; return Objects.equals(this.id, propertyValueFiles.id) && Objects.equals(this.type, propertyValueFiles.type) && Objects.equals(this.files, propertyValueFiles.files); } @Override public int hashCode() { return Objects.hash(id, type, files); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueFiles {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" files: ").append(toIndentedString(files)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "files")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "files")); } /** * 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 PropertyValueFiles */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueFiles.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueFiles is not found in the empty JSON string", PropertyValueFiles.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueFiles.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueFiles` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueFiles.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // ensure the json data is an array if (!jsonObj.get("files").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `files` to be an array in the JSON string but got `%s`", jsonObj.get("files").toString())); } JsonArray jsonArrayfiles = jsonObj.getAsJsonArray("files"); // validate the required field `files` (array) for (int i = 0; i < jsonArrayfiles.size(); i++) { PropertyValueFilesFilesInner.validateJsonElement(jsonArrayfiles.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueFiles.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueFiles' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueFiles> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueFiles.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueFiles>() { @Override public void write(JsonWriter out, PropertyValueFiles value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueFiles read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueFiles given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueFiles * @throws IOException if the JSON string is invalid with respect to PropertyValueFiles */ public static PropertyValueFiles fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueFiles.class); } /** * Convert an instance of PropertyValueFiles to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueFilesFilesInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import org.openapitools.client.model.CoverExternal; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueFilesFilesInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueFilesFilesInner { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; /** * Gets or Sets type */ @JsonAdapter(TypeEnum.Adapter.class) public enum TypeEnum { EXTERNAL("external"); private String value; TypeEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static TypeEnum fromValue(String value) { for (TypeEnum b : TypeEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<TypeEnum> { @Override public void write(final JsonWriter jsonWriter, final TypeEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public TypeEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return TypeEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); TypeEnum.fromValue(value); } } public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private TypeEnum type; public static final String SERIALIZED_NAME_EXTERNAL = "external"; @SerializedName(SERIALIZED_NAME_EXTERNAL) @javax.annotation.Nullable private CoverExternal external; public PropertyValueFilesFilesInner() { } public PropertyValueFilesFilesInner name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertyValueFilesFilesInner type(@javax.annotation.Nullable TypeEnum type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public TypeEnum getType() { return type; } public void setType(@javax.annotation.Nullable TypeEnum type) { this.type = type; } public PropertyValueFilesFilesInner external(@javax.annotation.Nullable CoverExternal external) { this.external = external; return this; } /** * Get external * @return external */ @javax.annotation.Nullable public CoverExternal getExternal() { return external; } public void setExternal(@javax.annotation.Nullable CoverExternal external) { this.external = external; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueFilesFilesInner propertyValueFilesFilesInner = (PropertyValueFilesFilesInner) o; return Objects.equals(this.name, propertyValueFilesFilesInner.name) && Objects.equals(this.type, propertyValueFilesFilesInner.type) && Objects.equals(this.external, propertyValueFilesFilesInner.external); } @Override public int hashCode() { return Objects.hash(name, type, external); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueFilesFilesInner {\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" external: ").append(toIndentedString(external)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("name", "type", "external")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertyValueFilesFilesInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueFilesFilesInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueFilesFilesInner is not found in the empty JSON string", PropertyValueFilesFilesInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueFilesFilesInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueFilesFilesInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); } // validate the optional field `type` if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { TypeEnum.validateJsonElement(jsonObj.get("type")); } // validate the optional field `external` if (jsonObj.get("external") != null && !jsonObj.get("external").isJsonNull()) { CoverExternal.validateJsonElement(jsonObj.get("external")); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueFilesFilesInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueFilesFilesInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueFilesFilesInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueFilesFilesInner.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueFilesFilesInner>() { @Override public void write(JsonWriter out, PropertyValueFilesFilesInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueFilesFilesInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueFilesFilesInner given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueFilesFilesInner * @throws IOException if the JSON string is invalid with respect to PropertyValueFilesFilesInner */ public static PropertyValueFilesFilesInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueFilesFilesInner.class); } /** * Convert an instance of PropertyValueFilesFilesInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueMultiSelect.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.PropertyValueMultiSelectMultiSelectInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueMultiSelect */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueMultiSelect { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_MULTI_SELECT = "multi_select"; @SerializedName(SERIALIZED_NAME_MULTI_SELECT) @javax.annotation.Nonnull private List<PropertyValueMultiSelectMultiSelectInner> multiSelect = new ArrayList<>(); public PropertyValueMultiSelect() { } public PropertyValueMultiSelect id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueMultiSelect type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueMultiSelect multiSelect(@javax.annotation.Nonnull List<PropertyValueMultiSelectMultiSelectInner> multiSelect) { this.multiSelect = multiSelect; return this; } public PropertyValueMultiSelect addMultiSelectItem(PropertyValueMultiSelectMultiSelectInner multiSelectItem) { if (this.multiSelect == null) { this.multiSelect = new ArrayList<>(); } this.multiSelect.add(multiSelectItem); return this; } /** * Get multiSelect * @return multiSelect */ @javax.annotation.Nonnull public List<PropertyValueMultiSelectMultiSelectInner> getMultiSelect() { return multiSelect; } public void setMultiSelect(@javax.annotation.Nonnull List<PropertyValueMultiSelectMultiSelectInner> multiSelect) { this.multiSelect = multiSelect; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueMultiSelect propertyValueMultiSelect = (PropertyValueMultiSelect) o; return Objects.equals(this.id, propertyValueMultiSelect.id) && Objects.equals(this.type, propertyValueMultiSelect.type) && Objects.equals(this.multiSelect, propertyValueMultiSelect.multiSelect); } @Override public int hashCode() { return Objects.hash(id, type, multiSelect); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueMultiSelect {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" multiSelect: ").append(toIndentedString(multiSelect)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "multi_select")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "multi_select")); } /** * 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 PropertyValueMultiSelect */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueMultiSelect.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueMultiSelect is not found in the empty JSON string", PropertyValueMultiSelect.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueMultiSelect.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueMultiSelect` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueMultiSelect.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // ensure the json data is an array if (!jsonObj.get("multi_select").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `multi_select` to be an array in the JSON string but got `%s`", jsonObj.get("multi_select").toString())); } JsonArray jsonArraymultiSelect = jsonObj.getAsJsonArray("multi_select"); // validate the required field `multi_select` (array) for (int i = 0; i < jsonArraymultiSelect.size(); i++) { PropertyValueMultiSelectMultiSelectInner.validateJsonElement(jsonArraymultiSelect.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueMultiSelect.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueMultiSelect' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueMultiSelect> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueMultiSelect.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueMultiSelect>() { @Override public void write(JsonWriter out, PropertyValueMultiSelect value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueMultiSelect read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueMultiSelect given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueMultiSelect * @throws IOException if the JSON string is invalid with respect to PropertyValueMultiSelect */ public static PropertyValueMultiSelect fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueMultiSelect.class); } /** * Convert an instance of PropertyValueMultiSelect to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueMultiSelectMultiSelectInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueMultiSelectMultiSelectInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueMultiSelectMultiSelectInner { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @javax.annotation.Nullable private String name; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) @javax.annotation.Nullable private String color; public PropertyValueMultiSelectMultiSelectInner() { } public PropertyValueMultiSelectMultiSelectInner id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueMultiSelectMultiSelectInner name(@javax.annotation.Nullable String name) { this.name = name; return this; } /** * Get name * @return name */ @javax.annotation.Nullable public String getName() { return name; } public void setName(@javax.annotation.Nullable String name) { this.name = name; } public PropertyValueMultiSelectMultiSelectInner color(@javax.annotation.Nullable String color) { this.color = color; return this; } /** * Get color * @return color */ @javax.annotation.Nullable public String getColor() { return color; } public void setColor(@javax.annotation.Nullable String color) { this.color = color; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueMultiSelectMultiSelectInner propertyValueMultiSelectMultiSelectInner = (PropertyValueMultiSelectMultiSelectInner) o; return Objects.equals(this.id, propertyValueMultiSelectMultiSelectInner.id) && Objects.equals(this.name, propertyValueMultiSelectMultiSelectInner.name) && Objects.equals(this.color, propertyValueMultiSelectMultiSelectInner.color); } @Override public int hashCode() { return Objects.hash(id, name, color); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueMultiSelectMultiSelectInner {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" color: ").append(toIndentedString(color)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "name", "color")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertyValueMultiSelectMultiSelectInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueMultiSelectMultiSelectInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueMultiSelectMultiSelectInner is not found in the empty JSON string", PropertyValueMultiSelectMultiSelectInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueMultiSelectMultiSelectInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueMultiSelectMultiSelectInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if ((jsonObj.get("name") != null && !jsonObj.get("name").isJsonNull()) && !jsonObj.get("name").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); } if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueMultiSelectMultiSelectInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueMultiSelectMultiSelectInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueMultiSelectMultiSelectInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueMultiSelectMultiSelectInner.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueMultiSelectMultiSelectInner>() { @Override public void write(JsonWriter out, PropertyValueMultiSelectMultiSelectInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueMultiSelectMultiSelectInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueMultiSelectMultiSelectInner given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueMultiSelectMultiSelectInner * @throws IOException if the JSON string is invalid with respect to PropertyValueMultiSelectMultiSelectInner */ public static PropertyValueMultiSelectMultiSelectInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueMultiSelectMultiSelectInner.class); } /** * Convert an instance of PropertyValueMultiSelectMultiSelectInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.math.BigDecimal; import java.util.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueNumber { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) @javax.annotation.Nonnull private BigDecimal number; public PropertyValueNumber() { } public PropertyValueNumber id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueNumber number(@javax.annotation.Nonnull BigDecimal number) { this.number = number; return this; } /** * Get number * @return number */ @javax.annotation.Nonnull public BigDecimal getNumber() { return number; } public void setNumber(@javax.annotation.Nonnull BigDecimal number) { this.number = number; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueNumber propertyValueNumber = (PropertyValueNumber) o; return Objects.equals(this.id, propertyValueNumber.id) && Objects.equals(this.type, propertyValueNumber.type) && Objects.equals(this.number, propertyValueNumber.number); } @Override public int hashCode() { return Objects.hash(id, type, number); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueNumber {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" number: ").append(toIndentedString(number)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "number")); } /** * 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 PropertyValueNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueNumber is not found in the empty JSON string", PropertyValueNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueNumber.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueNumber.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueNumber>() { @Override public void write(JsonWriter out, PropertyValueNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueNumber given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueNumber * @throws IOException if the JSON string is invalid with respect to PropertyValueNumber */ public static PropertyValueNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueNumber.class); } /** * Convert an instance of PropertyValueNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValuePeople.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.PropertyValuePeoplePeopleInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValuePeople */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValuePeople { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PEOPLE = "people"; @SerializedName(SERIALIZED_NAME_PEOPLE) @javax.annotation.Nonnull private List<PropertyValuePeoplePeopleInner> people = new ArrayList<>(); public PropertyValuePeople() { } public PropertyValuePeople id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValuePeople type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValuePeople people(@javax.annotation.Nonnull List<PropertyValuePeoplePeopleInner> people) { this.people = people; return this; } public PropertyValuePeople addPeopleItem(PropertyValuePeoplePeopleInner peopleItem) { if (this.people == null) { this.people = new ArrayList<>(); } this.people.add(peopleItem); return this; } /** * Get people * @return people */ @javax.annotation.Nonnull public List<PropertyValuePeoplePeopleInner> getPeople() { return people; } public void setPeople(@javax.annotation.Nonnull List<PropertyValuePeoplePeopleInner> people) { this.people = people; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValuePeople propertyValuePeople = (PropertyValuePeople) o; return Objects.equals(this.id, propertyValuePeople.id) && Objects.equals(this.type, propertyValuePeople.type) && Objects.equals(this.people, propertyValuePeople.people); } @Override public int hashCode() { return Objects.hash(id, type, people); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValuePeople {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" people: ").append(toIndentedString(people)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "people")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "people")); } /** * 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 PropertyValuePeople */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValuePeople.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValuePeople is not found in the empty JSON string", PropertyValuePeople.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValuePeople.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValuePeople` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValuePeople.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // ensure the json data is an array if (!jsonObj.get("people").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `people` to be an array in the JSON string but got `%s`", jsonObj.get("people").toString())); } JsonArray jsonArraypeople = jsonObj.getAsJsonArray("people"); // validate the required field `people` (array) for (int i = 0; i < jsonArraypeople.size(); i++) { PropertyValuePeoplePeopleInner.validateJsonElement(jsonArraypeople.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValuePeople.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValuePeople' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValuePeople> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValuePeople.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValuePeople>() { @Override public void write(JsonWriter out, PropertyValuePeople value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValuePeople read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValuePeople given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValuePeople * @throws IOException if the JSON string is invalid with respect to PropertyValuePeople */ public static PropertyValuePeople fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValuePeople.class); } /** * Convert an instance of PropertyValuePeople to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValuePeoplePeopleInner.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; import java.util.UUID; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValuePeoplePeopleInner */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValuePeoplePeopleInner { /** * Gets or Sets _object */ @JsonAdapter(ObjectEnum.Adapter.class) public enum ObjectEnum { USER("user"); private String value; ObjectEnum(String value) { this.value = value; } public String getValue() { return value; } @Override public String toString() { return String.valueOf(value); } public static ObjectEnum fromValue(String value) { for (ObjectEnum b : ObjectEnum.values()) { if (b.value.equals(value)) { return b; } } throw new IllegalArgumentException("Unexpected value '" + value + "'"); } public static class Adapter extends TypeAdapter<ObjectEnum> { @Override public void write(final JsonWriter jsonWriter, final ObjectEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override public ObjectEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); return ObjectEnum.fromValue(value); } } public static void validateJsonElement(JsonElement jsonElement) throws IOException { String value = jsonElement.getAsString(); ObjectEnum.fromValue(value); } } public static final String SERIALIZED_NAME_OBJECT = "object"; @SerializedName(SERIALIZED_NAME_OBJECT) @javax.annotation.Nullable private ObjectEnum _object; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private UUID id; public PropertyValuePeoplePeopleInner() { } public PropertyValuePeoplePeopleInner _object(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; return this; } /** * Get _object * @return _object */ @javax.annotation.Nullable public ObjectEnum getObject() { return _object; } public void setObject(@javax.annotation.Nullable ObjectEnum _object) { this._object = _object; } public PropertyValuePeoplePeopleInner id(@javax.annotation.Nullable UUID id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public UUID getId() { return id; } public void setId(@javax.annotation.Nullable UUID id) { this.id = id; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValuePeoplePeopleInner propertyValuePeoplePeopleInner = (PropertyValuePeoplePeopleInner) o; return Objects.equals(this._object, propertyValuePeoplePeopleInner._object) && Objects.equals(this.id, propertyValuePeoplePeopleInner.id); } @Override public int hashCode() { return Objects.hash(_object, id); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValuePeoplePeopleInner {\n"); sb.append(" _object: ").append(toIndentedString(_object)).append("\n"); sb.append(" id: ").append(toIndentedString(id)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("object", "id")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(0); } /** * 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 PropertyValuePeoplePeopleInner */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValuePeoplePeopleInner.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValuePeoplePeopleInner is not found in the empty JSON string", PropertyValuePeoplePeopleInner.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValuePeoplePeopleInner.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValuePeoplePeopleInner` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) && !jsonObj.get("object").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `object` to be a primitive type in the JSON string but got `%s`", jsonObj.get("object").toString())); } // validate the optional field `object` if (jsonObj.get("object") != null && !jsonObj.get("object").isJsonNull()) { ObjectEnum.validateJsonElement(jsonObj.get("object")); } if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValuePeoplePeopleInner.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValuePeoplePeopleInner' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValuePeoplePeopleInner> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValuePeoplePeopleInner.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValuePeoplePeopleInner>() { @Override public void write(JsonWriter out, PropertyValuePeoplePeopleInner value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValuePeoplePeopleInner read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValuePeoplePeopleInner given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValuePeoplePeopleInner * @throws IOException if the JSON string is invalid with respect to PropertyValuePeoplePeopleInner */ public static PropertyValuePeoplePeopleInner fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValuePeoplePeopleInner.class); } /** * Convert an instance of PropertyValuePeoplePeopleInner to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValuePhoneNumber.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.Arrays; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValuePhoneNumber */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValuePhoneNumber { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_PHONE_NUMBER = "phone_number"; @SerializedName(SERIALIZED_NAME_PHONE_NUMBER) @javax.annotation.Nonnull private String phoneNumber; public PropertyValuePhoneNumber() { } public PropertyValuePhoneNumber id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValuePhoneNumber type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValuePhoneNumber phoneNumber(@javax.annotation.Nonnull String phoneNumber) { this.phoneNumber = phoneNumber; return this; } /** * Get phoneNumber * @return phoneNumber */ @javax.annotation.Nonnull public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(@javax.annotation.Nonnull String phoneNumber) { this.phoneNumber = phoneNumber; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValuePhoneNumber propertyValuePhoneNumber = (PropertyValuePhoneNumber) o; return Objects.equals(this.id, propertyValuePhoneNumber.id) && Objects.equals(this.type, propertyValuePhoneNumber.type) && Objects.equals(this.phoneNumber, propertyValuePhoneNumber.phoneNumber); } @Override public int hashCode() { return Objects.hash(id, type, phoneNumber); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValuePhoneNumber {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" phoneNumber: ").append(toIndentedString(phoneNumber)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "phone_number")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "phone_number")); } /** * 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 PropertyValuePhoneNumber */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValuePhoneNumber.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValuePhoneNumber is not found in the empty JSON string", PropertyValuePhoneNumber.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValuePhoneNumber.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValuePhoneNumber` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValuePhoneNumber.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } if (!jsonObj.get("phone_number").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `phone_number` to be a primitive type in the JSON string but got `%s`", jsonObj.get("phone_number").toString())); } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValuePhoneNumber.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValuePhoneNumber' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValuePhoneNumber> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValuePhoneNumber.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValuePhoneNumber>() { @Override public void write(JsonWriter out, PropertyValuePhoneNumber value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValuePhoneNumber read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValuePhoneNumber given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValuePhoneNumber * @throws IOException if the JSON string is invalid with respect to PropertyValuePhoneNumber */ public static PropertyValuePhoneNumber fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValuePhoneNumber.class); } /** * Convert an instance of PropertyValuePhoneNumber to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueRelation.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.CreatePagePropertyValueRelationRelationInner; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueRelation */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueRelation { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RELATION = "relation"; @SerializedName(SERIALIZED_NAME_RELATION) @javax.annotation.Nonnull private List<CreatePagePropertyValueRelationRelationInner> relation = new ArrayList<>(); public PropertyValueRelation() { } public PropertyValueRelation id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueRelation type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueRelation relation(@javax.annotation.Nonnull List<CreatePagePropertyValueRelationRelationInner> relation) { this.relation = relation; return this; } public PropertyValueRelation addRelationItem(CreatePagePropertyValueRelationRelationInner relationItem) { if (this.relation == null) { this.relation = new ArrayList<>(); } this.relation.add(relationItem); return this; } /** * Get relation * @return relation */ @javax.annotation.Nonnull public List<CreatePagePropertyValueRelationRelationInner> getRelation() { return relation; } public void setRelation(@javax.annotation.Nonnull List<CreatePagePropertyValueRelationRelationInner> relation) { this.relation = relation; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueRelation propertyValueRelation = (PropertyValueRelation) o; return Objects.equals(this.id, propertyValueRelation.id) && Objects.equals(this.type, propertyValueRelation.type) && Objects.equals(this.relation, propertyValueRelation.relation); } @Override public int hashCode() { return Objects.hash(id, type, relation); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueRelation {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" relation: ").append(toIndentedString(relation)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "relation")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "relation")); } /** * 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 PropertyValueRelation */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueRelation.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueRelation is not found in the empty JSON string", PropertyValueRelation.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueRelation.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueRelation` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueRelation.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // ensure the json data is an array if (!jsonObj.get("relation").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `relation` to be an array in the JSON string but got `%s`", jsonObj.get("relation").toString())); } JsonArray jsonArrayrelation = jsonObj.getAsJsonArray("relation"); // validate the required field `relation` (array) for (int i = 0; i < jsonArrayrelation.size(); i++) { CreatePagePropertyValueRelationRelationInner.validateJsonElement(jsonArrayrelation.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueRelation.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueRelation' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueRelation> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueRelation.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueRelation>() { @Override public void write(JsonWriter out, PropertyValueRelation value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueRelation read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueRelation given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueRelation * @throws IOException if the JSON string is invalid with respect to PropertyValueRelation */ public static PropertyValueRelation fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueRelation.class); } /** * Convert an instance of PropertyValueRelation to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }
0
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client
java-sources/ai/buildin/buildin-api-client/1.0.4/org/openapitools/client/model/PropertyValueRichText.java
/* * Buildin API * Buildin Developer API * * 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 org.openapitools.client.model; import java.util.Objects; 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.List; import org.openapitools.client.model.RichTextItem; 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.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.openapitools.client.JSON; /** * PropertyValueRichText */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0") public class PropertyValueRichText { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @javax.annotation.Nullable private String id; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) @javax.annotation.Nullable private Object type = null; public static final String SERIALIZED_NAME_RICH_TEXT = "rich_text"; @SerializedName(SERIALIZED_NAME_RICH_TEXT) @javax.annotation.Nonnull private List<RichTextItem> richText = new ArrayList<>(); public PropertyValueRichText() { } public PropertyValueRichText id(@javax.annotation.Nullable String id) { this.id = id; return this; } /** * Get id * @return id */ @javax.annotation.Nullable public String getId() { return id; } public void setId(@javax.annotation.Nullable String id) { this.id = id; } public PropertyValueRichText type(@javax.annotation.Nullable Object type) { this.type = type; return this; } /** * Get type * @return type */ @javax.annotation.Nullable public Object getType() { return type; } public void setType(@javax.annotation.Nullable Object type) { this.type = type; } public PropertyValueRichText richText(@javax.annotation.Nonnull List<RichTextItem> richText) { this.richText = richText; return this; } public PropertyValueRichText addRichTextItem(RichTextItem richTextItem) { if (this.richText == null) { this.richText = new ArrayList<>(); } this.richText.add(richTextItem); return this; } /** * Get richText * @return richText */ @javax.annotation.Nonnull public List<RichTextItem> getRichText() { return richText; } public void setRichText(@javax.annotation.Nonnull List<RichTextItem> richText) { this.richText = richText; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PropertyValueRichText propertyValueRichText = (PropertyValueRichText) o; return Objects.equals(this.id, propertyValueRichText.id) && Objects.equals(this.type, propertyValueRichText.type) && Objects.equals(this.richText, propertyValueRichText.richText); } @Override public int hashCode() { return Objects.hash(id, type, richText); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PropertyValueRichText {\n"); sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" richText: ").append(toIndentedString(richText)).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<String> openapiFields; public static HashSet<String> openapiRequiredFields; static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet<String>(Arrays.asList("id", "type", "rich_text")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet<String>(Arrays.asList("type", "rich_text")); } /** * 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 PropertyValueRichText */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { if (!PropertyValueRichText.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null throw new IllegalArgumentException(String.format("The required field(s) %s in PropertyValueRichText is not found in the empty JSON string", PropertyValueRichText.openapiRequiredFields.toString())); } } Set<Map.Entry<String, JsonElement>> entries = jsonElement.getAsJsonObject().entrySet(); // check to see if the JSON string contains additional fields for (Map.Entry<String, JsonElement> entry : entries) { if (!PropertyValueRichText.openapiFields.contains(entry.getKey())) { throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PropertyValueRichText` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } } // check to make sure all required properties/fields are present in the JSON string for (String requiredField : PropertyValueRichText.openapiRequiredFields) { if (jsonElement.getAsJsonObject().get(requiredField) == null) { throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } } JsonObject jsonObj = jsonElement.getAsJsonObject(); if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); } // ensure the json data is an array if (!jsonObj.get("rich_text").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `rich_text` to be an array in the JSON string but got `%s`", jsonObj.get("rich_text").toString())); } JsonArray jsonArrayrichText = jsonObj.getAsJsonArray("rich_text"); // validate the required field `rich_text` (array) for (int i = 0; i < jsonArrayrichText.size(); i++) { RichTextItem.validateJsonElement(jsonArrayrichText.get(i)); }; } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { if (!PropertyValueRichText.class.isAssignableFrom(type.getRawType())) { return null; // this class only serializes 'PropertyValueRichText' and its subtypes } final TypeAdapter<JsonElement> elementAdapter = gson.getAdapter(JsonElement.class); final TypeAdapter<PropertyValueRichText> thisAdapter = gson.getDelegateAdapter(this, TypeToken.get(PropertyValueRichText.class)); return (TypeAdapter<T>) new TypeAdapter<PropertyValueRichText>() { @Override public void write(JsonWriter out, PropertyValueRichText value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); elementAdapter.write(out, obj); } @Override public PropertyValueRichText read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); return thisAdapter.fromJsonTree(jsonElement); } }.nullSafe(); } } /** * Create an instance of PropertyValueRichText given an JSON string * * @param jsonString JSON string * @return An instance of PropertyValueRichText * @throws IOException if the JSON string is invalid with respect to PropertyValueRichText */ public static PropertyValueRichText fromJson(String jsonString) throws IOException { return JSON.getGson().fromJson(jsonString, PropertyValueRichText.class); } /** * Convert an instance of PropertyValueRichText to an JSON string * * @return JSON string */ public String toJson() { return JSON.getGson().toJson(this); } }