From 76be07462877c64085b1f291bf516428111fbf69 Mon Sep 17 00:00:00 2001 From: Christopher Grote Date: Wed, 24 Feb 2021 16:39:34 +0000 Subject: [PATCH 1/3] Bump to latest versions of dependencies Signed-off-by: Christopher Grote --- java/pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index 88bdc17..2061643 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -48,14 +48,14 @@ UTF-8 - 5.3.3 + 5.3.4 2.12.1 2.12.1 0.2.1 - 4.13.1 + 4.13.2 3.0.0-M5 - 3.4.2 - 1.0.3 + 3.4.3 + 1.0.4 0.7.15.RELEASE 4.1.59.Final 7.3.0 From c4d1d627cde2caf65bc955053f39d05b2876cb42 Mon Sep 17 00:00:00 2001 From: Christopher Grote Date: Thu, 25 Feb 2021 02:12:22 +0000 Subject: [PATCH 2/3] Adds initial drafts for asset attachments and files APIs Signed-off-by: Christopher Grote --- .../com/ibm/watson/data/client/ApiClient.java | 100 ++- .../client/api/AssetAttachmentsApiV2.java | 478 +++++++++++ .../data/client/api/AssetFilesApiV2.java | 798 ++++++++++++++++++ .../data/client/model/AnalysisSummary.java | 90 ++ .../data/client/model/AssetFileMetadata.java | 166 ++++ .../data/client/model/AttachmentDetail.java | 194 +++++ .../data/client/model/AttachmentIncRes.java | 93 ++ .../data/client/model/AttachmentRequest.java | 104 +++ .../watson/data/client/model/CodeCount.java | 76 ++ .../watson/data/client/model/CodeValue.java | 67 ++ .../client/model/DataProfileAttachment.java | 77 ++ .../data/client/model/DataProfileColumn.java | 85 ++ .../data/client/model/DataProfileSummary.java | 107 +++ .../watson/data/client/model/DateStats.java | 95 +++ .../data/client/model/DiscoveredClass.java | 76 ++ .../client/model/DiscoveredClassDetails.java | 60 ++ .../data/client/model/DiscoveredDetails.java | 98 +++ .../data/client/model/DiscoveredFormat.java | 67 ++ .../client/model/DiscoveredFormatDetails.java | 60 ++ .../model/DiscoveredNumericDetails.java | 61 ++ .../client/model/DiscoveredStringDetails.java | 61 ++ .../data/client/model/DiscoveredType.java | 67 ++ .../client/model/DiscoveredTypeDetails.java | 61 ++ .../data/client/model/FileDeleteResponse.java | 85 ++ .../data/client/model/NumericStats.java | 95 +++ .../model/PaginatedAssetFileListResponse.java | 212 +++++ .../watson/data/client/model/ScoreStats.java | 121 +++ .../watson/data/client/model/TypeDetails.java | 94 +++ .../data/client/model/ValueAnalysis.java | 335 ++++++++ .../watson/data/client/model/ValueCount.java | 76 ++ .../client/mocks/MockServerExpectations.java | 4 +- .../client/tests/AssetAttachmentsTest.java | 145 ++++ .../data/client/tests/AssetFilesTest.java | 175 ++++ .../assetAttachments/create/request.json | 10 + .../assetAttachments/create/response.json | 15 + .../assetAttachments/get/response.json | 21 + .../getResources/response.json | 9 + .../markTransferComplete/response.json | 9 + .../assetFiles/createFolder/response.json | 6 + .../resources/assetFiles/get/response.csv | 5 + .../resources/assetFiles/list/response.json | 12 + .../resources/assetFiles/upload/names.csv | 5 + .../resources/assetFiles/upload/response.json | 3 + 43 files changed, 4569 insertions(+), 9 deletions(-) create mode 100644 java/src/main/java/com/ibm/watson/data/client/api/AssetAttachmentsApiV2.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/api/AssetFilesApiV2.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/AnalysisSummary.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/AssetFileMetadata.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/AttachmentDetail.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/AttachmentIncRes.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/AttachmentRequest.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/CodeCount.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/CodeValue.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DataProfileAttachment.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DataProfileColumn.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DataProfileSummary.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DateStats.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClass.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClassDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormat.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormatDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredNumericDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredStringDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredType.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/DiscoveredTypeDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/FileDeleteResponse.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/NumericStats.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/PaginatedAssetFileListResponse.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/ScoreStats.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/TypeDetails.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/ValueAnalysis.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/ValueCount.java create mode 100644 java/src/test/java/com/ibm/watson/data/client/tests/AssetAttachmentsTest.java create mode 100644 java/src/test/java/com/ibm/watson/data/client/tests/AssetFilesTest.java create mode 100644 java/src/test/resources/assetAttachments/create/request.json create mode 100644 java/src/test/resources/assetAttachments/create/response.json create mode 100644 java/src/test/resources/assetAttachments/get/response.json create mode 100644 java/src/test/resources/assetAttachments/getResources/response.json create mode 100644 java/src/test/resources/assetAttachments/markTransferComplete/response.json create mode 100644 java/src/test/resources/assetFiles/createFolder/response.json create mode 100644 java/src/test/resources/assetFiles/get/response.csv create mode 100644 java/src/test/resources/assetFiles/list/response.json create mode 100644 java/src/test/resources/assetFiles/upload/names.csv create mode 100644 java/src/test/resources/assetFiles/upload/response.json diff --git a/java/src/main/java/com/ibm/watson/data/client/ApiClient.java b/java/src/main/java/com/ibm/watson/data/client/ApiClient.java index cb42738..a2031dc 100644 --- a/java/src/main/java/com/ibm/watson/data/client/ApiClient.java +++ b/java/src/main/java/com/ibm/watson/data/client/ApiClient.java @@ -15,6 +15,7 @@ */ package com.ibm.watson.data.client; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.ibm.watson.data.client.api.AuthorizationApi; @@ -22,7 +23,10 @@ import com.ibm.watson.data.client.auth.HttpBearerAuth; import java.io.*; +import java.net.URI; +import java.nio.file.FileSystems; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.security.cert.X509Certificate; @@ -41,6 +45,8 @@ import org.openapitools.jackson.nullable.JsonNullableModule; import org.springframework.core.ParameterizedTypeReference; import org.springframework.core.io.FileSystemResource; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.core.io.buffer.DataBufferUtils; import org.springframework.http.*; import org.springframework.http.client.reactive.ClientHttpConnector; import org.springframework.http.client.reactive.ClientHttpRequest; @@ -90,8 +96,7 @@ private String collectionToString(Collection collection) { } private final HttpHeaders defaultHeaders = new HttpHeaders(); - private final MultiValueMap defaultCookies = - new LinkedMultiValueMap<>(); + private final MultiValueMap defaultCookies = new LinkedMultiValueMap<>(); private String basePath = "http://localhost"; @@ -105,6 +110,8 @@ private String collectionToString(Collection collection) { private Authentication authentication; + private final ObjectMapper mapper; + /** * Constructs a base ApiClient * @param disableSSLVerification will disable SSL verification if set to true @@ -119,7 +126,7 @@ public ApiClient(boolean disableSSLVerification) { * @param bufferSizeInMb maximum size of buffer to allow for WebClient */ public ApiClient(boolean disableSSLVerification, int bufferSizeInMb) { - ObjectMapper mapper = new ObjectMapper(); + mapper = new ObjectMapper(); mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY); mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -242,6 +249,36 @@ public ApiClient setCredentials(String username, String password) { return this; } + /** + * Save the contents of a DataBuffer into a file using the path provided. + * @param path of the file to write + * @param contents that should be written to the file + * @return Path that was written, or null if no file was written + */ + public static Path saveBufferAsFile(String path, Mono contents) { + final Path location = FileSystems.getDefault().getPath(path); + DataBufferUtils.write(contents, location).block(); + return location; + } + + /** + * Retrieve the contents of a DataBuffer as an object of the specified type. + * Note: there is the potential for this to consume a very large amount of memory, depending on the size + * of the data buffer (object) being translated. + * @param contents that should be transformed into an object + * @param type of object into which to transform + * @param of object into which to transform + * @return an object of the requested type + * @throws IOException if there is any problem during the transformation + */ + public T getBufferAsObject(Mono contents, TypeReference type) throws IOException { + DataBuffer buffer = contents.block(); + if (buffer != null) { + return mapper.readValue(buffer.asInputStream(true), type); + } + return null; + } + private void setBearerFromUsernameAndPassword() { AuthorizationApi auth = new AuthorizationApi(this); LoginCredentials cred = new LoginCredentials(); @@ -487,9 +524,39 @@ public Mono invokeAPI( HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType, ParameterizedTypeReference returnType) throws RestClientException { + return invokeAPI(path, method, pathParams, queryParams, body, + headerParams, cookieParams, formParams, accept, contentType, + returnType, false); + } + + /** + * Invoke API by sending HTTP request with the given options. + * + * @param the return type to use + * @param path The sub-path of the HTTP URL + * @param method The request method + * @param pathParams The path parameters + * @param queryParams The query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param accept The request's Accept header + * @param contentType The request's Content-Type header + * @param returnType The return type into which to deserialize the response + * @param encoded true if the parameters are already URL-encoded, false (default) otherwise + * @return The response body in chosen type + */ + public Mono invokeAPI( + String path, HttpMethod method, Map pathParams, + MultiValueMap queryParams, Object body, + HttpHeaders headerParams, MultiValueMap cookieParams, + MultiValueMap formParams, List accept, + MediaType contentType, ParameterizedTypeReference returnType, + boolean encoded) throws RestClientException { final WebClient.RequestBodySpec requestBuilder = prepareRequest( path, method, pathParams, queryParams, body, headerParams, cookieParams, - formParams, accept, contentType); + formParams, accept, contentType, encoded); return requestBuilder.retrieve().bodyToMono(returnType); } @@ -645,6 +712,16 @@ private WebClient.RequestBodySpec prepareRequest( HttpHeaders headerParams, MultiValueMap cookieParams, MultiValueMap formParams, List accept, MediaType contentType) { + return prepareRequest(path, method, pathParams, queryParams, body, + headerParams, cookieParams, formParams, accept, contentType, false); + } + + private WebClient.RequestBodySpec prepareRequest( + String path, HttpMethod method, Map pathParams, + MultiValueMap queryParams, Object body, + HttpHeaders headerParams, MultiValueMap cookieParams, + MultiValueMap formParams, List accept, + MediaType contentType, boolean encoded) { updateParamsForAuth(queryParams, headerParams, cookieParams); final UriComponentsBuilder builder = @@ -653,9 +730,18 @@ private WebClient.RequestBodySpec prepareRequest( builder.queryParams(queryParams); } - final WebClient.RequestBodySpec requestBuilder = - webClient.method(method).uri(builder.build(false).toUriString(), - pathParams); + // Spring / URL encoding handling is an absolute nightmare -- just expecting anyone that passes through + // already-encoded query parameters to have already done their own replacement of any path parameters, as + // mixing the two basically appears to be impossible without writing your own string parsing logic. + WebClient.RequestBodySpec requestBuilder; + if (encoded) { + URI uri = builder.build(true).toUri(); + requestBuilder = webClient.method(method).uri(uri); + } else { + String uri = builder.build(false).toUriString(); + requestBuilder = webClient.method(method).uri(uri, pathParams); + } + if (accept != null) { requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); } diff --git a/java/src/main/java/com/ibm/watson/data/client/api/AssetAttachmentsApiV2.java b/java/src/main/java/com/ibm/watson/data/client/api/AssetAttachmentsApiV2.java new file mode 100644 index 0000000..05bf1a8 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/api/AssetAttachmentsApiV2.java @@ -0,0 +1,478 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.api; + +import com.ibm.watson.data.client.ApiClient; +import com.ibm.watson.data.client.model.*; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import reactor.core.publisher.Mono; +import reactor.util.annotation.NonNull; + +/** + * API endpoints for dealing with asset attachments. + */ +public class AssetAttachmentsApiV2 { + + private ApiClient apiClient; + public static final String BASE_API = "/v2/assets/{asset_id}/attachments"; + + @Autowired + public AssetAttachmentsApiV2(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { return apiClient; } + + public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + + /** + * Delete an attachment. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono delete(@NonNull String assetId, + @NonNull String attachmentId, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}", HttpMethod.DELETE, + pathParams, queryParams, null, headerParams, cookieParams, + formParams, localVarAccept, localVarContentType, localVarReturnType); + + } + + /** + * Mark an attachment as transfer complete. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono markTransferComplete(@NonNull String assetId, + @NonNull String attachmentId, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}/complete", + HttpMethod.POST, pathParams, queryParams, null, headerParams, + cookieParams, formParams, localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Create an attachment. + * @param assetId Asset GUID + * @param attachment Attachment meta-data. The \"asset_type\" is + * required. If not supplied, or if the value given is less than 1, + * data_partitions defaults to 1 (for non-remote and non-referenced + * attachments). For remote attachments, both connection_id and + * connection_path are required. For referenced attachments, both + * object_key and object_key_is_read_only are required. + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Attachment + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono create(@NonNull String assetId, + @NonNull AttachmentRequest attachment, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(BASE_API, + HttpMethod.POST, pathParams, queryParams, + attachment, headerParams, cookieParams, formParams, + localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Get resources info for an attachment. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param revisionId Revision id (1, 2, 3, ...), or leave empty for the + * current asset version. Use 'latest' for the most recent + * revision. + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono getResources(@NonNull String assetId, + @NonNull String attachmentId, + String revisionId, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "revision_id", revisionId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}/resources", + HttpMethod.GET, pathParams, queryParams, null, headerParams, + cookieParams, formParams, localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Increase resources for an attachment. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param attachmentIncRes attachment resource to increase, e.g. + * {\"data_partitions\":5, \"private_url\":false} + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono increaseResources(@NonNull String assetId, + @NonNull String attachmentId, + @NonNull AttachmentIncRes attachmentIncRes, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}/resources", + HttpMethod.PUT, pathParams, queryParams, attachmentIncRes, headerParams, + cookieParams, formParams, localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Retrieve an attachment. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param revisionId Revision id (1, 2, 3, ...), or leave empty for the + * current asset version. Use 'latest' for the most recent + * revision. + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param privateUrl private_url + * @param responseContentDisposition response-content-disposition + * @param responseContentType response-content-type + * @return {@code Mono} + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono get(@NonNull String assetId, + @NonNull String attachmentId, + String revisionId, + String catalogId, + String projectId, + String spaceId, + Boolean privateUrl, + String responseContentDisposition, + String responseContentType) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "revision_id", revisionId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "private_url", privateUrl)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "response-content-disposition", responseContentDisposition)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "response-content-type", responseContentType)); + + final String[] localVarAccepts = {}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}", HttpMethod.GET, + pathParams, queryParams, null, headerParams, cookieParams, + formParams, localVarAccept, localVarContentType, localVarReturnType); + + } + + /** + * Auto update attachment's datasource_type from connection asset. + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Attachment + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono updateDataSourceType(@NonNull String assetId, + @NonNull String attachmentId, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}/datasource_type", + HttpMethod.PATCH, pathParams, queryParams, null, headerParams, + cookieParams, formParams, localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Update attachment metadata. Example JSON patch: + * + * [ + * {"op": "add", "path": "/name", "value": "my_attachment"}, + * {"op": "replace", "path": "/mime", "value": "text/csv}, + * {"op": "remove", "path": "/description"} + * ] + * + * @param assetId Asset GUID + * @param attachmentId Attachment GUID + * @param body JSON array of patch operations as defined in RFC 6902. See + * http://jsonpatch.com/ for more info. + * @param catalogId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param projectId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @param spaceId You must provide either a catalog id, a project id, or a + * space id, but not more than one + * @return Attachment + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono update(@NonNull String assetId, + @NonNull String attachmentId, + @NonNull List body, + String catalogId, + String projectId, + String spaceId) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("asset_id", assetId); + pathParams.put("attachment_id", attachmentId); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json", "application/json-patch+json", "application/merge-patch+json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{attachment_id}", HttpMethod.PATCH, + pathParams, queryParams, body, headerParams, cookieParams, + formParams, localVarAccept, localVarContentType, localVarReturnType); + + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/api/AssetFilesApiV2.java b/java/src/main/java/com/ibm/watson/data/client/api/AssetFilesApiV2.java new file mode 100644 index 0000000..a6749d2 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/api/AssetFilesApiV2.java @@ -0,0 +1,798 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.api; + +import com.ibm.watson.data.client.ApiClient; +import com.ibm.watson.data.client.model.*; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.util.*; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.core.io.buffer.DataBuffer; +import org.springframework.http.*; +import org.springframework.http.MediaType; +import org.springframework.lang.NonNull; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestClientException; +import org.springframework.web.util.UriComponents; +import org.springframework.web.util.UriComponentsBuilder; +import org.springframework.web.util.UriUtils; +import reactor.core.publisher.Mono; + +/** + * API endpoints for dealing with files assets. + */ +public class AssetFilesApiV2 { + + private ApiClient apiClient; + public static final String BASE_API = "/v2/asset_files"; + + @Autowired + public AssetFilesApiV2(ApiClient apiClient) { + this.apiClient = apiClient; + } + + public ApiClient getApiClient() { return apiClient; } + + public void setApiClient(ApiClient apiClient) { this.apiClient = apiClient; } + + /** + * Copy asset file. + * Copies a file between source and target provided in the POST body. Any + * combination of spaces, projects and catalogs are allowed. Viewer permission + * is required for the source and editor permission is required for the + * target. Catalog source or target requires service auth. Service auth is + * supported for projects as well. + * @param copyAssetFile Information on the asset to copy. + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono copy(CopyAssetFile copyAssetFile) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/copy", HttpMethod.POST, pathParams, queryParams, + copyAssetFile, headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + + /** + * Create project, catalog, space or account root folder. + * Before files can be uploaded, project/catalog/account/space root folder + * needs to be created. If the folder already exists the call will fail. + * Project folder can be created with additional content required for internal + * Git. Requires Bearer auth with admin permission for project or space. + * Creating folder for a catalog requires service Basic auth. + * @param catalogId The catalog to create the folder for. One of catalog, + * project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project to create the folder for. One of catalog, + * project, space or account id is required. + * @param spaceId The space to create the folder for. One of catalog, project, + * space or account id is required. + * @param initializeGit Optional param for project containers. + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono createFolder(String catalogId, + String accountId, + String projectId, + String spaceId, + Boolean initializeGit) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "initialize_git", initializeGit)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API, HttpMethod.PUT, pathParams, queryParams, null, + headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + + /** + * Create archive for target. + * Generate an archive and save it to the path provided. Only supports service + * auth. + * @param path The filename where the project archive will be saved. + * @param projectId The project id the file should be associated with. + * @param spaceId The space id the file should be associated with. + * @param isDirectory If true only one element can be supplied in body and it + * must be directory. The entire directory content will be zipped into the + * archive. Default is false. + * @param notify On completion of the archinving a rabbit MQ task will be sent + * out. Default is true. + * @param hideLog In true, the deflate log will be a hidden file. Default is + * false. + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono deflate(@NonNull String path, + String projectId, + String spaceId, + Boolean isDirectory, + Boolean notify, + Boolean hideLog) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("path", path); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "is_directory", isDirectory)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "notify", notify)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "hide_log", hideLog)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(BASE_API + "/{path}/deflate", + HttpMethod.POST, pathParams, queryParams, + null, headerParams, cookieParams, formParams, + localVarAccept, localVarContentType, + localVarReturnType); + + } + + /** + * Delete single asset file/folder. + * Deletes a file in a project, space or a catalog. Requires minimum editor + * permission for projects and spaces (service or user). Catalogs supports + * only service auth. Account requires users to have account admin privelege + * but also accepts service auth. Please note the 'assets' dir and its + * subdir 'data_asset' cannot be deleted. + * @param path Asset file path + * @param catalogId The catalog id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param spaceId The space id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also supported for + * account admin if targeting account directory. + * @return Void + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono delete(@NonNull String path, + String catalogId, + String accountId, + String projectId, + String spaceId, + Boolean root) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("path", path); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/{path}", HttpMethod.DELETE, pathParams, queryParams, + null, headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + + /** + * Batch delete or delete project/catalog/account/space folder. + * Delete either files in batch or a project/catalog/account/space folder. If + * request body is present it should be a list of filenames/filepaths to be + * deleted in the provided project, catalog, space or account. Files are + * deleted asyncronously so some files may be deleted and others skipped. If + * there is no request body the project/catalog/account/space folder will be + * deleted but will fail if the project/catalog/account/space folder is not + * empty. For projects and spaces batch delete requires editor permission. For + * account batch delete user must be account admin. Deletion of the + * project/catalog/account/space folder requires admin (account admin for + * accounts). Service auth is accepted for deletion of assets but not for root + * folder deletion. For catalogs only service auth is supported and it will + * work for either deletion method. Please note the 'assets' dir and + * its subdir 'data_asset' cannot be deleted. + * @param catalogId The catalog folder to run the delete operation on. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project folder to run the delete operation on. One of + * catalog, project, space or account id is required. + * @param spaceId The space folder to run the delete operation on. One of + * catalog, project, space or account id is required. + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also supported for + * account admin if targeting account directory. + * @param forceDelete If true all safeguards + * regarding non-empty directory will be bypassed. Only works for + * projects. + * @param requestBody Asset files to delete + * @return FileDeleteResponse + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono delete(String catalogId, + String accountId, + String projectId, + String spaceId, + Boolean root, + Boolean forceDelete, + List requestBody) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "force_delete", forceDelete)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API, HttpMethod.DELETE, pathParams, queryParams, requestBody, + headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + + /** + * Get asset file. + * Streams the content of the specified file, with the appropriate HTTP + * headers for etag, file size, mime type etc. + * @param url containing at least the path, signature and containment (catalog_id, account_id, project_id or space_id) for the file + * @param byteLimit If passed, indicates how many bytes of data is to be returned. + * @param sizeLimit Returns 400 bad request if asset is larger than the value provided here. In MB. + * @param flat If true folder structures are recursively flattened and the + * response is a list of files of all files in parent and child + * directories. The 'path' will show the resource full path from + * starting directory. + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also supported for + * account admin if targeting account directory. + * @param inflate If true ALL other query params + * except the target are ignored. The file being retrieved must be an + * archive. If all checks pass the archive will be expanded to a temp + * location and the results will be returned as if flat=true was + * supplied. If the target archive has previously been inflated any existing + * inflate preview will be overwritten if the zip is newer. Otherwise the + * previous preview will be returned. + * @param force Only used when inflate=true. Tells asset files to + * skip validation on whether the target is a zip. Inflate will be run + * regardless. + * @return DataBuffer + * @throws RestClientException if an error occurs while attempting to invoke the API + * @see #get(String, String, String, String, String, Integer, Integer, String, Boolean, Boolean, Boolean, Boolean) + */ + public Mono getFromUrl(String url, + Integer byteLimit, + Integer sizeLimit, + Boolean flat, + Boolean root, + Boolean inflate, + Boolean force) throws RestClientException { + + if (url != null) { + UriComponents components; + if (!url.startsWith("http")) { + url = apiClient.getBasePath() + url; + } + components = UriComponentsBuilder.fromHttpUrl(url).build(true); + String endpointPath = components.getPath(); + if (endpointPath != null && endpointPath.startsWith(BASE_API)) { + String path = endpointPath.substring(BASE_API.length() + 1); + MultiValueMap queryParams = components.getQueryParams(); + String catalogId = null; + if (queryParams.containsKey("catalog_id")) { + catalogId = queryParams.get("catalog_id").get(0); + } + String accountId = null; + if (queryParams.containsKey("account_id")) { + accountId = queryParams.get("account_id").get(0); + } + String projectId = null; + if (queryParams.containsKey("project_id")) { + projectId = queryParams.get("project_id").get(0); + } + String spaceId = null; + if (queryParams.containsKey("space_id")) { + spaceId = queryParams.get("space_id").get(0); + } + String signature = null; + if (queryParams.containsKey("signature")) { + signature = queryParams.get("signature").get(0); + } + return get( + path, + catalogId, + accountId, + projectId, + spaceId, + byteLimit, + sizeLimit, + signature, + flat, + root, + inflate, + force + ); + } + } + return null; + + } + + /** + * Get asset file. + * Streams the content of the specified file, with the appropriate HTTP + * headers for etag, file size, mime type etc. If the asset file is a + * directory, response will be JSON listing the content of the directory. If + * the asset is a file, response will be contents of the file. Requires viewer + * permission. Service authentication is supported. Catalog assets require + * service authentication. This endpoint supports authentication via signature + * parameter. + * @param path Asset file path + * @param catalogId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project id the file is associated with. One of + * catalog, project, space or account id is required. + * @param spaceId The space id the file is associated with. One of catalog, + * project, space or account id is required. + * @param byteLimit If passed, indicates how many bytes of data is to be + * returned. + * @param sizeLimit Returns 400 bad request if asset is larger than the value + * provided here. In MB. + * @param signature Additional auth method. Signed string obtained by making + * pre-signed API request. + * @param flat If true folder structures are recursively flattened and the + * response is a list of files of all files in parent and child + * directories. The 'path' will show the resource full path from + * starting directory. + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also supported for + * account admin if targeting account directory. + * @param inflate If true ALL other query params + * except the target are ignored. The file being retrieved must be an + * archive. If all checks pass the archive will be expanded to a temp + * location and the results will be returned as if flat=true was + * supplied. If the target archive has previously been inflated any existing + * inflate preview will be overwritten if the zip is newer. Otherwise the + * previous preview will be returned. + * @param force Only used when inflate=true. Tells asset files to + * skip validation on whether the target is a zip. Inflate will be run + * regardless. + * @return DataBuffer + * @throws RestClientException if an error occurs while attempting to invoke + * the API + * @see #getSignedURL(String, Integer, String, String, String, String, String, String, Boolean, Boolean, String) + */ + public Mono get(@NonNull String path, + String catalogId, + String accountId, + String projectId, + String spaceId, + Integer byteLimit, + Integer sizeLimit, + String signature, + Boolean flat, + Boolean root, + Boolean inflate, + Boolean force) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "byte_limit", byteLimit)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "size_limit", sizeLimit)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "signature", signature)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "flat", flat)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "inflate", inflate)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "force", force)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + // Note: manually place the path, as it seems to be basically impossible to mix pre-encoded query parameters + // (like 'signature') and path template replacements -- either the pre-encoded parameters end up double-encoded + // or the path replacements are not replaced, or cause an exception to be thrown due to invalid characters + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API + "/" + UriUtils.encodePathSegment(path, StandardCharsets.UTF_8), HttpMethod.GET, pathParams, queryParams, + null, headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType, true); + + } + + /** + * Get asset file headers. + * Returns ONLY the HTTP headers for etag, file size, mime type etc. without + * streaming the file content. Requires viewer permission. Service + * authentication is supported. Catalog assets require service authentication. + * This endpoint supports authentication via signature parameter. + * @param path Asset file path + * @param catalogId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project id the file is associated with. One of + * catalog, project, space or account id is required. + * @param spaceId The space id the file is associated with. One of catalog, + * project, space or account id is required. + * @param signature Additional auth method. Signed URL obtained by making + * presigned API request. + * @return {@code ResponseEntity} + * @throws RestClientException if an error occurs while attempting to invoke + * the API + * @see #getSignedURL(String, Integer, String, String, String, String, String, String, Boolean, Boolean, String) + */ + public Mono> getHeaders(@NonNull String path, + String catalogId, + String accountId, + String projectId, + String spaceId, + String signature) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("path", path); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "signature", signature)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + return apiClient.invokeAPI( + BASE_API + "/{path}", HttpMethod.HEAD, pathParams, queryParams, + null, headerParams, cookieParams, formParams, localVarAccept, + localVarContentType); + + } + + /** + * Get a list of file paths. + * Returns a list of file paths (similar to S3 listObjects) for the provided + * project, catalog, space or account. Requires viewer or higher permission. + * When requesting assets for a catalog only Basic auth is supported. + * @param catalogId Request the files for this catalog id. One of catalog, + * project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId Request the files for this project id. One of project, + * catalog, space or account id is required. + * @param spaceId Request the files for this space id. One of project, + * catalog, space or account id is required. + * @param limit Pagination param, limit number of resources returned. + * @param offset Pagination param, resources returned wil be offset by this + * value. + * @param flat If true folder structures are recursively flattened and the + * response is a list of files of all files in parent and child + * directories. The 'path' will show the resource full path from + * starting directory. + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also support for + * account admins if targeting account directory. + * @return PaginatedAssetFileListResponse + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono list(String catalogId, + String accountId, + String projectId, + String spaceId, + String limit, + String offset, + Boolean flat, + Boolean root) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "limit", limit)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "offset", offset)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "flat", flat)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + BASE_API, HttpMethod.GET, pathParams, queryParams, null, + headerParams, cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + + /** + * Put new asset file. + * Uploads the bytes into the file with the provided file name using HTTP + * multi-part format, creating a new file if missing, overriding if existing + * (unless override=false). Adding catalog assets requires service + * authentication or a signed url. Adding project or space assets accepts all + * formats that grant editor access (user, signature or service). Adding to + * accounts requires user with account admin access or service auth. This + * endpoint supports authentication via signature parameter. + * @param path Asset file path + * @param catalogId The catalog id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param spaceId The space id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param override Default true. If set to false will not overwrite file. + * @param signature Additional auth method. Signed string obtained by making + * API request to signing endpoint. + * @param inflate Root dir must be created. Will take supplied file and + * decompress into target directory tree. Inflate is only acceptable for + * project, space and catalog targets. If inflate is selected it will take + * precedence over any and all other params. + * @param ensureDir Override utility. If true will ensure the directory + * specified in 'path' exists. 201 will be returned ig created, + * 200 if already exists and 409 if it is present and not a directory. + * Will take precedence over other query params except 'inflate' + * @param root If true is supplied in request URL the + * api will return relative to target container's root directory + * instead of assets directory. Supported for services. Also supported for + * account admin if targeting account directory. + * @param body The body parameter + * @return {@code ResponseEntity} + * @throws RestClientException if an error occurs while attempting to invoke + * the API + * @see #getSignedURL(String, Integer, String, String, String, String, String, String, Boolean, Boolean, String) + */ + public ResponseEntity upload(@NonNull String path, + String catalogId, + String accountId, + String projectId, + String spaceId, + Boolean override, + String signature, + Boolean inflate, + Boolean ensureDir, + Boolean root, + File body) + throws RestClientException, + IllegalArgumentException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("path", path); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "override", override)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "signature", signature)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "inflate", inflate)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "ensure_dir", ensureDir)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"multipart/form-data"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeFileUploadAPI( + BASE_API + "/{path}", HttpMethod.PUT, + pathParams, queryParams, body, headerParams, cookieParams, + formParams, localVarAccept, localVarContentType, localVarReturnType); + + } + + /** + * Get auth signature. + * Generate a signed URL that can be used to access specific API calls. Only + * supports service auth with editor permission. A signed URL will be returned + * in the response body as plain text. An encoded version of the same url will + * be sent in the 'Location' header. + * @param path The path to asset you wish to make signed url for. + * @param expiresIn TTL in seconds. + * @param catalogId The catalog id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param accountId The catalog id the file is associated with. One of + * catalog, project, space or account id is required. + * @param projectId The project id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param spaceId The space id the file should be associated with. One of + * catalog, project, space or account id is required. + * @param contentType Optional content type (to override the defaults of asset + * being requested) + * @param contentDisposition Optional (to override the defaults) - must be + * URIEncoded as it can contain spaces if filename is used. + * @param root Whether to access the path from root. + * @param inflate Only useful for put. Will allow signed url to act as inflate + * request. + * @param method Accepts 'get' (download) or 'put' (upload). (Defaults to + * 'get' if not supplied) + * @return String + * @throws RestClientException if an error occurs while attempting to invoke + * the API + */ + public Mono getSignedURL(@NonNull String path, + @NonNull Integer expiresIn, + String catalogId, + String accountId, + String projectId, + String spaceId, + String contentType, + String contentDisposition, + Boolean root, + Boolean inflate, + String method) throws RestClientException { + + // create path and map variables + final Map pathParams = new HashMap<>(); + + pathParams.put("path", path); + + final MultiValueMap queryParams = new LinkedMultiValueMap<>(); + final HttpHeaders headerParams = new HttpHeaders(); + final MultiValueMap cookieParams = new LinkedMultiValueMap<>(); + final MultiValueMap formParams = new LinkedMultiValueMap<>(); + + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "catalog_id", catalogId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "account_id", accountId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "project_id", projectId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "space_id", spaceId)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "content_type", contentType)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "content_disposition", contentDisposition)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "expires_in", expiresIn)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "root", root)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "inflate", inflate)); + queryParams.putAll(apiClient.parameterToMultiValueMap(null, "method", method)); + + final String[] localVarAccepts = {"application/json", "text/html", "text/plain"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + ParameterizedTypeReference localVarReturnType = new ParameterizedTypeReference() {}; + return apiClient.invokeAPI(BASE_API + "/{path}/signed", HttpMethod.POST, + pathParams, queryParams, null, headerParams, + cookieParams, formParams, localVarAccept, + localVarContentType, localVarReturnType); + + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/AnalysisSummary.java b/java/src/main/java/com/ibm/watson/data/client/model/AnalysisSummary.java new file mode 100644 index 0000000..1fef9f4 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/AnalysisSummary.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * AnalysisSummary + */ +public class AnalysisSummary { + + private Integer score; + private ScoreStats scoreStats; + private List problemDistribution; + + @javax.annotation.Nullable + @JsonProperty("score") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getScore() { return score; } + public void setScore(Integer score) { this.score = score; } + + @javax.annotation.Nullable + @JsonProperty("score_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getScoreStats() { return scoreStats; } + public void setScoreStats(ScoreStats scoreStats) { this.scoreStats = scoreStats; } + + @javax.annotation.Nullable + @JsonProperty("problem_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getProblemDistribution() { return problemDistribution; } + public void setProblemDistribution(List problemDistribution) { this.problemDistribution = problemDistribution; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AnalysisSummary that = (AnalysisSummary) o; + return Objects.equals(score, that.score) && + Objects.equals(scoreStats, that.scoreStats) && + Objects.equals(problemDistribution, that.problemDistribution); + } + + @Override + public int hashCode() { + return Objects.hash(score, scoreStats, problemDistribution); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnalysisSummary {\n"); + toString(sb); + sb.append("}"); + return sb.toString(); + } + + protected void toString(StringBuilder sb) { + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" scoreStats: ").append(toIndentedString(scoreStats)).append("\n"); + sb.append(" problemDistribution: ").append(toIndentedString(problemDistribution)).append("\n"); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + protected String toIndentedString(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/AssetFileMetadata.java b/java/src/main/java/com/ibm/watson/data/client/model/AssetFileMetadata.java new file mode 100644 index 0000000..f4be67d --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/AssetFileMetadata.java @@ -0,0 +1,166 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * AssetFileMetadata + */ +public class AssetFileMetadata { + + private String path; + private String etag; + private Integer size; + private String type; + private String mimeType; + private String lastModifed; + + public AssetFileMetadata path(String path) { + this.path = path; + return this; + } + + /** + * The path of the file. + * @return path + **/ + @javax.annotation.Nullable + @JsonProperty("path") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getPath() { return path; } + public void setPath(String path) { this.path = path; } + + public AssetFileMetadata etag(String etag) { + this.etag = etag; + return this; + } + + /** + * ETAG for the resource. + * @return etag + **/ + @javax.annotation.Nullable + @JsonProperty("etag") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getEtag() { return etag; } + public void setEtag(String etag) { this.etag = etag; } + + public AssetFileMetadata size(Integer size) { + this.size = size; + return this; + } + + /** + * The size in bytes for files. The number of resource for folders. + * @return size + **/ + @javax.annotation.Nullable + @JsonProperty("size") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getSize() { return size; } + public void setSize(Integer size) { this.size = size; } + + public AssetFileMetadata type(String type) { + this.type = type; + return this; + } + + /** + * Either folder or file. + * @return type + **/ + @javax.annotation.Nullable + @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getType() { return type; } + public void setType(String type) { this.type = type; } + + public AssetFileMetadata mimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * If the resource is a file this will be the mime type of the file. + * @return mimeType + **/ + @javax.annotation.Nullable + @JsonProperty("mime_type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getMimeType() { return mimeType; } + public void setMimeType(String mimeType) { this.mimeType = mimeType; } + + public AssetFileMetadata lastModifed(String lastModifed) { + this.lastModifed = lastModifed; + return this; + } + + /** + * Time when the asset was last modified, defaults to create date. Returned in + * json timestamp format. (Yes, this is spelled wrong, as it is spelled wrong in the API itself.) + * @return lastModifed + **/ + @javax.annotation.Nullable + @JsonProperty("last_modifed") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getLastModifed() { return lastModifed; } + public void setLastModifed(String lastModifed) { this.lastModifed = lastModifed; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + AssetFileMetadata assetFileMetadata = (AssetFileMetadata)o; + return Objects.equals(this.path, assetFileMetadata.path) && + Objects.equals(this.etag, assetFileMetadata.etag) && + Objects.equals(this.size, assetFileMetadata.size) && + Objects.equals(this.type, assetFileMetadata.type) && + Objects.equals(this.mimeType, assetFileMetadata.mimeType) && + Objects.equals(this.lastModifed, assetFileMetadata.lastModifed); + } + + @Override + public int hashCode() { + return Objects.hash(path, etag, size, type, mimeType, lastModifed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetFileMetadata {\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" etag: ").append(toIndentedString(etag)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" lastModifed: ").append(toIndentedString(lastModifed)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/AttachmentDetail.java b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentDetail.java new file mode 100644 index 0000000..db0ea35 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentDetail.java @@ -0,0 +1,194 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Date; +import java.util.Objects; + +/** + * AttachmentDetail + */ +public class AttachmentDetail extends AttachmentHeader { + + private String attachmentId; + private Date createdAt; + private Boolean objectKeyIsReadOnly; + private String datasourceType; + private String url; + private Boolean transferComplete; + private Long size; + private String creatorId; + private MetadataUsage usage; + private String href; + + public AttachmentDetail attachmentId(String attachmentId) { + this.attachmentId = attachmentId; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("attachment_id") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getAttachmentId() { return attachmentId; } + public void setAttachmentId(String attachmentId) { this.attachmentId = attachmentId; } + + public AttachmentDetail createdAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("created_at") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Date getCreatedAt() { return createdAt; } + public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } + + public AttachmentDetail objectKeyIsReadOnly(Boolean objectKeyIsReadOnly) { + this.objectKeyIsReadOnly = objectKeyIsReadOnly; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("object_key_is_read_only") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Boolean getObjectKeyIsReadOnly() { return objectKeyIsReadOnly; } + public void setObjectKeyIsReadOnly(Boolean objectKeyIsReadOnly) { this.objectKeyIsReadOnly = objectKeyIsReadOnly; } + + public AttachmentDetail datasourceType(String datasourceType) { + this.datasourceType = datasourceType; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("datasource_type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getDatasourceType() { return datasourceType; } + public void setDatasourceType(String datasourceType) { this.datasourceType = datasourceType; } + + public AttachmentDetail url(String url) { + this.url = url; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("url") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getUrl() { return url; } + public void setUrl(String url) { this.url = url; } + + public AttachmentDetail transferComplete(Boolean transferComplete) { + this.transferComplete = transferComplete; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("transfer_complete") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Boolean getTransferComplete() { return transferComplete; } + public void setTransferComplete(Boolean transferComplete) { this.transferComplete = transferComplete; } + + public AttachmentDetail size(Long size) { + this.size = size; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("size") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getSize() { return size; } + public void setSize(Long size) { this.size = size; } + + public AttachmentDetail creatorId(String creatorId) { + this.creatorId = creatorId; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("creator_id") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getCreatorId() { return creatorId; } + public void setCreatorId(String creatorId) { this.creatorId = creatorId; } + + public AttachmentDetail usage(MetadataUsage usage) { + this.usage = usage; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("usage") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public MetadataUsage getUsage() { return usage; } + public void setUsage(MetadataUsage usage) { this.usage = usage; } + + public AttachmentDetail href(String href) { + this.href = href; + return this; + } + + @javax.annotation.Nullable + @JsonProperty("href") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getHref() { return href; } + public void setHref(String href) { this.href = href; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + AttachmentDetail that = (AttachmentDetail) o; + return super.equals(o) && + Objects.equals(attachmentId, that.attachmentId) && + Objects.equals(createdAt, that.createdAt) && + Objects.equals(objectKeyIsReadOnly, that.objectKeyIsReadOnly) && + Objects.equals(datasourceType, that.datasourceType) && + Objects.equals(url, that.url) && + Objects.equals(transferComplete, that.transferComplete) && + Objects.equals(size, that.size) && + Objects.equals(creatorId, that.creatorId) && + Objects.equals(usage, that.usage) && + Objects.equals(href, that.href); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), attachmentId, createdAt, objectKeyIsReadOnly, + datasourceType, url, transferComplete, size, creatorId, usage, href); + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("AttachmentDetail{"); + sb.append("class AttachmentDetail {\n"); + super.toString(sb); + sb.append(" attachmentId: ").append(toIndentedString(attachmentId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" objectKeyIsReadOnly: ").append(toIndentedString(objectKeyIsReadOnly)).append("\n"); + sb.append(" datasourceType: ").append(toIndentedString(datasourceType)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" transferComplete: ").append(toIndentedString(transferComplete)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" creatorId: ").append(toIndentedString(creatorId)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/AttachmentIncRes.java b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentIncRes.java new file mode 100644 index 0000000..b4458bc --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentIncRes.java @@ -0,0 +1,93 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * AttachmentIncRes + */ +public class AttachmentIncRes { + + private Integer dataPartitions; + private Boolean privateUrl; + + public AttachmentIncRes dataPartitions(Integer dataPartitions) { + this.dataPartitions = dataPartitions; + return this; + } + + /** + * Get dataPartitions + * @return dataPartitions + **/ + @JsonProperty("data_partitions") + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getDataPartitions() { return dataPartitions; } + public void setDataPartitions(Integer dataPartitions) { this.dataPartitions = dataPartitions; } + + public AttachmentIncRes privateUrl(Boolean privateUrl) { + this.privateUrl = privateUrl; + return this; + } + + /** + * Get privateUrl + * @return privateUrl + **/ + @javax.annotation.Nullable + @JsonProperty("private_url") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Boolean getPrivateUrl() { return privateUrl; } + public void setPrivateUrl(Boolean privateUrl) { this.privateUrl = privateUrl; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + AttachmentIncRes attachmentIncRes = (AttachmentIncRes)o; + return Objects.equals(this.dataPartitions, + attachmentIncRes.dataPartitions) && + Objects.equals(this.privateUrl, attachmentIncRes.privateUrl); + } + + @Override + public int hashCode() { + return Objects.hash(dataPartitions, privateUrl); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AttachmentIncRes {\n"); + sb.append(" dataPartitions: ").append(toIndentedString(dataPartitions)).append("\n"); + sb.append(" privateUrl: ").append(toIndentedString(privateUrl)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/AttachmentRequest.java b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentRequest.java new file mode 100644 index 0000000..4a01e8d --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/AttachmentRequest.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * Attachment + */ +public class AttachmentRequest extends AttachmentHeader { + + private Integer dataPartitions; + private Boolean privateUrl; + private Boolean objectKeyIsReadOnly; + + public AttachmentRequest dataPartitions(Integer dataPartitions) { + this.dataPartitions = dataPartitions; + return this; + } + + /** + * Get dataPartitions + * @return dataPartitions + **/ + @javax.annotation.Nullable + @JsonProperty("data_partitions") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getDataPartitions() { return dataPartitions; } + public void setDataPartitions(Integer dataPartitions) { this.dataPartitions = dataPartitions; } + + public AttachmentRequest privateUrl(Boolean privateUrl) { + this.privateUrl = privateUrl; + return this; + } + + /** + * Get privateUrl + * @return privateUrl + **/ + @javax.annotation.Nullable + @JsonProperty("private_url") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Boolean getPrivateUrl() { return privateUrl; } + public void setPrivateUrl(Boolean privateUrl) { this.privateUrl = privateUrl; } + + public AttachmentRequest objectKeyIsReadOnly(Boolean objectKeyIsReadOnly) { + this.objectKeyIsReadOnly = objectKeyIsReadOnly; + return this; + } + + /** + * Get objectKeyIsReadOnly + * @return objectKeyIsReadOnly + **/ + @javax.annotation.Nullable + @JsonProperty("object_key_is_read_only") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Boolean getObjectKeyIsReadOnly() { return objectKeyIsReadOnly; } + public void setObjectKeyIsReadOnly(Boolean objectKeyIsReadOnly) { this.objectKeyIsReadOnly = objectKeyIsReadOnly; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + AttachmentRequest that = (AttachmentRequest)o; + return super.equals(o) && + Objects.equals(this.dataPartitions, that.dataPartitions) && + Objects.equals(this.privateUrl, that.privateUrl) && + Objects.equals(this.objectKeyIsReadOnly, that.objectKeyIsReadOnly); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), dataPartitions, privateUrl, objectKeyIsReadOnly); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Attachment {\n"); + super.toString(sb); + sb.append(" dataPartitions: ").append(toIndentedString(dataPartitions)).append("\n"); + sb.append(" privateUrl: ").append(toIndentedString(privateUrl)).append("\n"); + sb.append(" objectKeyIsReadOnly: ").append(toIndentedString(objectKeyIsReadOnly)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/CodeCount.java b/java/src/main/java/com/ibm/watson/data/client/model/CodeCount.java new file mode 100644 index 0000000..0de5443 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/CodeCount.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * CodeCount + */ +public class CodeCount { + + private CodeValue value; + private Long count; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public CodeValue getValue() { return value; } + public void setValue(CodeValue value) { this.value = value; } + + @javax.annotation.Nullable + @JsonProperty("count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getCount() { return count; } + public void setCount(Long count) { this.count = count; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodeCount codeCount = (CodeCount) o; + return Objects.equals(value, codeCount.value) && + Objects.equals(count, codeCount.count); + } + + @Override + public int hashCode() { + return Objects.hash(value, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CodeCount {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/CodeValue.java b/java/src/main/java/com/ibm/watson/data/client/model/CodeValue.java new file mode 100644 index 0000000..fbff1de --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/CodeValue.java @@ -0,0 +1,67 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * CodeValue + */ +public class CodeValue { + + private String code; + + @javax.annotation.Nullable + @JsonProperty("code") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getCode() { return code; } + public void setCode(String code) { this.code = code; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CodeValue codeValue = (CodeValue) o; + return Objects.equals(code, codeValue.code); + } + + @Override + public int hashCode() { + return Objects.hash(code); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CodeValue {\n"); + sb.append(" code: ").append(toIndentedString(code)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DataProfileAttachment.java b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileAttachment.java new file mode 100644 index 0000000..39c182b --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileAttachment.java @@ -0,0 +1,77 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * DataProfileAttachment + */ +public class DataProfileAttachment { + + private DataProfileSummary summary; + private List columns; + + @javax.annotation.Nullable + @JsonProperty("summary") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public DataProfileSummary getSummary() { return summary; } + public void setSummary(DataProfileSummary summary) { this.summary = summary; } + + @javax.annotation.Nullable + @JsonProperty("columns") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getColumns() { return columns; } + public void setColumns(List columns) { this.columns = columns; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DataProfileAttachment that = (DataProfileAttachment) o; + return Objects.equals(summary, that.summary) && + Objects.equals(columns, that.columns); + } + + @Override + public int hashCode() { + return Objects.hash(summary, columns); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataProfileAttachment {\n"); + sb.append(" summary: ").append(toIndentedString(summary)).append("\n"); + sb.append(" columns: ").append(toIndentedString(columns)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DataProfileColumn.java b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileColumn.java new file mode 100644 index 0000000..d9ccd58 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileColumn.java @@ -0,0 +1,85 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DataProfileColumn + */ +public class DataProfileColumn { + + private String name; + private ValueAnalysis valueAnalysis; + private AnalysisSummary qualityAnalysis; + + @javax.annotation.Nullable + @JsonProperty("name") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getName() { return name; } + public void setName(String name) { this.name = name; } + + @javax.annotation.Nullable + @JsonProperty("value_analysis") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ValueAnalysis getValueAnalysis() { return valueAnalysis; } + public void setValueAnalysis(ValueAnalysis valueAnalysis) { this.valueAnalysis = valueAnalysis; } + + @javax.annotation.Nullable + @JsonProperty("quality_analysis") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public AnalysisSummary getQualityAnalysis() { return qualityAnalysis; } + public void setQualityAnalysis(AnalysisSummary qualityAnalysis) { this.qualityAnalysis = qualityAnalysis; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DataProfileColumn that = (DataProfileColumn) o; + return Objects.equals(name, that.name) && + Objects.equals(valueAnalysis, that.valueAnalysis) && + Objects.equals(qualityAnalysis, that.qualityAnalysis); + } + + @Override + public int hashCode() { + return Objects.hash(name, valueAnalysis, qualityAnalysis); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataProfileColumn {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" valueAnalysis: ").append(toIndentedString(valueAnalysis)).append("\n"); + sb.append(" qualityAnalysis: ").append(toIndentedString(qualityAnalysis)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DataProfileSummary.java b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileSummary.java new file mode 100644 index 0000000..6264c8e --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DataProfileSummary.java @@ -0,0 +1,107 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * DataProfileSummary + */ +public class DataProfileSummary extends AnalysisSummary { + + private String version; + private Long rowCount; + private List typeDistribution; + private List logicalTypeDistribution; + private List classDistribution; + private List dataprofileClassification; + + @javax.annotation.Nullable + @JsonProperty("version") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getVersion() { return version; } + public void setVersion(String version) { this.version = version; } + + @javax.annotation.Nullable + @JsonProperty("row_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getRowCount() { return rowCount; } + public void setRowCount(Long rowCount) { this.rowCount = rowCount; } + + @javax.annotation.Nullable + @JsonProperty("type_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getTypeDistribution() { return typeDistribution; } + public void setTypeDistribution(List typeDistribution) { this.typeDistribution = typeDistribution; } + + @javax.annotation.Nullable + @JsonProperty("logical_type_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getLogicalTypeDistribution() { return logicalTypeDistribution; } + public void setLogicalTypeDistribution(List logicalTypeDistribution) { this.logicalTypeDistribution = logicalTypeDistribution; } + + @javax.annotation.Nullable + @JsonProperty("class_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getClassDistribution() { return classDistribution; } + public void setClassDistribution(List classDistribution) { this.classDistribution = classDistribution; } + + @javax.annotation.Nullable + @JsonProperty("dataprofile_classification") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getDataprofileClassification() { return dataprofileClassification; } + public void setDataprofileClassification(List dataprofileClassification) { this.dataprofileClassification = dataprofileClassification; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DataProfileSummary that = (DataProfileSummary) o; + return super.equals(o) && + Objects.equals(version, that.version) && + Objects.equals(rowCount, that.rowCount) && + Objects.equals(typeDistribution, that.typeDistribution) && + Objects.equals(logicalTypeDistribution, that.logicalTypeDistribution) && + Objects.equals(classDistribution, that.classDistribution) && + Objects.equals(dataprofileClassification, that.dataprofileClassification); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), version, rowCount, + typeDistribution, logicalTypeDistribution, classDistribution, dataprofileClassification); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DataProfileSummary {\n"); + super.toString(sb); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" rowCount: ").append(toIndentedString(rowCount)).append("\n"); + sb.append(" typeDistribution: ").append(toIndentedString(typeDistribution)).append("\n"); + sb.append(" logicalTypeDistribution: ").append(toIndentedString(logicalTypeDistribution)).append("\n"); + sb.append(" classDistribution: ").append(toIndentedString(classDistribution)).append("\n"); + sb.append(" dataprofileClassification: ").append(toIndentedString(dataprofileClassification)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DateStats.java b/java/src/main/java/com/ibm/watson/data/client/model/DateStats.java new file mode 100644 index 0000000..d977c28 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DateStats.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * DateStats + */ +public class DateStats { + + private Long count; + private String mean; + private Double variance; + private List bins; + + @javax.annotation.Nullable + @JsonProperty("count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getCount() { return count; } + public void setCount(Long count) { this.count = count; } + + @javax.annotation.Nullable + @JsonProperty("mean") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getMean() { return mean; } + public void setMean(String mean) { this.mean = mean; } + + @javax.annotation.Nullable + @JsonProperty("variance") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getVariance() { return variance; } + public void setVariance(Double variance) { this.variance = variance; } + + @javax.annotation.Nullable + @JsonProperty("bins") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getBins() { return bins; } + public void setBins(List bins) { this.bins = bins; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DateStats that = (DateStats) o; + return Objects.equals(count, that.count) && + Objects.equals(mean, that.mean) && + Objects.equals(variance, that.variance) && + Objects.equals(bins, that.bins); + } + + @Override + public int hashCode() { + return Objects.hash(count, mean, variance, bins); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DateStats {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" mean: ").append(toIndentedString(mean)).append("\n"); + sb.append(" variance: ").append(toIndentedString(variance)).append("\n"); + sb.append(" bins: ").append(toIndentedString(bins)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClass.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClass.java new file mode 100644 index 0000000..c5463da --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClass.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredClass + */ +public class DiscoveredClass { + + private CodeValue dataClass; + private Integer priority; + + @javax.annotation.Nullable + @JsonProperty("class") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public CodeValue getDataClass() { return dataClass; } + public void setDataClass(CodeValue dataClass) { this.dataClass = dataClass; } + + @javax.annotation.Nullable + @JsonProperty("priority") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getPriority() { return priority; } + public void setPriority(Integer priority) { this.priority = priority; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredClass that = (DiscoveredClass) o; + return Objects.equals(dataClass, that.dataClass) && + Objects.equals(priority, that.priority); + } + + @Override + public int hashCode() { + return Objects.hash(dataClass, priority); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredClass {\n"); + sb.append(" class: ").append(toIndentedString(dataClass)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClassDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClassDetails.java new file mode 100644 index 0000000..47a6911 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredClassDetails.java @@ -0,0 +1,60 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredClassDetails + */ +public class DiscoveredClassDetails extends DiscoveredDetails { + + private CodeValue value; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public CodeValue getValue() { return value; } + public void setValue(CodeValue value) { this.value = value; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredClassDetails that = (DiscoveredClassDetails) o; + return super.equals(o) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredClassDetails {\n"); + super.toString(sb); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredDetails.java new file mode 100644 index 0000000..81f134a --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredDetails.java @@ -0,0 +1,98 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredDetails + */ +public class DiscoveredDetails { + + private Long count; + private Long distinctCount; + private Double confidence; + private Integer priority; + + @javax.annotation.Nullable + @JsonProperty("count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getCount() { return count; } + public void setCount(Long count) { this.count = count; } + + @javax.annotation.Nullable + @JsonProperty("distinct_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getDistinctCount() { return distinctCount; } + public void setDistinctCount(Long distinctCount) { this.distinctCount = distinctCount; } + + @javax.annotation.Nullable + @JsonProperty("confidence") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getConfidence() { return confidence; } + public void setConfidence(Double confidence) { this.confidence = confidence; } + + @javax.annotation.Nullable + @JsonProperty("priority") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getPriority() { return priority; } + public void setPriority(Integer priority) { this.priority = priority; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredDetails that = (DiscoveredDetails) o; + return Objects.equals(count, that.count) && + Objects.equals(distinctCount, that.distinctCount) && + Objects.equals(confidence, that.confidence) && + Objects.equals(priority, that.priority); + } + + @Override + public int hashCode() { + return Objects.hash(count, distinctCount, confidence, priority); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredDetails {\n"); + toString(sb); + sb.append("}"); + return sb.toString(); + } + + protected void toString(StringBuilder sb) { + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" distinctCount: ").append(toIndentedString(distinctCount)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" priority: ").append(toIndentedString(priority)).append("\n"); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + protected String toIndentedString(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormat.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormat.java new file mode 100644 index 0000000..cfbdf70 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormat.java @@ -0,0 +1,67 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredFormat + */ +public class DiscoveredFormat { + + private Object format; + + @javax.annotation.Nullable + @JsonProperty("format") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Object getFormat() { return format; } + public void setFormat(Object format) { this.format = format; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredFormat that = (DiscoveredFormat) o; + return Objects.equals(format, that.format); + } + + @Override + public int hashCode() { + return Objects.hash(format); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredFormat {\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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormatDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormatDetails.java new file mode 100644 index 0000000..14c4924 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredFormatDetails.java @@ -0,0 +1,60 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredFormatDetails + */ +public class DiscoveredFormatDetails extends DiscoveredDetails { + + private Object value; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Object getValue() { return value; } + public void setValue(Object value) { this.value = value; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredFormatDetails that = (DiscoveredFormatDetails) o; + return super.equals(o) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredFormatDetails {\n"); + super.toString(sb); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredNumericDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredNumericDetails.java new file mode 100644 index 0000000..c3401a9 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredNumericDetails.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredNumericDetails + */ +public class DiscoveredNumericDetails extends DiscoveredDetails { + + private Integer value; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getValue() { return value; } + public void setValue(Integer value) { this.value = value; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + DiscoveredNumericDetails that = (DiscoveredNumericDetails) o; + return super.equals(o) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredNumericDetails {\n"); + super.toString(sb); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredStringDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredStringDetails.java new file mode 100644 index 0000000..0cb1fdb --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredStringDetails.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredStringDetails + */ +public class DiscoveredStringDetails extends DiscoveredDetails { + + private String value; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getValue() { return value; } + public void setValue(String value) { this.value = value; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + DiscoveredStringDetails that = (DiscoveredStringDetails) o; + return super.equals(o) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredStringDetails {\n"); + super.toString(sb); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredType.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredType.java new file mode 100644 index 0000000..e9a3a5f --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredType.java @@ -0,0 +1,67 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredType + */ +public class DiscoveredType { + + private TypeDetails type; + + @javax.annotation.Nullable + @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public TypeDetails getType() { return type; } + public void setType(TypeDetails type) { this.type = type; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DiscoveredType that = (DiscoveredType) o; + return Objects.equals(type, that.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredType {\n"); + sb.append(" type: ").append(toIndentedString(type)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredTypeDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredTypeDetails.java new file mode 100644 index 0000000..8d6c8da --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/DiscoveredTypeDetails.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * DiscoveredTypeDetails + */ +public class DiscoveredTypeDetails extends DiscoveredDetails { + + private TypeDetails value; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public TypeDetails getValue() { return value; } + public void setValue(TypeDetails value) { this.value = value; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + DiscoveredTypeDetails that = (DiscoveredTypeDetails) o; + return super.equals(o) && + Objects.equals(value, that.value); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscoveredTypeDetails {\n"); + super.toString(sb); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/FileDeleteResponse.java b/java/src/main/java/com/ibm/watson/data/client/model/FileDeleteResponse.java new file mode 100644 index 0000000..2f8a944 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/FileDeleteResponse.java @@ -0,0 +1,85 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * FileDeleteResponse + */ +public class FileDeleteResponse { + + private List> results = null; + + public FileDeleteResponse results(List> results) { + this.results = results; + return this; + } + + public FileDeleteResponse addResultsItem(List resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * @return results + **/ + @javax.annotation.Nullable + @JsonProperty("results") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List> getResults() { return results; } + public void setResults(List> results) { this.results = results; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + FileDeleteResponse fileDeleteResponse = (FileDeleteResponse)o; + return Objects.equals(this.results, fileDeleteResponse.results); + } + + @Override + public int hashCode() { + return Objects.hash(results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileDeleteResponse {\n"); + sb.append(" results: ").append(toIndentedString(results)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/NumericStats.java b/java/src/main/java/com/ibm/watson/data/client/model/NumericStats.java new file mode 100644 index 0000000..dd7fb1b --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/NumericStats.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * NumericStats + */ +public class NumericStats { + + private Long count; + private Double mean; + private Double variance; + private List bins; + + @javax.annotation.Nullable + @JsonProperty("count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getCount() { return count; } + public void setCount(Long count) { this.count = count; } + + @javax.annotation.Nullable + @JsonProperty("mean") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getMean() { return mean; } + public void setMean(Double mean) { this.mean = mean; } + + @javax.annotation.Nullable + @JsonProperty("variance") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getVariance() { return variance; } + public void setVariance(Double variance) { this.variance = variance; } + + @javax.annotation.Nullable + @JsonProperty("bins") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getBins() { return bins; } + public void setBins(List bins) { this.bins = bins; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + NumericStats that = (NumericStats) o; + return Objects.equals(count, that.count) && + Objects.equals(mean, that.mean) && + Objects.equals(variance, that.variance) && + Objects.equals(bins, that.bins); + } + + @Override + public int hashCode() { + return Objects.hash(count, mean, variance, bins); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumericStats {\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" mean: ").append(toIndentedString(mean)).append("\n"); + sb.append(" variance: ").append(toIndentedString(variance)).append("\n"); + sb.append(" bins: ").append(toIndentedString(bins)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/PaginatedAssetFileListResponse.java b/java/src/main/java/com/ibm/watson/data/client/model/PaginatedAssetFileListResponse.java new file mode 100644 index 0000000..6fbd713 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/PaginatedAssetFileListResponse.java @@ -0,0 +1,212 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * PageinatedAssetFileListResponse + */ +public class PaginatedAssetFileListResponse { + + private Integer totalCount; + private Integer limit; + private Integer offset; + private HrefModel first; + private HrefModel last; + private HrefModel next; + private HrefModel previous; + private List resources = null; + + public PaginatedAssetFileListResponse totalCount(Integer totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * The total number of resource for the query. + * @return totalCount + **/ + @javax.annotation.Nullable + @JsonProperty("total_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getTotalCount() { return totalCount; } + public void setTotalCount(Integer totalCount) { this.totalCount = totalCount; } + + public PaginatedAssetFileListResponse limit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * The limit used for the request. + * @return limit + **/ + @javax.annotation.Nullable + @JsonProperty("limit") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getLimit() { return limit; } + public void setLimit(Integer limit) { this.limit = limit; } + + public PaginatedAssetFileListResponse offset(Integer offset) { + this.offset = offset; + return this; + } + + /** + * The offset used for the request. + * @return offset + **/ + @javax.annotation.Nullable + @JsonProperty("offset") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getOffset() { return offset; } + public void setOffset(Integer offset) { this.offset = offset; } + + public PaginatedAssetFileListResponse first(HrefModel first) { + this.first = first; + return this; + } + + /** + * Get first + * @return first + **/ + @javax.annotation.Nullable + @JsonProperty("first") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public HrefModel getFirst() { return first; } + public void setFirst(HrefModel first) { this.first = first; } + + public PaginatedAssetFileListResponse last(HrefModel last) { + this.last = last; + return this; + } + + /** + * Get last + * @return last + **/ + @javax.annotation.Nullable + @JsonProperty("last") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public HrefModel getLast() { return last; } + public void setLast(HrefModel last) { this.last = last; } + + public PaginatedAssetFileListResponse next(HrefModel next) { + this.next = next; + return this; + } + + /** + * Get next + * @return next + **/ + @javax.annotation.Nullable + @JsonProperty("next") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public HrefModel getNext() { return next; } + public void setNext(HrefModel next) { this.next = next; } + + public PaginatedAssetFileListResponse previous(HrefModel previous) { + this.previous = previous; + return this; + } + + /** + * Get previous + * @return previous + **/ + @javax.annotation.Nullable + @JsonProperty("previous") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public HrefModel getPrevious() { return previous; } + public void setPrevious(HrefModel previous) { this.previous = previous; } + + public PaginatedAssetFileListResponse resources(List resources) { + this.resources = resources; + return this; + } + + public PaginatedAssetFileListResponse addResourcesItem(AssetFileMetadata resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * @return resources + **/ + @javax.annotation.Nullable + @JsonProperty("resources") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getResources() { return resources; } + public void setResources(List resources) { this.resources = resources; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + PaginatedAssetFileListResponse paginatedAssetFileListResponse = (PaginatedAssetFileListResponse)o; + return Objects.equals(this.totalCount, paginatedAssetFileListResponse.totalCount) && + Objects.equals(this.limit, paginatedAssetFileListResponse.limit) && + Objects.equals(this.offset, paginatedAssetFileListResponse.offset) && + Objects.equals(this.first, paginatedAssetFileListResponse.first) && + Objects.equals(this.last, paginatedAssetFileListResponse.last) && + Objects.equals(this.next, paginatedAssetFileListResponse.next) && + Objects.equals(this.previous, paginatedAssetFileListResponse.previous) && + Objects.equals(this.resources, paginatedAssetFileListResponse.resources); + } + + @Override + public int hashCode() { + return Objects.hash(totalCount, limit, offset, first, last, next, previous, + resources); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PageinatedAssetFileListResponse {\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" first: ").append(toIndentedString(first)).append("\n"); + sb.append(" last: ").append(toIndentedString(last)).append("\n"); + sb.append(" next: ").append(toIndentedString(next)).append("\n"); + sb.append(" previous: ").append(toIndentedString(previous)).append("\n"); + sb.append(" resources: ").append(toIndentedString(resources)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/ScoreStats.java b/java/src/main/java/com/ibm/watson/data/client/model/ScoreStats.java new file mode 100644 index 0000000..24867de --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/ScoreStats.java @@ -0,0 +1,121 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * ScoreStats + */ +public class ScoreStats { + + private Long n; + private Double mean; + private Double variance; + private Double stddev; + private Double min; + private Double max; + private Double sum; + + @javax.annotation.Nullable + @JsonProperty("n") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getN() { return n; } + public void setN(Long n) { this.n = n; } + + @javax.annotation.Nullable + @JsonProperty("mean") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getMean() { return mean; } + public void setMean(Double mean) { this.mean = mean; } + + @javax.annotation.Nullable + @JsonProperty("variance") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getVariance() { return variance; } + public void setVariance(Double variance) { this.variance = variance; } + + @javax.annotation.Nullable + @JsonProperty("stddev") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getStddev() { return stddev; } + public void setStddev(Double stddev) { this.stddev = stddev; } + + @javax.annotation.Nullable + @JsonProperty("min") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getMin() { return min; } + public void setMin(Double min) { this.min = min; } + + @javax.annotation.Nullable + @JsonProperty("max") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getMax() { return max; } + public void setMax(Double max) { this.max = max; } + + @javax.annotation.Nullable + @JsonProperty("sum") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Double getSum() { return sum; } + public void setSum(Double sum) { this.sum = sum; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ScoreStats that = (ScoreStats) o; + return Objects.equals(n, that.n) && + Objects.equals(mean, that.mean) && + Objects.equals(variance, that.variance) && + Objects.equals(stddev, that.stddev) && + Objects.equals(min, that.min) && + Objects.equals(max, that.max) && + Objects.equals(sum, that.sum); + } + + @Override + public int hashCode() { + return Objects.hash(n, mean, variance, stddev, min, max, sum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScoreStats {\n"); + sb.append(" n: ").append(toIndentedString(n)).append("\n"); + sb.append(" mean: ").append(toIndentedString(mean)).append("\n"); + sb.append(" variance: ").append(toIndentedString(variance)).append("\n"); + sb.append(" stddev: ").append(toIndentedString(stddev)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" sum: ").append(toIndentedString(sum)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/TypeDetails.java b/java/src/main/java/com/ibm/watson/data/client/model/TypeDetails.java new file mode 100644 index 0000000..6cfaf4e --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/TypeDetails.java @@ -0,0 +1,94 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * TypeDetails + */ +public class TypeDetails { + + private Integer length; + private Integer precision; + private Integer scale; + private String type; + + @javax.annotation.Nullable + @JsonProperty("length") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getLength() { return length; } + public void setLength(Integer length) { this.length = length; } + + @javax.annotation.Nullable + @JsonProperty("precision") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getPrecision() { return precision; } + public void setPrecision(Integer precision) { this.precision = precision; } + + @javax.annotation.Nullable + @JsonProperty("scale") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Integer getScale() { return scale; } + public void setScale(Integer scale) { this.scale = scale; } + + @javax.annotation.Nullable + @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getType() { return type; } + public void setType(String type) { this.type = type; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TypeDetails that = (TypeDetails) o; + return Objects.equals(length, that.length) && + Objects.equals(precision, that.precision) && + Objects.equals(scale, that.scale) && + Objects.equals(type, that.type); + } + + @Override + public int hashCode() { + return Objects.hash(length, precision, scale, type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypeDetails {\n"); + sb.append(" length: ").append(toIndentedString(length)).append("\n"); + sb.append(" precision: ").append(toIndentedString(precision)).append("\n"); + sb.append(" scale: ").append(toIndentedString(scale)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/ValueAnalysis.java b/java/src/main/java/com/ibm/watson/data/client/model/ValueAnalysis.java new file mode 100644 index 0000000..f3a01b2 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/ValueAnalysis.java @@ -0,0 +1,335 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; +import java.util.Objects; + +/** + * ValueAnalysis + */ +public class ValueAnalysis { + + private Long distinctCount; + private Long nullCount; + private Long emptyCount; + private Long uniqueCount; + private Long maxValueFrequency; + private String minString; + private String maxString; + private DiscoveredType inferredType; + private DiscoveredClass inferredClass; + private DiscoveredFormat inferredFormat; + private List valueDistribution; + private List valueProblemDistribution; + private List classDistribution; + private List typeDistribution; + private List logicalTypeDistribution; + private List formatDistribution; + private List bigramDistribution; + private List lengthDistribution; + private List precisionDistribution; + private List scaleDistribution; + private List caseDistribution; + private List wordDistribution; + private NumericStats numericStats; + private ScoreStats wordStats; + private ScoreStats alphaCharacterStats; + private ScoreStats digitCharacterStats; + private ScoreStats otherCharacterStats; + private ScoreStats lengthStats; + private DateStats dateStats; + private Object minHashSignature; + + @javax.annotation.Nullable + @JsonProperty("distinct_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getDistinctCount() { return distinctCount; } + public void setDistinctCount(Long distinctCount) { this.distinctCount = distinctCount; } + + @javax.annotation.Nullable + @JsonProperty("null_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getNullCount() { return nullCount; } + public void setNullCount(Long nullCount) { this.nullCount = nullCount; } + + @javax.annotation.Nullable + @JsonProperty("empty_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getEmptyCount() { return emptyCount; } + public void setEmptyCount(Long emptyCount) { this.emptyCount = emptyCount; } + + @javax.annotation.Nullable + @JsonProperty("unique_count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getUniqueCount() { return uniqueCount; } + public void setUniqueCount(Long uniqueCount) { this.uniqueCount = uniqueCount; } + + @javax.annotation.Nullable + @JsonProperty("max_value_frequency") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getMaxValueFrequency() { return maxValueFrequency; } + public void setMaxValueFrequency(Long maxValueFrequency) { this.maxValueFrequency = maxValueFrequency; } + + @javax.annotation.Nullable + @JsonProperty("min_string") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getMinString() { return minString; } + public void setMinString(String minString) { this.minString = minString; } + + @javax.annotation.Nullable + @JsonProperty("max_string") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getMaxString() { return maxString; } + public void setMaxString(String maxString) { this.maxString = maxString; } + + @javax.annotation.Nullable + @JsonProperty("inferred_type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public DiscoveredType getInferredType() { return inferredType; } + public void setInferredType(DiscoveredType inferredType) { this.inferredType = inferredType; } + + @javax.annotation.Nullable + @JsonProperty("inferred_class") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public DiscoveredClass getInferredClass() { return inferredClass; } + public void setInferredClass(DiscoveredClass inferredClass) { this.inferredClass = inferredClass; } + + @javax.annotation.Nullable + @JsonProperty("inferred_format") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public DiscoveredFormat getInferredFormat() { return inferredFormat; } + public void setInferredFormat(DiscoveredFormat inferredFormat) { this.inferredFormat = inferredFormat; } + + @javax.annotation.Nullable + @JsonProperty("value_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getValueDistribution() { return valueDistribution; } + public void setValueDistribution(List valueDistribution) { this.valueDistribution = valueDistribution; } + + @javax.annotation.Nullable + @JsonProperty("value_problem_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getValueProblemDistribution() { return valueProblemDistribution; } + public void setValueProblemDistribution(List valueProblemDistribution) { this.valueProblemDistribution = valueProblemDistribution; } + + @javax.annotation.Nullable + @JsonProperty("class_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getClassDistribution() { return classDistribution; } + public void setClassDistribution(List classDistribution) { this.classDistribution = classDistribution; } + + @javax.annotation.Nullable + @JsonProperty("type_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getTypeDistribution() { return typeDistribution; } + public void setTypeDistribution(List typeDistribution) { this.typeDistribution = typeDistribution; } + + @javax.annotation.Nullable + @JsonProperty("logical_type_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getLogicalTypeDistribution() { return logicalTypeDistribution; } + public void setLogicalTypeDistribution(List logicalTypeDistribution) { this.logicalTypeDistribution = logicalTypeDistribution; } + + @javax.annotation.Nullable + @JsonProperty("format_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getFormatDistribution() { return formatDistribution; } + public void setFormatDistribution(List formatDistribution) { this.formatDistribution = formatDistribution; } + + @javax.annotation.Nullable + @JsonProperty("bigram_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getBigramDistribution() { return bigramDistribution; } + public void setBigramDistribution(List bigramDistribution) { this.bigramDistribution = bigramDistribution; } + + @javax.annotation.Nullable + @JsonProperty("length_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getLengthDistribution() { return lengthDistribution; } + public void setLengthDistribution(List lengthDistribution) { this.lengthDistribution = lengthDistribution; } + + @javax.annotation.Nullable + @JsonProperty("precision_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getPrecisionDistribution() { return precisionDistribution; } + public void setPrecisionDistribution(List precisionDistribution) { this.precisionDistribution = precisionDistribution; } + + @javax.annotation.Nullable + @JsonProperty("scale_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getScaleDistribution() { return scaleDistribution; } + public void setScaleDistribution(List scaleDistribution) { this.scaleDistribution = scaleDistribution; } + + @javax.annotation.Nullable + @JsonProperty("case_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getCaseDistribution() { return caseDistribution; } + public void setCaseDistribution(List caseDistribution) { this.caseDistribution = caseDistribution; } + + @javax.annotation.Nullable + @JsonProperty("word_distribution") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public List getWordDistribution() { return wordDistribution; } + public void setWordDistribution(List wordDistribution) { this.wordDistribution = wordDistribution; } + + @javax.annotation.Nullable + @JsonProperty("numeric_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public NumericStats getNumericStats() { return numericStats; } + public void setNumericStats(NumericStats numericStats) { this.numericStats = numericStats; } + + @javax.annotation.Nullable + @JsonProperty("word_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getWordStats() { return wordStats; } + public void setWordStats(ScoreStats wordStats) { this.wordStats = wordStats; } + + @javax.annotation.Nullable + @JsonProperty("alpha_chatacter_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getAlphaCharacterStats() { return alphaCharacterStats; } + public void setAlphaCharacterStats(ScoreStats alphaCharacterStats) { this.alphaCharacterStats = alphaCharacterStats; } + + @javax.annotation.Nullable + @JsonProperty("digit_chatacter_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getDigitCharacterStats() { return digitCharacterStats; } + public void setDigitCharacterStats(ScoreStats digitCharacterStats) { this.digitCharacterStats = digitCharacterStats; } + + @javax.annotation.Nullable + @JsonProperty("other_chatacter_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getOtherCharacterStats() { return otherCharacterStats; } + public void setOtherCharacterStats(ScoreStats otherCharacterStats) { this.otherCharacterStats = otherCharacterStats; } + + @javax.annotation.Nullable + @JsonProperty("length_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public ScoreStats getLengthStats() { return lengthStats; } + public void setLengthStats(ScoreStats lengthStats) { this.lengthStats = lengthStats; } + + @javax.annotation.Nullable + @JsonProperty("date_stats") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public DateStats getDateStats() { return dateStats; } + public void setDateStats(DateStats dateStats) { this.dateStats = dateStats; } + + @javax.annotation.Nullable + @JsonProperty("min_hash_signature") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Object getMinHashSignature() { return minHashSignature; } + public void setMinHashSignature(Object minHashSignature) { this.minHashSignature = minHashSignature; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ValueAnalysis that = (ValueAnalysis) o; + return Objects.equals(distinctCount, that.distinctCount) && + Objects.equals(nullCount, that.nullCount) && + Objects.equals(emptyCount, that.emptyCount) && + Objects.equals(uniqueCount, that.uniqueCount) && + Objects.equals(maxValueFrequency, that.maxValueFrequency) && + Objects.equals(minString, that.minString) && + Objects.equals(maxString, that.maxString) && + Objects.equals(inferredType, that.inferredType) && + Objects.equals(inferredClass, that.inferredClass) && + Objects.equals(inferredFormat, that.inferredFormat) && + Objects.equals(valueDistribution, that.valueDistribution) && + Objects.equals(valueProblemDistribution, that.valueProblemDistribution) && + Objects.equals(classDistribution, that.classDistribution) && + Objects.equals(typeDistribution, that.typeDistribution) && + Objects.equals(logicalTypeDistribution, that.logicalTypeDistribution) && + Objects.equals(formatDistribution, that.formatDistribution) && + Objects.equals(bigramDistribution, that.bigramDistribution) && + Objects.equals(lengthDistribution, that.lengthDistribution) && + Objects.equals(precisionDistribution, that.precisionDistribution) && + Objects.equals(scaleDistribution, that.scaleDistribution) && + Objects.equals(caseDistribution, that.caseDistribution) && + Objects.equals(wordDistribution, that.wordDistribution) && + Objects.equals(numericStats, that.numericStats) && + Objects.equals(wordStats, that.wordStats) && + Objects.equals(alphaCharacterStats, that.alphaCharacterStats) && + Objects.equals(digitCharacterStats, that.digitCharacterStats) && + Objects.equals(otherCharacterStats, that.otherCharacterStats) && + Objects.equals(lengthStats, that.lengthStats) && + Objects.equals(dateStats, that.dateStats) && + Objects.equals(minHashSignature, that.minHashSignature); + } + + @Override + public int hashCode() { + return Objects.hash(distinctCount, nullCount, emptyCount, uniqueCount, maxValueFrequency, + minString, maxString, inferredType, inferredClass, inferredFormat, valueDistribution, + valueProblemDistribution, classDistribution, typeDistribution, logicalTypeDistribution, + formatDistribution, bigramDistribution, lengthDistribution, precisionDistribution, + scaleDistribution, caseDistribution, wordDistribution, numericStats, wordStats, + alphaCharacterStats, digitCharacterStats, otherCharacterStats, lengthStats, dateStats, + minHashSignature); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValueAnalysis {\n"); + sb.append(" distinctCount: ").append(toIndentedString(distinctCount)).append("\n"); + sb.append(" nullCount: ").append(toIndentedString(nullCount)).append("\n"); + sb.append(" emptyCount: ").append(toIndentedString(emptyCount)).append("\n"); + sb.append(" uniqueCount: ").append(toIndentedString(uniqueCount)).append("\n"); + sb.append(" maxValueFrequency: ").append(toIndentedString(maxValueFrequency)).append("\n"); + sb.append(" minString: ").append(toIndentedString(minString)).append("\n"); + sb.append(" maxString: ").append(toIndentedString(maxString)).append("\n"); + sb.append(" inferredType: ").append(toIndentedString(inferredType)).append("\n"); + sb.append(" inferredClass: ").append(toIndentedString(inferredClass)).append("\n"); + sb.append(" inferredFormat: ").append(toIndentedString(inferredFormat)).append("\n"); + sb.append(" valueDistribution: ").append(toIndentedString(valueDistribution)).append("\n"); + sb.append(" valueProblemDistribution: ").append(toIndentedString(valueProblemDistribution)).append("\n"); + sb.append(" classDistribution: ").append(toIndentedString(classDistribution)).append("\n"); + sb.append(" typeDistribution: ").append(toIndentedString(typeDistribution)).append("\n"); + sb.append(" logicalTypeDistribution: ").append(toIndentedString(logicalTypeDistribution)).append("\n"); + sb.append(" formatDistribution: ").append(toIndentedString(formatDistribution)).append("\n"); + sb.append(" bigramDistribution: ").append(toIndentedString(bigramDistribution)).append("\n"); + sb.append(" lengthDistribution: ").append(toIndentedString(lengthDistribution)).append("\n"); + sb.append(" precisionDistribution: ").append(toIndentedString(precisionDistribution)).append("\n"); + sb.append(" scaleDistribution: ").append(toIndentedString(scaleDistribution)).append("\n"); + sb.append(" caseDistribution: ").append(toIndentedString(caseDistribution)).append("\n"); + sb.append(" wordDistribution: ").append(toIndentedString(wordDistribution)).append("\n"); + sb.append(" numericStats: ").append(toIndentedString(numericStats)).append("\n"); + sb.append(" wordStats: ").append(toIndentedString(wordStats)).append("\n"); + sb.append(" alphaCharacterStats: ").append(toIndentedString(alphaCharacterStats)).append("\n"); + sb.append(" digitCharacterStats: ").append(toIndentedString(digitCharacterStats)).append("\n"); + sb.append(" otherCharacterStats: ").append(toIndentedString(otherCharacterStats)).append("\n"); + sb.append(" lengthStats: ").append(toIndentedString(lengthStats)).append("\n"); + sb.append(" dateStats: ").append(toIndentedString(dateStats)).append("\n"); + sb.append(" minHashSignature: ").append(toIndentedString(minHashSignature)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/ValueCount.java b/java/src/main/java/com/ibm/watson/data/client/model/ValueCount.java new file mode 100644 index 0000000..c8c75fe --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/ValueCount.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * ValueCount + */ +public class ValueCount { + + private String value; + private Long count; + + @javax.annotation.Nullable + @JsonProperty("value") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getValue() { return value; } + public void setValue(String value) { this.value = value; } + + @javax.annotation.Nullable + @JsonProperty("count") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public Long getCount() { return count; } + public void setCount(Long count) { this.count = count; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ValueCount that = (ValueCount) o; + return Objects.equals(value, that.value) + && Objects.equals(count, that.count); + } + + @Override + public int hashCode() { + return Objects.hash(value, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ValueCount {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/test/java/com/ibm/watson/data/client/mocks/MockServerExpectations.java b/java/src/test/java/com/ibm/watson/data/client/mocks/MockServerExpectations.java index e6b34ef..e3e641b 100644 --- a/java/src/test/java/com/ibm/watson/data/client/mocks/MockServerExpectations.java +++ b/java/src/test/java/com/ibm/watson/data/client/mocks/MockServerExpectations.java @@ -32,8 +32,8 @@ public class MockServerExpectations implements PluginExpectationInitializer { public void initializeExpectations(MockServerClient mockServerClient) { new AccountManagementTest().init(mockServerClient); - //new AssetAttachmentsTest().init(mockServerClient); - //new AssetFilesTest().init(mockServerClient); + new AssetAttachmentsTest().init(mockServerClient); + new AssetFilesTest().init(mockServerClient); new AssetsTest().init(mockServerClient); new AssetTrashTest().init(mockServerClient); new AssetTypesTest().init(mockServerClient); diff --git a/java/src/test/java/com/ibm/watson/data/client/tests/AssetAttachmentsTest.java b/java/src/test/java/com/ibm/watson/data/client/tests/AssetAttachmentsTest.java new file mode 100644 index 0000000..c061ecb --- /dev/null +++ b/java/src/test/java/com/ibm/watson/data/client/tests/AssetAttachmentsTest.java @@ -0,0 +1,145 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.tests; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.ibm.watson.data.client.api.AssetAttachmentsApiV2; +import com.ibm.watson.data.client.mocks.AbstractExpectations; +import com.ibm.watson.data.client.mocks.MockConstants; +import com.ibm.watson.data.client.model.*; +import com.ibm.watson.data.client.model.enums.AssetCategory; +import org.mockserver.client.MockServerClient; +import org.springframework.web.reactive.function.client.WebClientResponseException; +import org.testng.annotations.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ibm.watson.data.client.mocks.MockConstants.*; +import static org.testng.Assert.*; + +/** + * Test the Project Integration API endpoints. + */ +public class AssetAttachmentsTest extends AbstractExpectations { + + private final AssetAttachmentsApiV2 api = new AssetAttachmentsApiV2(MockConstants.getApiClient()); + + public AssetAttachmentsTest() { + super(AssetAttachmentsApiV2.BASE_API, "assetAttachments"); + } + + private final Map> params = new HashMap<>(); + private void setupParams() { + List project = new ArrayList<>(); + project.add(PROJECT_GUID); + params.put("project_id", project); + } + + private static final String attachmentGuid = "704347ba-0184-4bdc-84f5-9072992e6c1c"; + private static final String attachmentGuidEndpoint = "/" + attachmentGuid; + + @Override + public void init(MockServerClient client) { + setupParams(); + injectIntoBaseUrl("{asset_id}", DATAASSET_GUID); + setupTest(client, "POST", "", params, "create", 201); + // TODO: current tests are for a remote asset, so transfer complete is not applicable + setupTest(client, "POST", attachmentGuidEndpoint + "/complete", params, "markTransferComplete", 400); + setupTest(client, "GET", attachmentGuidEndpoint, params, "get"); + setupTest(client, "GET", attachmentGuidEndpoint + "/resources", params, "getResources"); + setupTest(client, "PUT", attachmentGuidEndpoint + "/resources", params, "increaseResources"); + setupTest(client, "PATCH", attachmentGuidEndpoint, params, "update"); + setupTest(client, "PATCH", attachmentGuidEndpoint + "/datasource_type", params, "updateDataSourceType"); + setupTest(client, "DELETE", attachmentGuidEndpoint, params, "delete", 204); + } + + /* + @Test + public void testCreate() { + AttachmentRequest body = readRequestFromFile("create", new TypeReference() {}); + Attachment response = api.create(DATAASSET_GUID, body, null, PROJECT_GUID, null).block(); + assertNotNull(response); + validateAttachment(response); + assertEquals(response.getAttachmentType(), "remote"); + assertEquals(response.getAssetCategory(), AssetCategory.USER); + } + + @Test + public void testMarkTransferComplete() { + // TODO: current tests are for a remote asset, so transfer complete is not applicable + assertThrows(WebClientResponseException.BadRequest.class, () -> api.markTransferComplete(DATAASSET_GUID, attachmentGuid, null, PROJECT_GUID, null).block()); + } + */ + + @Test + public void testGet() { + AttachmentDetail response = api.get(DATAASSET_GUID, attachmentGuid, null, null, PROJECT_GUID, null, null, null, null).block(); + assertNotNull(response); + validateAttachment(response); + } + + /* + @Test + public void testGetResources() { + // TODO: implement after the asset files APIs (so we have local rather than remote attachments) + } + + @Test + public void testIncreaseResources() { + // TODO: implement after the asset files APIs (so we have local rather than remote attachments) + } + + @Test + public void testUpdate() { + // TODO: implement after the asset files APIs (so we have local rather than remote attachments) + } + + @Test + public void testUpdateDataSourceType() { + // TODO: implement after the asset files APIs (so we have local rather than remote attachments) + } + + @Test + public void testDelete() { + // TODO: implement after the asset files APIs (so we have local rather than remote attachments) + } + */ + + private void validateAttachment(AttachmentDetail attachment) { + assertEquals(attachment.getAttachmentId(), attachmentGuid); + assertEquals(attachment.getAssetType(), "data_profile"); + assertFalse(attachment.getIsPartitioned()); + assertEquals(attachment.getName(), "data_profile_f4efc9d0-62f7-4600-9175-01bf983dd970"); + assertNotNull(attachment.getCreatedAt()); + assertEquals(attachment.getObjectKey(), "data_profile_f4efc9d0-62f7-4600-9175-01bf983dd970"); + assertFalse(attachment.getObjectKeyIsReadOnly()); + assertEquals(attachment.getDatasourceType(), "81bafdbd-b7c6-45c5-a4fd-6ec135f66f4e"); + assertNotNull(attachment.getUrl()); + assertTrue(attachment.getTransferComplete()); + assertEquals(attachment.getSize(), Long.valueOf(159322L)); + assertNotNull(attachment.getUserData()); + assertEquals(attachment.getCreatorId(), "icp4d-dev"); + assertNotNull(attachment.getUsage()); + assertEquals(attachment.getUsage().getAccessCount(), Integer.valueOf(1)); + assertEquals(attachment.getUsage().getLastAccessorId(), EXSTUSER_GUID); + assertEquals(attachment.getUsage().getLastAccessTime(), Long.valueOf(1614185157962L)); + assertNotNull(attachment.getHref()); + } + +} diff --git a/java/src/test/java/com/ibm/watson/data/client/tests/AssetFilesTest.java b/java/src/test/java/com/ibm/watson/data/client/tests/AssetFilesTest.java new file mode 100644 index 0000000..2fb20ca --- /dev/null +++ b/java/src/test/java/com/ibm/watson/data/client/tests/AssetFilesTest.java @@ -0,0 +1,175 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.tests; + +import com.ibm.watson.data.client.api.AssetFilesApiV2; +import com.ibm.watson.data.client.mocks.AbstractExpectations; +import com.ibm.watson.data.client.mocks.MockConstants; +import com.ibm.watson.data.client.model.*; +import org.mockserver.client.MockServerClient; +import org.mockserver.model.Header; +import org.mockserver.model.Headers; +import org.springframework.http.HttpHeaders; +import org.springframework.http.ResponseEntity; +import org.springframework.web.reactive.function.client.WebClientResponseException; +import org.testng.annotations.Test; +import reactor.core.publisher.Mono; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.ibm.watson.data.client.mocks.MockConstants.*; +import static org.mockserver.model.HttpResponse.response; +import static org.testng.Assert.*; + +/** + * Test the Project Integration API endpoints. + */ +public class AssetFilesTest extends AbstractExpectations { + + private final AssetFilesApiV2 api = new AssetFilesApiV2(MockConstants.getApiClient()); + + public AssetFilesTest() { + super(AssetFilesApiV2.BASE_API, "assetFiles"); + } + + private final Map> projectParams = new HashMap<>(); + private final Map> listParams = new HashMap<>(); + private void setupParams() { + List project = new ArrayList<>(); + List enabled = new ArrayList<>(); + project.add(PROJECT_GUID); + enabled.add("true"); + projectParams.put("project_id", project); + listParams.put("project_id", project); + listParams.put("flat", enabled); + } + + private final List
headers = new ArrayList<>(); + private void setupHeaders() { + headers.add(Header.header("Content-Type", "text/csv")); + headers.add(Header.header("Content-Length", "93")); + headers.add(Header.header("ETag", "W/\"5d-1739ee10a26\"")); + headers.add(Header.header("Accept-Ranges", "bytes")); + headers.add(Header.header("X-Asset-Files-Type", "file")); + headers.add(Header.header("X-Asset-Files-Size", "93")); + headers.add(Header.header("Vary", "Accept-Encoding")); + } + + private static final String path = "data_asset/names.csv"; + private static final String pathEndpoint = "/" + path.replace("/", "%2F"); + + @Override + public void init(MockServerClient client) { + setupParams(); + setupHeaders(); + setupTest(client, "PUT", "", projectParams, "createFolder", 409); + setupTest(client, "PUT", pathEndpoint, projectParams, "upload", 201); + + setupTest(client, "GET", "", listParams, "list"); + client + .when(withRequest("HEAD", getBaseUrl() + pathEndpoint, getArea(), "getHeaders").withQueryStringParameters(projectParams)) + .respond(withResponse(getArea(), "getHeaders") + .withStatusCode(200) + .withHeaders(headers)); + client + .when(withRequest("GET", getBaseUrl() + pathEndpoint, getArea(), "get").withQueryStringParameters(projectParams)) + .respond(response() + .withBody(getResourceFileContents(getArea() + File.separator + "get" + File.separator + "response.csv")) + .withStatusCode(200) + .withHeaders(headers)); + } + + /* + @Test + public void testCreateFolder() { + // TODO: A project seems to always have a root folder already, so will simply provide a conflict response + assertThrows(WebClientResponseException.Conflict.class, () -> api.createFolder(null, null, PROJECT_GUID, null, null).block()); + } + + @Test + public void testUpload() { + File file = getFileFromResources(getArea() + File.separator + "upload" + File.separator + "names.csv"); + StatusResponse response = api.upload(path, null, null, PROJECT_GUID, null, null, null, null, null, null, file).getBody(); + assertNotNull(response); + assertEquals(response.getStatus(), "Asset created: The asset was successfully uploaded."); + } + + @Test + public void testCopy() { + + } + + @Test + public void testList() { + PaginatedAssetFileListResponse response = api.list(null, null, PROJECT_GUID, null, null, null, true, null).block(); + assertNotNull(response); + assertNotNull(response.getResources()); + assertEquals(response.getResources().size(), 1); + AssetFileMetadata one = response.getResources().get(0); + assertEquals(one.getPath(), path); + assertEquals(one.getEtag(), "W/\"5d-1739ee10a26\""); + assertEquals(one.getSize(), Integer.valueOf(93)); + assertNotNull(one.getLastModifed()); + assertEquals(one.getType(), "file"); + assertEquals(one.getMimeType(), "text/csv"); + } + + @Test + public void testGetHeaders() { + ResponseEntity response = api.getHeaders(path, null, null, PROJECT_GUID, null, null).block(); + assertNotNull(response); + HttpHeaders headers = response.getHeaders(); + assertEquals(headers.get("Content-Type").get(0), "text/csv"); + assertEquals(headers.get("Content-Length").get(0), "93"); + assertEquals(headers.get("ETag").get(0), "W/\"5d-1739ee10a26\""); + } + + @Test + public void testGetSignedURL() { + // TODO: unclear how the signing is meant to work, only ever returns a '403' even when an admin, will need to revisit the API + //String signature = api.getSignedURL(path, 10, null, null, PROJECT_GUID, null, "text/csv", null, true, false, "GET").block(); + } + + @Test + public void testGet() { + // TODO: unclear how the retrieval should work, as the following only ever blocks indefinitely + //String response = api.get(path, null, null, PROJECT_GUID, null, null, null, null, null, null, null, null).block(); + //assertNotNull(response); + //System.out.println("Response: " + response); + } + + @Test + public void testDeflate() { + + } + + @Test + public void testDeleteSingle() { + + } + + @Test + public void testDeleteBatch() { + + } + + */ + +} diff --git a/java/src/test/resources/assetAttachments/create/request.json b/java/src/test/resources/assetAttachments/create/request.json new file mode 100644 index 0000000..d489700 --- /dev/null +++ b/java/src/test/resources/assetAttachments/create/request.json @@ -0,0 +1,10 @@ +{ + "asset_type": "data_asset", + "name": "test_file.csv", + "description": "remote", + "mime": "text/csv", + "connection_id": "8cfc5370-355f-41ae-afd8-191e173e5695", + "connection_path": "/test_bucket/test_file.csv", + "object_key_is_read_only": false, + "is_partitioned": false +} \ No newline at end of file diff --git a/java/src/test/resources/assetAttachments/create/response.json b/java/src/test/resources/assetAttachments/create/response.json new file mode 100644 index 0000000..c7cd146 --- /dev/null +++ b/java/src/test/resources/assetAttachments/create/response.json @@ -0,0 +1,15 @@ +{ + "attachment_id": "4b79803f-e352-4eb6-843d-ec03421598d4", + "datasource_type": "193a97c1-4475-4a19-b90c-295c4fdc6517", + "asset_type": "data_asset", + "attachment_type": "remote", + "is_partitioned": false, + "name": "test_file.csv", + "description": "remote", + "mime": "text/csv", + "connection_id": "8cfc5370-355f-41ae-afd8-191e173e5695", + "connection_path": "/test_bucket/test_file.csv", + "user_data": {}, + "href": "/v2/assets/3b31d275-bd17-4b02-8145-b40e1b97cabf/attachments/4b79803f-e352-4eb6-843d-ec03421598d4?project_id=f0bd7b72-f690-4b65-9edb-7a430fa658d9", + "asset_category": "USER" +} \ No newline at end of file diff --git a/java/src/test/resources/assetAttachments/get/response.json b/java/src/test/resources/assetAttachments/get/response.json new file mode 100644 index 0000000..ce77085 --- /dev/null +++ b/java/src/test/resources/assetAttachments/get/response.json @@ -0,0 +1,21 @@ +{ + "attachment_id": "704347ba-0184-4bdc-84f5-9072992e6c1c", + "asset_type": "data_profile", + "is_partitioned": false, + "name": "data_profile_f4efc9d0-62f7-4600-9175-01bf983dd970", + "created_at": "2020-12-09T12:28:37Z", + "object_key": "data_profile_f4efc9d0-62f7-4600-9175-01bf983dd970", + "object_key_is_read_only": false, + "datasource_type": "81bafdbd-b7c6-45c5-a4fd-6ec135f66f4e", + "url": "/v2/asset_files/data_profile_f4efc9d0-62f7-4600-9175-01bf983dd970?catalog_id=92b84496-9961-47d8-ab1b-23212ab8a944&signature=Iw73yIrfibfNgf1SRhLdLQ%3D%3D%3ARgvG4Fisnb3SeCoZ5zjd6ItDkgTxzHa0AUDKM9H%2FI8UF82bus%2BMvnHs4PQIYx%2Brwckjf5CRZYYDjCPwiBn%2FUPLd0Z%2FBqeC7MSuAhL6cj8w71hX3iHsN93o5cyv%2BNiMC6B2%2F%2BrorXBYFDIbvjriW2DPIbCYPI26TMOvz8VtZKKZhPQItkiZV0ayxuGvezoHM2UaxDVJ5nYuW2dnvGxDAML2zxpywak4rxb7nnTcJJS9x7b9RIg00L9ph%2FxiALe%2BCbsquF0QuKh%2F3N1WM4usalW27SzrcIV%2BySzjbK4wida4lsGaKPevlcDxToi788azNBKTeSsI1fquU%3D", + "transfer_complete": true, + "size": 159322, + "user_data": {}, + "creator_id": "icp4d-dev", + "usage": { + "access_count": 1, + "last_accessor_id": "1000331004", + "last_access_time": 1614185157962 + }, + "href": "/v2/assets/ec9f4f72-5af0-476e-a69c-3124a06fb6eb/attachments/704347ba-0184-4bdc-84f5-9072992e6c1c?catalog_id=92b84496-9961-47d8-ab1b-23212ab8a944" +} \ No newline at end of file diff --git a/java/src/test/resources/assetAttachments/getResources/response.json b/java/src/test/resources/assetAttachments/getResources/response.json new file mode 100644 index 0000000..06bf773 --- /dev/null +++ b/java/src/test/resources/assetAttachments/getResources/response.json @@ -0,0 +1,9 @@ +{ + "trace": "cphmm4826q75pwrb89bjm4gcw", + "errors": [ + { + "code": "unable_to_perform", + "message": "ATTSV3041E: Referenced or remote attachment -- transfer complete or resource operations are not applicable: catalogId '2ea819ce-95b5-4e11-8d46-dd1ba8865f14' assetId '3b31d275-bd17-4b02-8145-b40e1b97cabf' attachmentId '4b79803f-e352-4eb6-843d-ec03421598d4'" + } + ] +} \ No newline at end of file diff --git a/java/src/test/resources/assetAttachments/markTransferComplete/response.json b/java/src/test/resources/assetAttachments/markTransferComplete/response.json new file mode 100644 index 0000000..4f7a566 --- /dev/null +++ b/java/src/test/resources/assetAttachments/markTransferComplete/response.json @@ -0,0 +1,9 @@ +{ + "trace": "5dmsn9jvc4eb7dt1jroa8d9ow", + "errors": [ + { + "code": "unable_to_perform", + "message": "ATTSV3041E: Referenced or remote attachment -- transfer complete or resource operations are not applicable: catalogId '2ea819ce-95b5-4e11-8d46-dd1ba8865f14' assetId '3b31d275-bd17-4b02-8145-b40e1b97cabf' attachmentId '4b79803f-e352-4eb6-843d-ec03421598d4'" + } + ] +} \ No newline at end of file diff --git a/java/src/test/resources/assetFiles/createFolder/response.json b/java/src/test/resources/assetFiles/createFolder/response.json new file mode 100644 index 0000000..83925ed --- /dev/null +++ b/java/src/test/resources/assetFiles/createFolder/response.json @@ -0,0 +1,6 @@ +{ + "code": 409, + "error": "Conflict", + "reason": "Root directory already exists", + "message": "The action will not be processed due to a conflict." +} \ No newline at end of file diff --git a/java/src/test/resources/assetFiles/get/response.csv b/java/src/test/resources/assetFiles/get/response.csv new file mode 100644 index 0000000..6c721d1 --- /dev/null +++ b/java/src/test/resources/assetFiles/get/response.csv @@ -0,0 +1,5 @@ +Id,First,Last,Location +1,Zach,Now,1 +2,Steve,Starter,1 +3,Terri,Daring,2 +4,Polly,Tasker,2 diff --git a/java/src/test/resources/assetFiles/list/response.json b/java/src/test/resources/assetFiles/list/response.json new file mode 100644 index 0000000..bce8af7 --- /dev/null +++ b/java/src/test/resources/assetFiles/list/response.json @@ -0,0 +1,12 @@ +{ + "resources": [ + { + "path": "data_asset/names.csv", + "etag": "W/\"5d-1739ee10a26\"", + "size": 93, + "last_modifed": "Thu, 30 Jul 2020 08:40:15 GMT", + "type": "file", + "mime_type": "text/csv" + } + ] +} \ No newline at end of file diff --git a/java/src/test/resources/assetFiles/upload/names.csv b/java/src/test/resources/assetFiles/upload/names.csv new file mode 100644 index 0000000..e45dc89 --- /dev/null +++ b/java/src/test/resources/assetFiles/upload/names.csv @@ -0,0 +1,5 @@ +Id,First,Last,Location +1,Zach,Now,1 +2,Steve,Starter,1 +3,Terri,Daring,2 +4,Polly,Tasker,2 diff --git a/java/src/test/resources/assetFiles/upload/response.json b/java/src/test/resources/assetFiles/upload/response.json new file mode 100644 index 0000000..49ff260 --- /dev/null +++ b/java/src/test/resources/assetFiles/upload/response.json @@ -0,0 +1,3 @@ +{ + "status": "Asset created: The asset was successfully uploaded." +} \ No newline at end of file From 4ce1dcf7a832b912ffd13ca7f09ee770399a8319 Mon Sep 17 00:00:00 2001 From: Christopher Grote Date: Thu, 25 Feb 2021 02:17:36 +0000 Subject: [PATCH 3/3] Adds missing classes Signed-off-by: Christopher Grote --- .../data/client/model/CopyAssetFile.java | 93 +++++++++++++++ .../client/model/CopyAssetFileDetail.java | 111 ++++++++++++++++++ .../data/client/model/StatusResponse.java | 76 ++++++++++++ 3 files changed, 280 insertions(+) create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFile.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFileDetail.java create mode 100644 java/src/main/java/com/ibm/watson/data/client/model/StatusResponse.java diff --git a/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFile.java b/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFile.java new file mode 100644 index 0000000..2ed96e1 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFile.java @@ -0,0 +1,93 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * CopyAssetFile + */ +public class CopyAssetFile { + + private CopyAssetFileDetail source; + private CopyAssetFileDetail target; + + public CopyAssetFile source(CopyAssetFileDetail source) { + this.source = source; + return this; + } + + /** + * Get source + * @return source + **/ + @javax.annotation.Nullable + @JsonProperty("source") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public CopyAssetFileDetail getSource() { return source; } + public void setSource(CopyAssetFileDetail source) { this.source = source; } + + public CopyAssetFile target(CopyAssetFileDetail target) { + this.target = target; + return this; + } + + /** + * Get target + * @return target + **/ + @javax.annotation.Nullable + @JsonProperty("target") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public CopyAssetFileDetail getTarget() { return target; } + public void setTarget(CopyAssetFileDetail target) { this.target = target; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + CopyAssetFile copyAssetFile = (CopyAssetFile)o; + return Objects.equals(this.source, copyAssetFile.source) && + Objects.equals(this.target, copyAssetFile.target); + } + + @Override + public int hashCode() { + return Objects.hash(source, target); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CopyAssetFile {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFileDetail.java b/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFileDetail.java new file mode 100644 index 0000000..fec0a5d --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/CopyAssetFileDetail.java @@ -0,0 +1,111 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * CopyAssetFileTarget + */ +public class CopyAssetFileDetail { + + private String type; + private String guid; + private String path; + + public CopyAssetFileDetail type(String type) { + this.type = type; + return this; + } + + /** + * The type of the source container. + * @return type + **/ + @javax.annotation.Nullable + @JsonProperty("type") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getType() { return type; } + public void setType(String type) { this.type = type; } + + public CopyAssetFileDetail guid(String guid) { + this.guid = guid; + return this; + } + + /** + * The guid of the source container. + * @return guid + **/ + @javax.annotation.Nullable + @JsonProperty("guid") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getGuid() { return guid; } + public void setGuid(String guid) { this.guid = guid; } + + public CopyAssetFileDetail path(String path) { + this.path = path; + return this; + } + + /** + * The location where the asset should be copied + * @return path + **/ + @javax.annotation.Nullable + @JsonProperty("path") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getPath() { return path; } + public void setPath(String path) { this.path = path; } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + CopyAssetFileDetail copyAssetFileTarget = (CopyAssetFileDetail)o; + return Objects.equals(this.type, copyAssetFileTarget.type) && + Objects.equals(this.guid, copyAssetFileTarget.guid) && + Objects.equals(this.path, copyAssetFileTarget.path); + } + + @Override + public int hashCode() { + return Objects.hash(type, guid, path); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CopyAssetFileTarget {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" guid: ").append(toIndentedString(guid)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).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(java.lang.Object o) { + if (o == null) { return "null"; } + return o.toString().replace("\n", "\n "); + } + +} diff --git a/java/src/main/java/com/ibm/watson/data/client/model/StatusResponse.java b/java/src/main/java/com/ibm/watson/data/client/model/StatusResponse.java new file mode 100644 index 0000000..1b26f37 --- /dev/null +++ b/java/src/main/java/com/ibm/watson/data/client/model/StatusResponse.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 IBM Corp. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.ibm.watson.data.client.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + +/** + * StatusResponse + */ +public class StatusResponse { + + private String status; + + public StatusResponse status(String status) { + this.status = status; + return this; + } + + /** + * The status of the response. + * @return messageCode + **/ + @javax.annotation.Nullable + @JsonProperty("status") + @JsonInclude(value = JsonInclude.Include.NON_NULL) + public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + + @Override + public boolean equals(Object o) { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + StatusResponse that = (StatusResponse)o; + return Objects.equals(this.status, that.status); + } + + @Override + public int hashCode() { + return Objects.hash(status); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatusResponse {\n"); + sb.append(" status: ").append(toIndentedString(status)).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 "); + } + +}