|
| 1 | +package com.datadog.api.client.v2.api; |
| 2 | + |
| 3 | +import com.datadog.api.client.ApiClient; |
| 4 | +import com.datadog.api.client.ApiException; |
| 5 | +import com.datadog.api.client.ApiResponse; |
| 6 | +import com.datadog.api.client.Pair; |
| 7 | +import com.datadog.api.client.v2.model.StegadographyGetWidgetsResponse; |
| 8 | +import jakarta.ws.rs.client.Invocation; |
| 9 | +import jakarta.ws.rs.core.GenericType; |
| 10 | +import java.io.File; |
| 11 | +import java.util.ArrayList; |
| 12 | +import java.util.HashMap; |
| 13 | +import java.util.Map; |
| 14 | +import java.util.concurrent.CompletableFuture; |
| 15 | + |
| 16 | +@jakarta.annotation.Generated( |
| 17 | + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") |
| 18 | +public class StegadographyApi { |
| 19 | + private ApiClient apiClient; |
| 20 | + |
| 21 | + public StegadographyApi() { |
| 22 | + this(ApiClient.getDefaultApiClient()); |
| 23 | + } |
| 24 | + |
| 25 | + public StegadographyApi(ApiClient apiClient) { |
| 26 | + this.apiClient = apiClient; |
| 27 | + } |
| 28 | + |
| 29 | + /** |
| 30 | + * Get the API client. |
| 31 | + * |
| 32 | + * @return API client |
| 33 | + */ |
| 34 | + public ApiClient getApiClient() { |
| 35 | + return apiClient; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | + * Set the API client. |
| 40 | + * |
| 41 | + * @param apiClient an instance of API client |
| 42 | + */ |
| 43 | + public void setApiClient(ApiClient apiClient) { |
| 44 | + this.apiClient = apiClient; |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Get widgets from an image. |
| 49 | + * |
| 50 | + * <p>See {@link #getStegadographyWidgetsWithHttpInfo}. |
| 51 | + * |
| 52 | + * @param image PNG image file to scan for embedded watermarks. (required) |
| 53 | + * @return StegadographyGetWidgetsResponse |
| 54 | + * @throws ApiException if fails to make API call |
| 55 | + */ |
| 56 | + public StegadographyGetWidgetsResponse getStegadographyWidgets(File image) throws ApiException { |
| 57 | + return getStegadographyWidgetsWithHttpInfo(image).getData(); |
| 58 | + } |
| 59 | + |
| 60 | + /** |
| 61 | + * Get widgets from an image. |
| 62 | + * |
| 63 | + * <p>See {@link #getStegadographyWidgetsWithHttpInfoAsync}. |
| 64 | + * |
| 65 | + * @param image PNG image file to scan for embedded watermarks. (required) |
| 66 | + * @return CompletableFuture<StegadographyGetWidgetsResponse> |
| 67 | + */ |
| 68 | + public CompletableFuture<StegadographyGetWidgetsResponse> getStegadographyWidgetsAsync( |
| 69 | + File image) { |
| 70 | + return getStegadographyWidgetsWithHttpInfoAsync(image) |
| 71 | + .thenApply( |
| 72 | + response -> { |
| 73 | + return response.getData(); |
| 74 | + }); |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Extracts watermarks from a PNG image and returns the cached widget data associated with each |
| 79 | + * watermark found. The image must be uploaded as a <code>multipart/form-data</code> request with |
| 80 | + * the file in the <code>image</code> field. Only widgets belonging to the authenticated |
| 81 | + * organization are returned. |
| 82 | + * |
| 83 | + * @param image PNG image file to scan for embedded watermarks. (required) |
| 84 | + * @return ApiResponse<StegadographyGetWidgetsResponse> |
| 85 | + * @throws ApiException if fails to make API call |
| 86 | + * @http.response.details |
| 87 | + * <table border="1"> |
| 88 | + * <caption>Response details</caption> |
| 89 | + * <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> |
| 90 | + * <tr><td> 200 </td><td> OK </td><td> - </td></tr> |
| 91 | + * <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr> |
| 92 | + * <tr><td> 403 </td><td> Forbidden </td><td> - </td></tr> |
| 93 | + * <tr><td> 415 </td><td> Unsupported Media Type </td><td> - </td></tr> |
| 94 | + * <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr> |
| 95 | + * <tr><td> 500 </td><td> Internal Server Error </td><td> - </td></tr> |
| 96 | + * </table> |
| 97 | + */ |
| 98 | + public ApiResponse<StegadographyGetWidgetsResponse> getStegadographyWidgetsWithHttpInfo( |
| 99 | + File image) throws ApiException { |
| 100 | + Object localVarPostBody = null; |
| 101 | + |
| 102 | + // verify the required parameter 'image' is set |
| 103 | + if (image == null) { |
| 104 | + throw new ApiException( |
| 105 | + 400, "Missing the required parameter 'image' when calling getStegadographyWidgets"); |
| 106 | + } |
| 107 | + // create path and map variables |
| 108 | + String localVarPath = "/api/v2/stegadography/get-widgets"; |
| 109 | + |
| 110 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 111 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 112 | + |
| 113 | + if (image != null) { |
| 114 | + localVarFormParams.put("image", image); |
| 115 | + } |
| 116 | + |
| 117 | + Invocation.Builder builder = |
| 118 | + apiClient.createBuilder( |
| 119 | + "v2.StegadographyApi.getStegadographyWidgets", |
| 120 | + localVarPath, |
| 121 | + new ArrayList<Pair>(), |
| 122 | + localVarHeaderParams, |
| 123 | + new HashMap<String, String>(), |
| 124 | + new String[] {"application/json"}, |
| 125 | + new String[] {"apiKeyAuth", "appKeyAuth"}); |
| 126 | + return apiClient.invokeAPI( |
| 127 | + "POST", |
| 128 | + builder, |
| 129 | + localVarHeaderParams, |
| 130 | + new String[] {"multipart/form-data"}, |
| 131 | + localVarPostBody, |
| 132 | + localVarFormParams, |
| 133 | + false, |
| 134 | + new GenericType<StegadographyGetWidgetsResponse>() {}); |
| 135 | + } |
| 136 | + |
| 137 | + /** |
| 138 | + * Get widgets from an image. |
| 139 | + * |
| 140 | + * <p>See {@link #getStegadographyWidgetsWithHttpInfo}. |
| 141 | + * |
| 142 | + * @param image PNG image file to scan for embedded watermarks. (required) |
| 143 | + * @return CompletableFuture<ApiResponse<StegadographyGetWidgetsResponse>> |
| 144 | + */ |
| 145 | + public CompletableFuture<ApiResponse<StegadographyGetWidgetsResponse>> |
| 146 | + getStegadographyWidgetsWithHttpInfoAsync(File image) { |
| 147 | + Object localVarPostBody = null; |
| 148 | + |
| 149 | + // verify the required parameter 'image' is set |
| 150 | + if (image == null) { |
| 151 | + CompletableFuture<ApiResponse<StegadographyGetWidgetsResponse>> result = |
| 152 | + new CompletableFuture<>(); |
| 153 | + result.completeExceptionally( |
| 154 | + new ApiException( |
| 155 | + 400, "Missing the required parameter 'image' when calling getStegadographyWidgets")); |
| 156 | + return result; |
| 157 | + } |
| 158 | + // create path and map variables |
| 159 | + String localVarPath = "/api/v2/stegadography/get-widgets"; |
| 160 | + |
| 161 | + Map<String, String> localVarHeaderParams = new HashMap<String, String>(); |
| 162 | + Map<String, Object> localVarFormParams = new HashMap<String, Object>(); |
| 163 | + |
| 164 | + if (image != null) { |
| 165 | + localVarFormParams.put("image", image); |
| 166 | + } |
| 167 | + |
| 168 | + Invocation.Builder builder; |
| 169 | + try { |
| 170 | + builder = |
| 171 | + apiClient.createBuilder( |
| 172 | + "v2.StegadographyApi.getStegadographyWidgets", |
| 173 | + localVarPath, |
| 174 | + new ArrayList<Pair>(), |
| 175 | + localVarHeaderParams, |
| 176 | + new HashMap<String, String>(), |
| 177 | + new String[] {"application/json"}, |
| 178 | + new String[] {"apiKeyAuth", "appKeyAuth"}); |
| 179 | + } catch (ApiException ex) { |
| 180 | + CompletableFuture<ApiResponse<StegadographyGetWidgetsResponse>> result = |
| 181 | + new CompletableFuture<>(); |
| 182 | + result.completeExceptionally(ex); |
| 183 | + return result; |
| 184 | + } |
| 185 | + return apiClient.invokeAPIAsync( |
| 186 | + "POST", |
| 187 | + builder, |
| 188 | + localVarHeaderParams, |
| 189 | + new String[] {"multipart/form-data"}, |
| 190 | + localVarPostBody, |
| 191 | + localVarFormParams, |
| 192 | + false, |
| 193 | + new GenericType<StegadographyGetWidgetsResponse>() {}); |
| 194 | + } |
| 195 | +} |
0 commit comments