From 4cf5aa63095f2f0996d5f41bdd42551b144a743e Mon Sep 17 00:00:00 2001 From: lqrs <64920932+lqrs@users.noreply.github.com> Date: Sat, 16 Aug 2025 19:34:48 +0000 Subject: [PATCH 1/3] Revert "Refresh generated from api-specification" This reverts commit 83e75dd6a8766e038de9ee1e893a7c89fb7aeb25. --- .openapi-generator/FILES | 19 -- .openapi-generator/VERSION | 2 +- docs/Consent.md | 12 + docs/ConsentRequest.md | 3 +- docs/Content.md | 3 +- docs/Decision.md | 5 +- docs/DecisionApi.md | 2 +- docs/DecisionRequest.md | 3 +- docs/DecisionResponse.md | 5 +- docs/Event.md | 3 +- docs/GdprConsent.md | 13 + docs/MatchedPoint.md | 1 - docs/Placement.md | 8 +- docs/PricingData.md | 1 - docs/Request.md | 25 ++ docs/RequestConsent.md | 13 + docs/RequestLocation.md | 17 + docs/Response.md | 14 + docs/SkipFilters.md | 24 -- docs/User.md | 1 - .../com/adzerk/sdk/generated/ApiClient.java | 44 +-- .../adzerk/sdk/generated/ApiException.java | 2 +- .../adzerk/sdk/generated/Configuration.java | 2 +- .../java/com/adzerk/sdk/generated/JSON.java | 1 - .../java/com/adzerk/sdk/generated/Pair.java | 2 +- .../com/adzerk/sdk/generated/StringUtil.java | 24 +- .../adzerk/sdk/generated/api/DecisionApi.java | 1 - .../adzerk/sdk/generated/api/UserdbApi.java | 57 ++-- .../adzerk/sdk/generated/auth/ApiKeyAuth.java | 2 +- .../sdk/generated/auth/HttpBearerAuth.java | 2 +- .../sdk/generated/model/ConsentRequest.java | 7 +- .../adzerk/sdk/generated/model/Content.java | 7 +- .../adzerk/sdk/generated/model/Decision.java | 7 +- .../sdk/generated/model/DecisionRequest.java | 7 +- .../sdk/generated/model/DecisionResponse.java | 27 +- .../com/adzerk/sdk/generated/model/Event.java | 7 +- .../sdk/generated/model/MatchedPoint.java | 7 +- .../adzerk/sdk/generated/model/Placement.java | 41 +-- .../sdk/generated/model/PricingData.java | 7 +- .../sdk/generated/model/RequestLocation.java | 131 ++++++++ .../sdk/generated/model/SkipFilters.java | 304 ------------------ .../com/adzerk/sdk/generated/model/User.java | 7 +- 42 files changed, 325 insertions(+), 545 deletions(-) create mode 100644 docs/Consent.md create mode 100644 docs/GdprConsent.md create mode 100644 docs/Request.md create mode 100644 docs/RequestConsent.md create mode 100644 docs/RequestLocation.md create mode 100644 docs/Response.md delete mode 100644 docs/SkipFilters.md create mode 100644 src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java delete mode 100644 src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index e767192..23a765f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,9 +1,5 @@ -.gitignore -.openapi-generator-ignore .travis.yml README.md -api/openapi.yaml -build.gradle build.sbt docs/ConsentRequest.md docs/Content.md @@ -15,7 +11,6 @@ docs/Event.md docs/MatchedPoint.md docs/Placement.md docs/PricingData.md -docs/SkipFilters.md docs/User.md docs/UserdbApi.md git_push.sh @@ -55,18 +50,4 @@ src/main/java/com/adzerk/sdk/generated/model/Event.java src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java src/main/java/com/adzerk/sdk/generated/model/Placement.java src/main/java/com/adzerk/sdk/generated/model/PricingData.java -src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java src/main/java/com/adzerk/sdk/generated/model/User.java -src/test/java/com/adzerk/sdk/generated/api/DecisionApiTest.java -src/test/java/com/adzerk/sdk/generated/api/UserdbApiTest.java -src/test/java/com/adzerk/sdk/generated/model/ConsentRequestTest.java -src/test/java/com/adzerk/sdk/generated/model/ContentTest.java -src/test/java/com/adzerk/sdk/generated/model/DecisionRequestTest.java -src/test/java/com/adzerk/sdk/generated/model/DecisionResponseTest.java -src/test/java/com/adzerk/sdk/generated/model/DecisionTest.java -src/test/java/com/adzerk/sdk/generated/model/EventTest.java -src/test/java/com/adzerk/sdk/generated/model/MatchedPointTest.java -src/test/java/com/adzerk/sdk/generated/model/PlacementTest.java -src/test/java/com/adzerk/sdk/generated/model/PricingDataTest.java -src/test/java/com/adzerk/sdk/generated/model/SkipFiltersTest.java -src/test/java/com/adzerk/sdk/generated/model/UserTest.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 831446c..ecedc98 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -5.1.0 +4.3.1 \ No newline at end of file diff --git a/docs/Consent.md b/docs/Consent.md new file mode 100644 index 0000000..4822897 --- /dev/null +++ b/docs/Consent.md @@ -0,0 +1,12 @@ + + +# Consent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**gdpr** | **Boolean** | | [optional] + + + diff --git a/docs/ConsentRequest.md b/docs/ConsentRequest.md index 115bd5a..79a6695 100644 --- a/docs/ConsentRequest.md +++ b/docs/ConsentRequest.md @@ -2,13 +2,12 @@ # ConsentRequest - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **userKey** | **String** | | [optional] -**consent** | **Object** | | [optional] +**consent** | [**Object**](.md) | | [optional] ## Implemented Interfaces diff --git a/docs/Content.md b/docs/Content.md index 2251abe..8f0ed03 100644 --- a/docs/Content.md +++ b/docs/Content.md @@ -2,7 +2,6 @@ # Content - ## Properties Name | Type | Description | Notes @@ -10,7 +9,7 @@ Name | Type | Description | Notes **type** | **String** | | [optional] **template** | **String** | | [optional] **customTemplate** | **String** | | [optional] -**data** | **Object** | | [optional] +**data** | [**Object**](.md) | | [optional] **body** | **String** | | [optional] diff --git a/docs/Decision.md b/docs/Decision.md index aeff408..02f05f2 100644 --- a/docs/Decision.md +++ b/docs/Decision.md @@ -2,7 +2,6 @@ # Decision - ## Properties Name | Type | Description | Notes @@ -13,9 +12,9 @@ Name | Type | Description | Notes **flightId** | **Integer** | | [optional] **campaignId** | **Integer** | | [optional] **priorityId** | **Integer** | | [optional] -**clickUrl** | **URI** | | [optional] +**clickUrl** | [**URI**](URI.md) | | [optional] **contents** | [**List<Content>**](Content.md) | | [optional] -**impressionUrl** | **URI** | | [optional] +**impressionUrl** | [**URI**](URI.md) | | [optional] **events** | [**List<Event>**](Event.md) | | [optional] **matchedPoints** | [**List<MatchedPoint>**](MatchedPoint.md) | | [optional] **pricing** | [**PricingData**](PricingData.md) | | [optional] diff --git a/docs/DecisionApi.md b/docs/DecisionApi.md index ed104e5..93ffbd1 100644 --- a/docs/DecisionApi.md +++ b/docs/DecisionApi.md @@ -30,7 +30,7 @@ public class Example { defaultClient.setBasePath("https://e-23.adzerk.net"); DecisionApi apiInstance = new DecisionApi(defaultClient); - DecisionRequest decisionRequest = new DecisionRequest(); // DecisionRequest | + DecisionRequest decisionRequest = {"placements": [{ "divName": "header", "networkId": 23, "siteId": 667480, "adTypes": [5] }] }; // DecisionRequest | try { DecisionResponse result = apiInstance.getDecisions(decisionRequest); System.out.println(result); diff --git a/docs/DecisionRequest.md b/docs/DecisionRequest.md index 75a6d5e..7760162 100644 --- a/docs/DecisionRequest.md +++ b/docs/DecisionRequest.md @@ -2,7 +2,6 @@ # DecisionRequest - ## Properties Name | Type | Description | Notes @@ -19,7 +18,7 @@ Name | Type | Description | Notes **notrack** | **Boolean** | If true, only return ads that are set to honor Do Not Track | [optional] **enableBotFiltering** | **Boolean** | If making a client-side request, set to true. Defaults to false to ensure a server isn't seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info | [optional] **enableUserDBIP** | **Boolean** | If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB | [optional] -**consent** | **Object** | Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. | [optional] +**consent** | [**Object**](.md) | Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. | [optional] **deviceID** | **String** | RTB requests only - sets an Identifier for Advertisers (IFA or IDFA) | [optional] **parallel** | **Boolean** | | [optional] **intendedLatitude** | **Float** | | [optional] diff --git a/docs/DecisionResponse.md b/docs/DecisionResponse.md index dc693ed..97b78d4 100644 --- a/docs/DecisionResponse.md +++ b/docs/DecisionResponse.md @@ -2,14 +2,13 @@ # DecisionResponse - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **user** | [**User**](User.md) | | [optional] -**decisions** | [**Map<String, Decision>**](Decision.md) | | [optional] -**explain** | **Object** | | [optional] +**decisions** | [**Object**](.md) | | [optional] +**explain** | [**Object**](.md) | | [optional] ## Implemented Interfaces diff --git a/docs/Event.md b/docs/Event.md index 95c313a..1ae47ab 100644 --- a/docs/Event.md +++ b/docs/Event.md @@ -2,13 +2,12 @@ # Event - ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **Integer** | | [optional] -**url** | **URI** | | [optional] +**url** | [**URI**](URI.md) | | [optional] ## Implemented Interfaces diff --git a/docs/GdprConsent.md b/docs/GdprConsent.md new file mode 100644 index 0000000..1620e0e --- /dev/null +++ b/docs/GdprConsent.md @@ -0,0 +1,13 @@ + + +# GdprConsent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**userKey** | **String** | | [optional] +**consent** | [**Consent**](Consent.md) | | [optional] + + + diff --git a/docs/MatchedPoint.md b/docs/MatchedPoint.md index bb4551a..603010e 100644 --- a/docs/MatchedPoint.md +++ b/docs/MatchedPoint.md @@ -2,7 +2,6 @@ # MatchedPoint - ## Properties Name | Type | Description | Notes diff --git a/docs/Placement.md b/docs/Placement.md index 94593e8..7b610f8 100644 --- a/docs/Placement.md +++ b/docs/Placement.md @@ -2,7 +2,6 @@ # Placement - ## Properties Name | Type | Description | Notes @@ -16,9 +15,9 @@ Name | Type | Description | Notes **flightId** | **Integer** | A numeric ad (flight-creative map) id; if specified, only serve that ad if possible | [optional] **adId** | **Integer** | A numeric ad (flight-creative map) id; if specified, only serve that ad if possible | [optional] **clickUrl** | **String** | The ad's click-through URL | [optional] -**properties** | **Object** | A map of key/value pairs used for [Custom Targeting](https://dev.adzerk.com/docs/custom-targeting) | [optional] +**properties** | [**Object**](.md) | A map of key/value pairs used for [Custom Targeting](https://dev.adzerk.com/docs/custom-targeting) | [optional] **eventIds** | **List<Integer>** | An array of numeric event types. Requests tracking URLs for custom events. See here for [Event Tracking IDs](https://dev.adzerk.com/v1.0/docs/custom-event-tracking) | [optional] -**overrides** | **Object** | An object that overrides values for an advertiser, campaign, flight or ad. Used especially for header bidding | [optional] +**overrides** | [**Object**](.md) | An object that overrides values for an advertiser, campaign, flight or ad. Used especially for header bidding | [optional] **contentKeys** | **Map<String, String>** | A map of key/value pairs used with [ContentDB](https://dev.adzerk.com/docs/contentdb-1). The format is `\"contentKeys\": {\"schema\": \"contentKey\"}` | [optional] **count** | **Integer** | (BETA) The number of ads to return per placement. Integer between 1 and 20 | [optional] **proportionality** | **Boolean** | (BETA) If true, fills ads in a multi-winner placement in proportion to the flight's goals | [optional] @@ -26,10 +25,9 @@ Name | Type | Description | Notes **ecpmPartitions** | **List<String>** | (BETA) The names of the eCPM Partitions that should be used to source eCPM data for auctions | [optional] **eventMultiplier** | **Integer** | | [optional] **skipSelection** | **Boolean** | | [optional] -**adQuery** | **Object** | | [optional] +**adQuery** | [**Object**](.md) | | [optional] **floorPrice** | **Float** | | [optional] **floorCpc** | **Float** | | [optional] -**skipFilters** | [**SkipFilters**](SkipFilters.md) | | [optional] ## Implemented Interfaces diff --git a/docs/PricingData.md b/docs/PricingData.md index c0fe362..83daea3 100644 --- a/docs/PricingData.md +++ b/docs/PricingData.md @@ -2,7 +2,6 @@ # PricingData - ## Properties Name | Type | Description | Notes diff --git a/docs/Request.md b/docs/Request.md new file mode 100644 index 0000000..bc14e83 --- /dev/null +++ b/docs/Request.md @@ -0,0 +1,25 @@ + + +# Request + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**placements** | [**List<Placement>**](Placement.md) | One or more Placement objects | +**user** | [**User**](User.md) | | [optional] +**keywords** | **List<String>** | Keywords for keyword Targeting. Such as `\"keywords\": [\"foo\", \"bar\", \"baz\"]`. | [optional] +**url** | **String** | The current page URL | [optional] +**referrer** | **String** | The referrer URL | [optional] +**ip** | **String** | The IP address. Required for [Geo-Targeting](https://dev.adzerk.com/docs/geo-location) | [optional] +**blockedCreatives** | **List<Integer>** | Numeric creative ids to disregard for ad selection | [optional] +**isMobile** | **Boolean** | If true, only ads containing a single image will be returned | [optional] +**includePricingData** | **Boolean** | If true, return pricing data for the decision in the response | [optional] +**notrack** | **Boolean** | If true, only return ads that are set to honor Do Not Track | [optional] +**enableBotFiltering** | **Boolean** | If making a client-side request, set to true. Defaults to false to ensure a server isn't seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info | [optional] +**enableUserDBIP** | **Boolean** | If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB | [optional] +**consent** | [**RequestConsent**](RequestConsent.md) | | [optional] +**deviceID** | **String** | RTB requests only - sets an Identifier for Advertisers (IFA or IDFA) | [optional] + + + diff --git a/docs/RequestConsent.md b/docs/RequestConsent.md new file mode 100644 index 0000000..9b4909a --- /dev/null +++ b/docs/RequestConsent.md @@ -0,0 +1,13 @@ + + +# RequestConsent + +Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**gdpr** | **Boolean** | | [optional] + + + diff --git a/docs/RequestLocation.md b/docs/RequestLocation.md new file mode 100644 index 0000000..826a95a --- /dev/null +++ b/docs/RequestLocation.md @@ -0,0 +1,17 @@ + + +# RequestLocation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**latitude** | **String** | | [optional] +**longitude** | **String** | | [optional] + + +## Implemented Interfaces + +* Serializable + + diff --git a/docs/Response.md b/docs/Response.md new file mode 100644 index 0000000..d18df6b --- /dev/null +++ b/docs/Response.md @@ -0,0 +1,14 @@ + + +# Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**user** | [**User**](User.md) | | [optional] +**decisions** | [**Object**](.md) | | [optional] +**explain** | [**Object**](.md) | | [optional] + + + diff --git a/docs/SkipFilters.md b/docs/SkipFilters.md deleted file mode 100644 index f799300..0000000 --- a/docs/SkipFilters.md +++ /dev/null @@ -1,24 +0,0 @@ - - -# SkipFilters - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**distance** | **Boolean** | Geodistance filter, which skips geodistance targeting if true. | [optional] -**facet** | **Boolean** | Facet targeting filter, which skips facet targeting if true. | [optional] -**geodistance** | **Boolean** | Geodistance filter, which skips geodistance targeting if true. | [optional] -**geolocation** | **Boolean** | Geolocation filter, which skips location targeting if true. | [optional] -**keyword** | **Boolean** | Keyword limit filter, which skips all (ad and/or flight) keyword targeting if true. | [optional] -**location** | **Boolean** | Geolocation filter, which skips location targeting if true. | [optional] -**placementLimit** | **Boolean** | Placement limit filter, where no advertiser placement limit if true. | [optional] -**siteZone** | **Boolean** | Site/zone limit filter, which skips site/zone targeting if true. | [optional] - - -## Implemented Interfaces - -* Serializable - - diff --git a/docs/User.md b/docs/User.md index 0a5ae31..cfcad68 100644 --- a/docs/User.md +++ b/docs/User.md @@ -3,7 +3,6 @@ # User Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1) - ## Properties Name | Type | Description | Notes diff --git a/src/main/java/com/adzerk/sdk/generated/ApiClient.java b/src/main/java/com/adzerk/sdk/generated/ApiClient.java index d07a543..47ad87b 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiClient.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiClient.java @@ -33,8 +33,6 @@ import java.net.URI; import java.net.URLConnection; import java.net.URLEncoder; -import java.nio.file.Files; -import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.SecureRandom; @@ -91,20 +89,6 @@ public ApiClient() { authentications = Collections.unmodifiableMap(authentications); } - /* - * Basic constructor with custom OkHttpClient - */ - public ApiClient(OkHttpClient client) { - init(); - - httpClient = client; - - // Setup authentications (key: authentication name, value: authentication). - authentications.put("ApiKeyAuth", new ApiKeyAuth("header", "X-Adzerk-ApiKey")); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); - } - private void initHttpClient() { initHttpClient(Collections.emptyList()); } @@ -301,7 +285,6 @@ public Authentication getAuthentication(String authName) { return authentications.get(authName); } - /** * Helper method to set username for the first HTTP basic authentication. * @@ -428,9 +411,7 @@ public ApiClient setDebugging(boolean debugging) { loggingInterceptor.setLevel(Level.BODY); httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { - final OkHttpClient.Builder builder = httpClient.newBuilder(); - builder.interceptors().remove(loggingInterceptor); - httpClient = builder.build(); + httpClient.interceptors().remove(loggingInterceptor); loggingInterceptor = null; } } @@ -443,7 +424,7 @@ public ApiClient setDebugging(boolean debugging) { * with file response. The default value is null, i.e. using * the system's default tempopary folder. * - * @see createTempFile + * @see createTempFile * @return Temporary folder path */ public String getTempFolderPath() { @@ -817,10 +798,10 @@ public T deserialize(Response response, Type returnType) throws ApiException public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { // Binary (byte array) body parameter support. - return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); } else if (obj instanceof File) { // File body parameter support. - return RequestBody.create((File) obj, MediaType.parse(contentType)); + return RequestBody.create(MediaType.parse(contentType), (File) obj); } else if (isJsonMime(contentType)) { String content; if (obj != null) { @@ -828,7 +809,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException } else { content = null; } - return RequestBody.create(content, MediaType.parse(contentType)); + return RequestBody.create(MediaType.parse(contentType), content); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } @@ -885,15 +866,15 @@ public File prepareDownloadFile(Response response) throws IOException { prefix = filename.substring(0, pos) + "-"; suffix = filename.substring(pos); } - // Files.createTempFile requires the prefix to be at least three characters long + // File.createTempFile requires the prefix to be at least three characters long if (prefix.length() < 3) prefix = "download-"; } if (tempFolderPath == null) - return Files.createTempFile(prefix, suffix).toFile(); + return File.createTempFile(prefix, suffix); else - return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + return File.createTempFile(prefix, suffix, new File(tempFolderPath)); } /** @@ -965,9 +946,6 @@ public void onResponse(Call call, Response response) throws IOException { } catch (ApiException e) { callback.onFailure(e, response.code(), response.headers().toMultimap()); return; - } catch (Exception e) { - callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); - return; } callback.onSuccess(result, response.code(), response.headers().toMultimap()); } @@ -1078,7 +1056,7 @@ public Request buildRequest(String path, String method, List queryParams, reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create("", MediaType.parse(contentType)); + reqBody = RequestBody.create(MediaType.parse(contentType), ""); } } else { reqBody = serialize(body, contentType); @@ -1229,10 +1207,10 @@ public RequestBody buildRequestBodyMultipart(Map formParams) { File file = (File) param.getValue(); Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); } else { Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(parameterToString(param.getValue()), null)); + mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); } } return mpBuilder.build(); diff --git a/src/main/java/com/adzerk/sdk/generated/ApiException.java b/src/main/java/com/adzerk/sdk/generated/ApiException.java index 481c871..6aaf702 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiException.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiException.java @@ -16,7 +16,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/com/adzerk/sdk/generated/Configuration.java b/src/main/java/com/adzerk/sdk/generated/Configuration.java index ab4d824..f6b8c63 100644 --- a/src/main/java/com/adzerk/sdk/generated/Configuration.java +++ b/src/main/java/com/adzerk/sdk/generated/Configuration.java @@ -13,7 +13,7 @@ package com.adzerk.sdk.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Configuration { private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/com/adzerk/sdk/generated/JSON.java b/src/main/java/com/adzerk/sdk/generated/JSON.java index d2426d5..abc9409 100644 --- a/src/main/java/com/adzerk/sdk/generated/JSON.java +++ b/src/main/java/com/adzerk/sdk/generated/JSON.java @@ -50,7 +50,6 @@ public class JSON { private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); - @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() ; diff --git a/src/main/java/com/adzerk/sdk/generated/Pair.java b/src/main/java/com/adzerk/sdk/generated/Pair.java index b6db0fb..24b7bbc 100644 --- a/src/main/java/com/adzerk/sdk/generated/Pair.java +++ b/src/main/java/com/adzerk/sdk/generated/Pair.java @@ -13,7 +13,7 @@ package com.adzerk.sdk.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/com/adzerk/sdk/generated/StringUtil.java b/src/main/java/com/adzerk/sdk/generated/StringUtil.java index 24b4fe2..3dd7a5c 100644 --- a/src/main/java/com/adzerk/sdk/generated/StringUtil.java +++ b/src/main/java/com/adzerk/sdk/generated/StringUtil.java @@ -13,10 +13,7 @@ package com.adzerk.sdk.generated; -import java.util.Collection; -import java.util.Iterator; - -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). @@ -61,23 +58,4 @@ public static String join(String[] array, String separator) { } return out.toString(); } - - /** - * Join a list of strings with the given separator. - * - * @param list The list of strings - * @param separator The separator - * @return the resulting string - */ - public static String join(Collection list, String separator) { - Iterator iterator = list.iterator(); - StringBuilder out = new StringBuilder(); - if (iterator.hasNext()) { - out.append(iterator.next()); - } - while (iterator.hasNext()) { - out.append(separator).append(iterator.next()); - } - return out.toString(); - } } diff --git a/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java b/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java index 41d03b7..796ac9a 100644 --- a/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java +++ b/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java @@ -79,7 +79,6 @@ public okhttp3.Call getDecisionsCall(DecisionRequest decisionRequest, final ApiC Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; diff --git a/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java b/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java index 8896be2..2f752ff 100644 --- a/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java +++ b/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java @@ -78,14 +78,13 @@ public okhttp3.Call addCustomPropertiesCall(Integer networkId, String userKey, O List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -207,10 +206,6 @@ public okhttp3.Call addInterestsCall(Integer networkId, String userKey, String i List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -219,6 +214,9 @@ public okhttp3.Call addInterestsCall(Integer networkId, String userKey, String i localVarQueryParams.addAll(localVarApiClient.parameterToPair("interest", interest)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -348,14 +346,13 @@ public okhttp3.Call addRetargetingSegmentCall(Integer networkId, Integer adverti List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -489,14 +486,13 @@ public okhttp3.Call forgetCall(Integer networkId, String userKey, final ApiCallb List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { }; @@ -613,7 +609,6 @@ public okhttp3.Call gdprConsentCall(Integer networkId, ConsentRequest consentReq Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "image/gif" }; @@ -727,10 +722,6 @@ public okhttp3.Call ipOverrideCall(Integer networkId, String userKey, String ip, List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -739,6 +730,9 @@ public okhttp3.Call ipOverrideCall(Integer networkId, String userKey, String ip, localVarQueryParams.addAll(localVarApiClient.parameterToPair("ip", ip)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -866,10 +860,6 @@ public okhttp3.Call matchUserCall(Integer networkId, String userKey, Integer par List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -882,6 +872,9 @@ public okhttp3.Call matchUserCall(Integer networkId, String userKey, Integer par localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -1015,14 +1008,13 @@ public okhttp3.Call optOutCall(Integer networkId, String userKey, final ApiCallb List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -1140,14 +1132,13 @@ public okhttp3.Call readCall(Integer networkId, String userKey, final ApiCallbac List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; diff --git a/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java b/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java index 5fc9b80..4aeb5de 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java b/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java index 86b92fc..a6f0405 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java @@ -18,7 +18,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java b/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java index 1fabd9e..036a863 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java +++ b/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java @@ -28,7 +28,7 @@ /** * ConsentRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class ConsentRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -88,7 +88,7 @@ public void setConsent(Object consent) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -105,6 +105,7 @@ public int hashCode() { return Objects.hash(userKey, consent); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,7 +120,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Content.java b/src/main/java/com/adzerk/sdk/generated/model/Content.java index 23df3f6..3f53c40 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Content.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Content.java @@ -28,7 +28,7 @@ /** * Content */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Content implements Serializable { private static final long serialVersionUID = 1L; @@ -169,7 +169,7 @@ public void setBody(String body) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -189,6 +189,7 @@ public int hashCode() { return Objects.hash(type, template, customTemplate, data, body); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -206,7 +207,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Decision.java b/src/main/java/com/adzerk/sdk/generated/model/Decision.java index 3be0691..4e07156 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Decision.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Decision.java @@ -35,7 +35,7 @@ /** * Decision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Decision implements Serializable { private static final long serialVersionUID = 1L; @@ -389,7 +389,7 @@ public void setPricing(PricingData pricing) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -416,6 +416,7 @@ public int hashCode() { return Objects.hash(adId, advertiserId, creativeId, flightId, campaignId, priorityId, clickUrl, contents, impressionUrl, events, matchedPoints, pricing); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -440,7 +441,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java b/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java index cbd0b5c..8ba439f 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java +++ b/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java @@ -32,7 +32,7 @@ /** * DecisionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class DecisionRequest implements Serializable { private static final long serialVersionUID = 1L; @@ -571,7 +571,7 @@ public void setIncludeMatchedPoints(Boolean includeMatchedPoints) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -605,6 +605,7 @@ public int hashCode() { return Objects.hash(placements, user, keywords, url, referrer, ip, blockedCreatives, isMobile, includePricingData, notrack, enableBotFiltering, enableUserDBIP, consent, deviceID, parallel, intendedLatitude, intendedLongitude, radius, includeMatchedPoints); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -636,7 +637,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java index 6fbd35b..1075c13 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java +++ b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java @@ -15,7 +15,6 @@ import java.util.Objects; import java.util.Arrays; -import com.adzerk.sdk.generated.model.Decision; import com.adzerk.sdk.generated.model.User; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -25,15 +24,12 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.io.Serializable; /** * DecisionResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class DecisionResponse implements Serializable { private static final long serialVersionUID = 1L; @@ -43,7 +39,7 @@ public class DecisionResponse implements Serializable { public static final String SERIALIZED_NAME_DECISIONS = "decisions"; @SerializedName(SERIALIZED_NAME_DECISIONS) - private Map decisions = null; + private Object decisions; public static final String SERIALIZED_NAME_EXPLAIN = "explain"; @SerializedName(SERIALIZED_NAME_EXPLAIN) @@ -73,20 +69,12 @@ public void setUser(User user) { } - public DecisionResponse decisions(Map decisions) { + public DecisionResponse decisions(Object decisions) { this.decisions = decisions; return this; } - public DecisionResponse putDecisionsItem(String key, Decision decisionsItem) { - if (this.decisions == null) { - this.decisions = new HashMap(); - } - this.decisions.put(key, decisionsItem); - return this; - } - /** * Get decisions * @return decisions @@ -94,12 +82,12 @@ public DecisionResponse putDecisionsItem(String key, Decision decisionsItem) { @javax.annotation.Nullable @ApiModelProperty(value = "") - public Map getDecisions() { + public Object getDecisions() { return decisions; } - public void setDecisions(Map decisions) { + public void setDecisions(Object decisions) { this.decisions = decisions; } @@ -128,7 +116,7 @@ public void setExplain(Object explain) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -146,6 +134,7 @@ public int hashCode() { return Objects.hash(user, decisions, explain); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -161,7 +150,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Event.java b/src/main/java/com/adzerk/sdk/generated/model/Event.java index da44a28..128e3ed 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Event.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Event.java @@ -29,7 +29,7 @@ /** * Event */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Event implements Serializable { private static final long serialVersionUID = 1L; @@ -89,7 +89,7 @@ public void setUrl(URI url) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -106,6 +106,7 @@ public int hashCode() { return Objects.hash(id, url); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,7 +121,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java b/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java index cbc29d7..4df88ff 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java +++ b/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java @@ -28,7 +28,7 @@ /** * MatchedPoint */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class MatchedPoint implements Serializable { private static final long serialVersionUID = 1L; @@ -88,7 +88,7 @@ public void setLon(String lon) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -105,6 +105,7 @@ public int hashCode() { return Objects.hash(lat, lon); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -119,7 +120,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Placement.java b/src/main/java/com/adzerk/sdk/generated/model/Placement.java index d0b4ff6..4525aef 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Placement.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Placement.java @@ -15,7 +15,6 @@ import java.util.Objects; import java.util.Arrays; -import com.adzerk.sdk.generated.model.SkipFilters; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; @@ -33,7 +32,7 @@ /** * Placement */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class Placement implements Serializable { private static final long serialVersionUID = 1L; @@ -125,10 +124,6 @@ public class Placement implements Serializable { @SerializedName(SERIALIZED_NAME_FLOOR_CPC) private Float floorCpc; - public static final String SERIALIZED_NAME_SKIP_FILTERS = "skipFilters"; - @SerializedName(SERIALIZED_NAME_SKIP_FILTERS) - private SkipFilters skipFilters; - public Placement divName(String divName) { @@ -678,31 +673,8 @@ public void setFloorCpc(Float floorCpc) { } - public Placement skipFilters(SkipFilters skipFilters) { - - this.skipFilters = skipFilters; - return this; - } - - /** - * Get skipFilters - * @return skipFilters - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public SkipFilters getSkipFilters() { - return skipFilters; - } - - - public void setSkipFilters(SkipFilters skipFilters) { - this.skipFilters = skipFilters; - } - - @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -731,15 +703,15 @@ public boolean equals(Object o) { Objects.equals(this.skipSelection, placement.skipSelection) && Objects.equals(this.adQuery, placement.adQuery) && Objects.equals(this.floorPrice, placement.floorPrice) && - Objects.equals(this.floorCpc, placement.floorCpc) && - Objects.equals(this.skipFilters, placement.skipFilters); + Objects.equals(this.floorCpc, placement.floorCpc); } @Override public int hashCode() { - return Objects.hash(divName, networkId, siteId, adTypes, zoneIds, campaignId, flightId, adId, clickUrl, properties, eventIds, overrides, contentKeys, count, proportionality, ecpmPartition, ecpmPartitions, eventMultiplier, skipSelection, adQuery, floorPrice, floorCpc, skipFilters); + return Objects.hash(divName, networkId, siteId, adTypes, zoneIds, campaignId, flightId, adId, clickUrl, properties, eventIds, overrides, contentKeys, count, proportionality, ecpmPartition, ecpmPartitions, eventMultiplier, skipSelection, adQuery, floorPrice, floorCpc); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -766,7 +738,6 @@ public String toString() { sb.append(" adQuery: ").append(toIndentedString(adQuery)).append("\n"); sb.append(" floorPrice: ").append(toIndentedString(floorPrice)).append("\n"); sb.append(" floorCpc: ").append(toIndentedString(floorCpc)).append("\n"); - sb.append(" skipFilters: ").append(toIndentedString(skipFilters)).append("\n"); sb.append("}"); return sb.toString(); } @@ -775,7 +746,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/PricingData.java b/src/main/java/com/adzerk/sdk/generated/model/PricingData.java index d5e9add..0b7a168 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/PricingData.java +++ b/src/main/java/com/adzerk/sdk/generated/model/PricingData.java @@ -28,7 +28,7 @@ /** * PricingData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class PricingData implements Serializable { private static final long serialVersionUID = 1L; @@ -169,7 +169,7 @@ public void seteCPM(Float eCPM) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -189,6 +189,7 @@ public int hashCode() { return Objects.hash(price, clearPrice, revenue, rateType, eCPM); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -206,7 +207,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java b/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java new file mode 100644 index 0000000..1021811 --- /dev/null +++ b/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java @@ -0,0 +1,131 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adzerk.sdk.generated.model; + +import java.util.Objects; +import java.util.Arrays; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.IOException; +import java.io.Serializable; + +/** + * RequestLocation + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-10-16T14:55:19.451-04:00[America/New_York]") +public class RequestLocation implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_LATITUDE = "latitude"; + @SerializedName(SERIALIZED_NAME_LATITUDE) + private String latitude; + + public static final String SERIALIZED_NAME_LONGITUDE = "longitude"; + @SerializedName(SERIALIZED_NAME_LONGITUDE) + private String longitude; + + + public RequestLocation latitude(String latitude) { + + this.latitude = latitude; + return this; + } + + /** + * Get latitude + * @return latitude + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLatitude() { + return latitude; + } + + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + + public RequestLocation longitude(String longitude) { + + this.longitude = longitude; + return this; + } + + /** + * Get longitude + * @return longitude + **/ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + + public String getLongitude() { + return longitude; + } + + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequestLocation requestLocation = (RequestLocation) o; + return Objects.equals(this.latitude, requestLocation.latitude) && + Objects.equals(this.longitude, requestLocation.longitude); + } + + @Override + public int hashCode() { + return Objects.hash(latitude, longitude); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequestLocation {\n"); + sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); + sb.append(" longitude: ").append(toIndentedString(longitude)).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/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java b/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java deleted file mode 100644 index 4164a3d..0000000 --- a/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Adzerk Decision API - * Adzerk Decision API - * - * The version of the OpenAPI document: 1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.adzerk.sdk.generated.model; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.io.Serializable; - -/** - * SkipFilters - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") -public class SkipFilters implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String SERIALIZED_NAME_DISTANCE = "distance"; - @SerializedName(SERIALIZED_NAME_DISTANCE) - private Boolean distance; - - public static final String SERIALIZED_NAME_FACET = "facet"; - @SerializedName(SERIALIZED_NAME_FACET) - private Boolean facet; - - public static final String SERIALIZED_NAME_GEODISTANCE = "geodistance"; - @SerializedName(SERIALIZED_NAME_GEODISTANCE) - private Boolean geodistance; - - public static final String SERIALIZED_NAME_GEOLOCATION = "geolocation"; - @SerializedName(SERIALIZED_NAME_GEOLOCATION) - private Boolean geolocation; - - public static final String SERIALIZED_NAME_KEYWORD = "keyword"; - @SerializedName(SERIALIZED_NAME_KEYWORD) - private Boolean keyword; - - public static final String SERIALIZED_NAME_LOCATION = "location"; - @SerializedName(SERIALIZED_NAME_LOCATION) - private Boolean location; - - public static final String SERIALIZED_NAME_PLACEMENT_LIMIT = "placementLimit"; - @SerializedName(SERIALIZED_NAME_PLACEMENT_LIMIT) - private Boolean placementLimit; - - public static final String SERIALIZED_NAME_SITE_ZONE = "siteZone"; - @SerializedName(SERIALIZED_NAME_SITE_ZONE) - private Boolean siteZone; - - - public SkipFilters distance(Boolean distance) { - - this.distance = distance; - return this; - } - - /** - * Geodistance filter, which skips geodistance targeting if true. - * @return distance - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Geodistance filter, which skips geodistance targeting if true.") - - public Boolean getDistance() { - return distance; - } - - - public void setDistance(Boolean distance) { - this.distance = distance; - } - - - public SkipFilters facet(Boolean facet) { - - this.facet = facet; - return this; - } - - /** - * Facet targeting filter, which skips facet targeting if true. - * @return facet - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Facet targeting filter, which skips facet targeting if true.") - - public Boolean getFacet() { - return facet; - } - - - public void setFacet(Boolean facet) { - this.facet = facet; - } - - - public SkipFilters geodistance(Boolean geodistance) { - - this.geodistance = geodistance; - return this; - } - - /** - * Geodistance filter, which skips geodistance targeting if true. - * @return geodistance - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Geodistance filter, which skips geodistance targeting if true.") - - public Boolean getGeodistance() { - return geodistance; - } - - - public void setGeodistance(Boolean geodistance) { - this.geodistance = geodistance; - } - - - public SkipFilters geolocation(Boolean geolocation) { - - this.geolocation = geolocation; - return this; - } - - /** - * Geolocation filter, which skips location targeting if true. - * @return geolocation - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Geolocation filter, which skips location targeting if true.") - - public Boolean getGeolocation() { - return geolocation; - } - - - public void setGeolocation(Boolean geolocation) { - this.geolocation = geolocation; - } - - - public SkipFilters keyword(Boolean keyword) { - - this.keyword = keyword; - return this; - } - - /** - * Keyword limit filter, which skips all (ad and/or flight) keyword targeting if true. - * @return keyword - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Keyword limit filter, which skips all (ad and/or flight) keyword targeting if true.") - - public Boolean getKeyword() { - return keyword; - } - - - public void setKeyword(Boolean keyword) { - this.keyword = keyword; - } - - - public SkipFilters location(Boolean location) { - - this.location = location; - return this; - } - - /** - * Geolocation filter, which skips location targeting if true. - * @return location - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Geolocation filter, which skips location targeting if true.") - - public Boolean getLocation() { - return location; - } - - - public void setLocation(Boolean location) { - this.location = location; - } - - - public SkipFilters placementLimit(Boolean placementLimit) { - - this.placementLimit = placementLimit; - return this; - } - - /** - * Placement limit filter, where no advertiser placement limit if true. - * @return placementLimit - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Placement limit filter, where no advertiser placement limit if true.") - - public Boolean getPlacementLimit() { - return placementLimit; - } - - - public void setPlacementLimit(Boolean placementLimit) { - this.placementLimit = placementLimit; - } - - - public SkipFilters siteZone(Boolean siteZone) { - - this.siteZone = siteZone; - return this; - } - - /** - * Site/zone limit filter, which skips site/zone targeting if true. - * @return siteZone - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "Site/zone limit filter, which skips site/zone targeting if true.") - - public Boolean getSiteZone() { - return siteZone; - } - - - public void setSiteZone(Boolean siteZone) { - this.siteZone = siteZone; - } - - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - SkipFilters skipFilters = (SkipFilters) o; - return Objects.equals(this.distance, skipFilters.distance) && - Objects.equals(this.facet, skipFilters.facet) && - Objects.equals(this.geodistance, skipFilters.geodistance) && - Objects.equals(this.geolocation, skipFilters.geolocation) && - Objects.equals(this.keyword, skipFilters.keyword) && - Objects.equals(this.location, skipFilters.location) && - Objects.equals(this.placementLimit, skipFilters.placementLimit) && - Objects.equals(this.siteZone, skipFilters.siteZone); - } - - @Override - public int hashCode() { - return Objects.hash(distance, facet, geodistance, geolocation, keyword, location, placementLimit, siteZone); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class SkipFilters {\n"); - sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); - sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); - sb.append(" geodistance: ").append(toIndentedString(geodistance)).append("\n"); - sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); - sb.append(" keyword: ").append(toIndentedString(keyword)).append("\n"); - sb.append(" location: ").append(toIndentedString(location)).append("\n"); - sb.append(" placementLimit: ").append(toIndentedString(placementLimit)).append("\n"); - sb.append(" siteZone: ").append(toIndentedString(siteZone)).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 "); - } - -} - diff --git a/src/main/java/com/adzerk/sdk/generated/model/User.java b/src/main/java/com/adzerk/sdk/generated/model/User.java index 6b5eddd..d6ae06b 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/User.java +++ b/src/main/java/com/adzerk/sdk/generated/model/User.java @@ -29,7 +29,7 @@ * Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1) */ @ApiModel(description = "Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1)") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-07-16T01:15:27.717Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") public class User implements Serializable { private static final long serialVersionUID = 1L; @@ -62,7 +62,7 @@ public void setKey(String key) { @Override - public boolean equals(Object o) { + public boolean equals(java.lang.Object o) { if (this == o) { return true; } @@ -78,6 +78,7 @@ public int hashCode() { return Objects.hash(key); } + @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -91,7 +92,7 @@ public String toString() { * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ - private String toIndentedString(Object o) { + private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } From e103f86ea3b95d06e9502fd124b7dd210dc7e8ad Mon Sep 17 00:00:00 2001 From: lqrs <64920932+lqrs@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:21:21 +0000 Subject: [PATCH 2/3] Refresh generated from api-specification --- .../com/adzerk/sdk/generated/ApiCallback.java | 4 +- .../com/adzerk/sdk/generated/ApiClient.java | 497 ++++++++++++---- .../adzerk/sdk/generated/ApiException.java | 80 ++- .../com/adzerk/sdk/generated/ApiResponse.java | 21 +- .../adzerk/sdk/generated/Configuration.java | 66 ++- .../java/com/adzerk/sdk/generated/JSON.java | 113 ++-- .../java/com/adzerk/sdk/generated/Pair.java | 6 +- .../sdk/generated/ProgressResponseBody.java | 2 - .../sdk/generated/ServerConfiguration.java | 20 +- .../adzerk/sdk/generated/ServerVariable.java | 14 + .../com/adzerk/sdk/generated/StringUtil.java | 24 +- .../adzerk/sdk/generated/api/DecisionApi.java | 65 ++- .../adzerk/sdk/generated/api/UserdbApi.java | 547 ++++++++++++------ .../adzerk/sdk/generated/auth/ApiKeyAuth.java | 7 +- .../sdk/generated/auth/Authentication.java | 9 +- .../sdk/generated/auth/HttpBasicAuth.java | 7 +- .../sdk/generated/auth/HttpBearerAuth.java | 29 +- .../model/AbstractOpenApiSchema.java | 146 +++++ .../sdk/generated/model/ConsentRequest.java | 149 ++++- .../adzerk/sdk/generated/model/Content.java | 197 +++++-- .../adzerk/sdk/generated/model/Decision.java | 396 +++++++++---- .../sdk/generated/model/DecisionRequest.java | 437 ++++++++------ .../sdk/generated/model/DecisionResponse.java | 210 +++++-- .../model/DecisionResponseDecisionsValue.java | 297 ++++++++++ .../com/adzerk/sdk/generated/model/Event.java | 149 ++++- .../sdk/generated/model/MatchedPoint.java | 152 ++++- .../adzerk/sdk/generated/model/Placement.java | 501 +++++++++------- .../sdk/generated/model/PricingData.java | 185 ++++-- .../sdk/generated/model/RequestLocation.java | 131 ----- .../sdk/generated/model/SkipFilters.java | 387 +++++++++++++ .../com/adzerk/sdk/generated/model/User.java | 137 ++++- 31 files changed, 3763 insertions(+), 1222 deletions(-) create mode 100644 src/main/java/com/adzerk/sdk/generated/model/AbstractOpenApiSchema.java create mode 100644 src/main/java/com/adzerk/sdk/generated/model/DecisionResponseDecisionsValue.java delete mode 100644 src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java create mode 100644 src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java diff --git a/src/main/java/com/adzerk/sdk/generated/ApiCallback.java b/src/main/java/com/adzerk/sdk/generated/ApiCallback.java index a891fc6..f48fecc 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiCallback.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiCallback.java @@ -52,10 +52,10 @@ public interface ApiCallback { void onUploadProgress(long bytesWritten, long contentLength, boolean done); /** - * This is called when the API downlond processing. + * This is called when the API download processing. * * @param bytesRead bytes Read - * @param contentLength content lenngth of the response + * @param contentLength content length of the response * @param done Read end */ void onDownloadProgress(long bytesRead, long contentLength, boolean done); diff --git a/src/main/java/com/adzerk/sdk/generated/ApiClient.java b/src/main/java/com/adzerk/sdk/generated/ApiClient.java index 47ad87b..7946ace 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiClient.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiClient.java @@ -18,11 +18,9 @@ import okhttp3.internal.tls.OkHostnameVerifier; import okhttp3.logging.HttpLoggingInterceptor; import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; import okio.BufferedSink; import okio.Okio; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; import javax.net.ssl.*; import java.io.File; @@ -33,6 +31,8 @@ import java.net.URI; import java.net.URLConnection; import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.SecureRandom; @@ -41,9 +41,13 @@ import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -52,31 +56,60 @@ import com.adzerk.sdk.generated.auth.HttpBearerAuth; import com.adzerk.sdk.generated.auth.ApiKeyAuth; +/** + *

ApiClient class.

+ */ public class ApiClient { - private String basePath = "https://e-23.adzerk.net"; - private boolean debugging = false; - private Map defaultHeaderMap = new HashMap(); - private Map defaultCookieMap = new HashMap(); - private String tempFolderPath = null; - - private Map authentications; - - private DateFormat dateFormat; - private DateFormat datetimeFormat; - private boolean lenientDatetimeFormat; - private int dateLength; - - private InputStream sslCaCert; - private boolean verifyingSsl; - private KeyManager[] keyManagers; - - private OkHttpClient httpClient; - private JSON json; + protected String basePath = "https://e-23.adzerk.net"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "{protocol}://e-{networkId}.adzerk.net", + "No description provided", + new HashMap() {{ + put("protocol", new ServerVariable( + "No description provided", + "https", + new HashSet( + Arrays.asList( + "http", + "https" + ) + ) + )); + put("networkId", new ServerVariable( + "Your Adzerk Network Id", + "23", + new HashSet( + ) + )); + }} + ) + )); + protected Integer serverIndex = 0; + protected Map serverVariables = null; + protected boolean debugging = false; + protected Map defaultHeaderMap = new HashMap(); + protected Map defaultCookieMap = new HashMap(); + protected String tempFolderPath = null; + + protected Map authentications; + + protected DateFormat dateFormat; + protected DateFormat datetimeFormat; + protected boolean lenientDatetimeFormat; + protected int dateLength; + + protected InputStream sslCaCert; + protected boolean verifyingSsl; + protected KeyManager[] keyManagers; + + protected OkHttpClient httpClient; + protected JSON json; + + protected HttpLoggingInterceptor loggingInterceptor; - private HttpLoggingInterceptor loggingInterceptor; - - /* + /** * Basic constructor for ApiClient */ public ApiClient() { @@ -89,11 +122,27 @@ public ApiClient() { authentications = Collections.unmodifiableMap(authentications); } - private void initHttpClient() { + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("ApiKeyAuth", new ApiKeyAuth("header", "X-Adzerk-ApiKey")); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + protected void initHttpClient() { initHttpClient(Collections.emptyList()); } - private void initHttpClient(List interceptors) { + protected void initHttpClient(List interceptors) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.addNetworkInterceptor(getProgressInterceptor()); for (Interceptor interceptor: interceptors) { @@ -103,7 +152,7 @@ private void initHttpClient(List interceptors) { httpClient = builder.build(); } - private void init() { + protected void init() { verifyingSsl = true; json = new JSON(); @@ -131,6 +180,34 @@ public String getBasePath() { */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; + this.serverIndex = null; + return this; + } + + public List getServers() { + return servers; + } + + public ApiClient setServers(List servers) { + this.servers = servers; + return this; + } + + public Integer getServerIndex() { + return serverIndex; + } + + public ApiClient setServerIndex(Integer serverIndex) { + this.serverIndex = serverIndex; + return this; + } + + public Map getServerVariables() { + return serverVariables; + } + + public ApiClient setServerVariables(Map serverVariables) { + this.serverVariables = serverVariables; return this; } @@ -148,7 +225,7 @@ public OkHttpClient getHttpClient() { * * @param newHttpClient An instance of OkHttpClient * @return Api Client - * @throws NullPointerException when newHttpClient is null + * @throws java.lang.NullPointerException when newHttpClient is null */ public ApiClient setHttpClient(OkHttpClient newHttpClient) { this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); @@ -220,6 +297,11 @@ public ApiClient setSslCaCert(InputStream sslCaCert) { return this; } + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ public KeyManager[] getKeyManagers() { return keyManagers; } @@ -237,32 +319,67 @@ public ApiClient setKeyManagers(KeyManager[] managers) { return this; } + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ public DateFormat getDateFormat() { return dateFormat; } + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.adzerk.sdk.generated.ApiClient} object + */ public ApiClient setDateFormat(DateFormat dateFormat) { - this.json.setDateFormat(dateFormat); + JSON.setDateFormat(dateFormat); return this; } + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.adzerk.sdk.generated.ApiClient} object + */ public ApiClient setSqlDateFormat(DateFormat dateFormat) { - this.json.setSqlDateFormat(dateFormat); + JSON.setSqlDateFormat(dateFormat); return this; } + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.adzerk.sdk.generated.ApiClient} object + */ public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { - this.json.setOffsetDateTimeFormat(dateFormat); + JSON.setOffsetDateTimeFormat(dateFormat); return this; } + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.adzerk.sdk.generated.ApiClient} object + */ public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { - this.json.setLocalDateFormat(dateFormat); + JSON.setLocalDateFormat(dateFormat); return this; } + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link com.adzerk.sdk.generated.ApiClient} object + */ public ApiClient setLenientOnJson(boolean lenientOnJson) { - this.json.setLenientOnJson(lenientOnJson); + JSON.setLenientOnJson(lenientOnJson); return this; } @@ -285,6 +402,7 @@ public Authentication getAuthentication(String authName) { return authentications.get(authName); } + /** * Helper method to set username for the first HTTP basic authentication. * @@ -354,6 +472,31 @@ public void setAccessToken(String accessToken) { throw new RuntimeException("No OAuth2 authentication configured!"); } + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + + /** + * Helper method to set credentials for AWSV4 Signature + * + * @param accessKey Access Key + * @param secretKey Secret Key + * @param sessionToken Session Token + * @param region Region + * @param service Service to access to + */ + public void setAWS4Configuration(String accessKey, String secretKey, String sessionToken, String region, String service) { + throw new RuntimeException("No AWS4 authentication configured!"); + } + /** * Set the User-Agent header's value (by adding to the default header map). * @@ -411,7 +554,9 @@ public ApiClient setDebugging(boolean debugging) { loggingInterceptor.setLevel(Level.BODY); httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); } else { - httpClient.interceptors().remove(loggingInterceptor); + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); loggingInterceptor = null; } } @@ -422,9 +567,9 @@ public ApiClient setDebugging(boolean debugging) { /** * The path of temporary folder used to store downloaded files from endpoints * with file response. The default value is null, i.e. using - * the system's default tempopary folder. + * the system's default temporary folder. * - * @see createTempFile + * @see createTempFile * @return Temporary folder path */ public String getTempFolderPath() { @@ -454,7 +599,7 @@ public int getConnectTimeout() { /** * Sets the connect timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param connectionTimeout connection timeout in milliseconds * @return Api client @@ -476,7 +621,7 @@ public int getReadTimeout() { /** * Sets the read timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param readTimeout read timeout in milliseconds * @return Api client @@ -498,7 +643,7 @@ public int getWriteTimeout() { /** * Sets the write timeout (in milliseconds). * A value of 0 means no timeout, otherwise values must be between 1 and - * {@link Integer#MAX_VALUE}. + * {@link java.lang.Integer#MAX_VALUE}. * * @param writeTimeout connection timeout in milliseconds * @return Api client @@ -520,7 +665,7 @@ public String parameterToString(Object param) { return ""; } else if (param instanceof Date || param instanceof OffsetDateTime || param instanceof LocalDate) { //Serialize to json string and remove the " enclosing characters - String jsonStr = json.serialize(param); + String jsonStr = JSON.serialize(param); return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); @@ -528,7 +673,7 @@ public String parameterToString(Object param) { if (b.length() > 0) { b.append(","); } - b.append(String.valueOf(o)); + b.append(o); } return b.toString(); } else { @@ -607,6 +752,31 @@ public List parameterToPairs(String collectionFormat, String name, Collect return params; } + /** + * Formats the specified free-form query parameters to a list of {@code Pair} objects. + * + * @param value The free-form query parameters. + * @return A list of {@code Pair} objects. + */ + public List freeFormParameterToPairs(Object value) { + List params = new ArrayList<>(); + + // preconditions + if (value == null || !(value instanceof Map )) { + return params; + } + + @SuppressWarnings("unchecked") + final Map valuesMap = (Map) value; + + for (Map.Entry entry : valuesMap.entrySet()) { + params.add(new Pair(entry.getKey(), parameterToString(entry.getValue()))); + } + + return params; + } + + /** * Formats the specified collection path parameter to a string value. * @@ -649,7 +819,7 @@ public String collectionPathParameterToString(String collectionFormat, Collectio * @return The sanitized filename */ public String sanitizeFilename(String filename) { - return filename.replaceAll(".*[/\\\\]", ""); + return filename.replaceFirst("^.*[/\\\\]", ""); } /** @@ -696,17 +866,23 @@ public String selectHeaderAccept(String[] accepts) { * * @param contentTypes The Content-Type array to select from * @return The Content-Type header to use. If the given array is empty, - * or matches "any", JSON will be used. + * returns null. If it matches "any", JSON will be used. */ public String selectHeaderContentType(String[] contentTypes) { - if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { return "application/json"; } + for (String contentType : contentTypes) { if (isJsonMime(contentType)) { return contentType; } } + return contentTypes[0]; } @@ -732,7 +908,7 @@ public String escapeString(String str) { * @param response HTTP response * @param returnType The type of the Java object * @return The deserialized Java object - * @throws ApiException If fail to deserialize response body, i.e. cannot read response body + * @throws com.adzerk.sdk.generated.ApiException If fail to deserialize response body, i.e. cannot read response body * or the Content-Type of the response is not supported. */ @SuppressWarnings("unchecked") @@ -753,17 +929,8 @@ public T deserialize(Response response, Type returnType) throws ApiException return (T) downloadFileFromResponse(response); } - String respBody; - try { - if (response.body() != null) - respBody = response.body().string(); - else - respBody = null; - } catch (IOException e) { - throw new ApiException(e); - } - - if (respBody == null || "".equals(respBody)) { + ResponseBody respBody = response.body(); + if (respBody == null) { return null; } @@ -772,17 +939,25 @@ public T deserialize(Response response, Type returnType) throws ApiException // ensuring a default content type contentType = "application/json"; } - if (isJsonMime(contentType)) { - return json.deserialize(respBody, returnType); - } else if (returnType.equals(String.class)) { - // Expecting string, return the raw response body. - return (T) respBody; - } else { - throw new ApiException( + try { + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody.byteStream(), returnType); + } else if (returnType.equals(String.class)) { + String respBodyString = respBody.string(); + if (respBodyString.isEmpty()) { + return null; + } + // Expecting string, return the raw response body. + return (T) respBodyString; + } else { + throw new ApiException( "Content type \"" + contentType + "\" is not supported for type: " + returnType, response.code(), response.headers().toMultimap(), - respBody); + response.body().string()); + } + } catch (IOException e) { + throw new ApiException(e); } } @@ -793,23 +968,27 @@ public T deserialize(Response response, Type returnType) throws ApiException * @param obj The Java object * @param contentType The request Content-Type * @return The serialized request body - * @throws ApiException If fail to serialize the given object + * @throws com.adzerk.sdk.generated.ApiException If fail to serialize the given object */ public RequestBody serialize(Object obj, String contentType) throws ApiException { if (obj instanceof byte[]) { // Binary (byte array) body parameter support. - return RequestBody.create(MediaType.parse(contentType), (byte[]) obj); + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); } else if (obj instanceof File) { // File body parameter support. - return RequestBody.create(MediaType.parse(contentType), (File) obj); + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); } else if (isJsonMime(contentType)) { String content; if (obj != null) { - content = json.serialize(obj); + content = JSON.serialize(obj); } else { content = null; } - return RequestBody.create(MediaType.parse(contentType), content); + return RequestBody.create(content, MediaType.parse(contentType)); + } else if (obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); } else { throw new ApiException("Content type \"" + contentType + "\" is not supported"); } @@ -819,7 +998,7 @@ public RequestBody serialize(Object obj, String contentType) throws ApiException * Download file from the given response. * * @param response An instance of the Response object - * @throws ApiException If fail to read file content from response and write to disk + * @throws com.adzerk.sdk.generated.ApiException If fail to read file content from response and write to disk * @return Downloaded file */ public File downloadFileFromResponse(Response response) throws ApiException { @@ -839,7 +1018,7 @@ public File downloadFileFromResponse(Response response) throws ApiException { * * @param response An instance of the Response object * @return Prepared file for the download - * @throws IOException If fail to prepare file for download + * @throws java.io.IOException If fail to prepare file for download */ public File prepareDownloadFile(Response response) throws IOException { String filename = null; @@ -866,15 +1045,15 @@ public File prepareDownloadFile(Response response) throws IOException { prefix = filename.substring(0, pos) + "-"; suffix = filename.substring(pos); } - // File.createTempFile requires the prefix to be at least three characters long + // Files.createTempFile requires the prefix to be at least three characters long if (prefix.length() < 3) prefix = "download-"; } if (tempFolderPath == null) - return File.createTempFile(prefix, suffix); + return Files.createTempFile(prefix, suffix).toFile(); else - return File.createTempFile(prefix, suffix, new File(tempFolderPath)); + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); } /** @@ -883,7 +1062,7 @@ public File prepareDownloadFile(Response response) throws IOException { * @param Type * @param call An instance of the Call object * @return ApiResponse<T> - * @throws ApiException If fail to execute the call + * @throws com.adzerk.sdk.generated.ApiException If fail to execute the call */ public ApiResponse execute(Call call) throws ApiException { return execute(call, null); @@ -898,7 +1077,7 @@ public ApiResponse execute(Call call) throws ApiException { * @return ApiResponse object containing response status, headers and * data, which is a Java object deserialized from response body and would be null * when returnType is null. - * @throws ApiException If fail to execute the call + * @throws com.adzerk.sdk.generated.ApiException If fail to execute the call */ public ApiResponse execute(Call call, Type returnType) throws ApiException { try { @@ -946,6 +1125,9 @@ public void onResponse(Call call, Response response) throws IOException { } catch (ApiException e) { callback.onFailure(e, response.code(), response.headers().toMultimap()); return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; } callback.onSuccess(result, response.code(), response.headers().toMultimap()); } @@ -959,7 +1141,7 @@ public void onResponse(Call call, Response response) throws IOException { * @param response Response * @param returnType Return type * @return Type - * @throws ApiException If the response has an unsuccessful status code or + * @throws com.adzerk.sdk.generated.ApiException If the response has an unsuccessful status code or * fail to deserialize the response body */ public T handleResponse(Response response, Type returnType) throws ApiException { @@ -994,6 +1176,7 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept /** * Build HTTP call with the given options. * + * @param baseUrl The base URL * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters @@ -1005,10 +1188,10 @@ public T handleResponse(Response response, Type returnType) throws ApiExcept * @param authNames The authentications to apply * @param callback Callback for upload/download progress * @return The HTTP call - * @throws ApiException If fail to serialize the request body object + * @throws com.adzerk.sdk.generated.ApiException If fail to serialize the request body object */ - public Call buildCall(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); + public Call buildCall(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + Request request = buildRequest(baseUrl, path, method, queryParams, collectionQueryParams, body, headerParams, cookieParams, formParams, authNames, callback); return httpClient.newCall(request); } @@ -1016,6 +1199,7 @@ public Call buildCall(String path, String method, List queryParams, List

queryParams, List

queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { - updateParamsForAuth(authNames, queryParams, headerParams, cookieParams); - - final String url = buildUrl(path, queryParams, collectionQueryParams); - final Request.Builder reqBuilder = new Request.Builder().url(url); - processHeaderParams(headerParams, reqBuilder); - processCookieParams(cookieParams, reqBuilder); - - String contentType = (String) headerParams.get("Content-Type"); - // ensuring a default content type - if (contentType == null) { - contentType = "application/json"; - } + public Request buildRequest(String baseUrl, String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map cookieParams, Map formParams, String[] authNames, ApiCallback callback) throws ApiException { + final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams); + // prepare HTTP request body RequestBody reqBody; + String contentType = headerParams.get("Content-Type"); + String contentTypePure = contentType; + if (contentTypePure != null && contentTypePure.contains(";")) { + contentTypePure = contentType.substring(0, contentType.indexOf(";")); + } if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; - } else if ("application/x-www-form-urlencoded".equals(contentType)) { + } else if ("application/x-www-form-urlencoded".equals(contentTypePure)) { reqBody = buildRequestBodyFormEncoding(formParams); - } else if ("multipart/form-data".equals(contentType)) { + } else if ("multipart/form-data".equals(contentTypePure)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { if ("DELETE".equals(method)) { @@ -1056,12 +1235,21 @@ public Request buildRequest(String path, String method, List queryParams, reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) - reqBody = RequestBody.create(MediaType.parse(contentType), ""); + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); } } else { reqBody = serialize(body, contentType); } + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + // Associate callback with request (if not null) so interceptor can // access it when creating ProgressResponseBody reqBuilder.tag(callback); @@ -1081,14 +1269,30 @@ public Request buildRequest(String path, String method, List queryParams, /** * Build full URL by concatenating base path, the given sub path and query parameters. * + * @param baseUrl The base URL * @param path The sub path * @param queryParams The query parameters * @param collectionQueryParams The collection query parameters * @return The full URL */ - public String buildUrl(String path, List queryParams, List collectionQueryParams) { + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { final StringBuilder url = new StringBuilder(); - url.append(basePath).append(path); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + String baseURL; + if (serverIndex != null) { + if (serverIndex < 0 || serverIndex >= servers.size()) { + throw new ArrayIndexOutOfBoundsException(String.format( + "Invalid index %d when selecting the host settings. Must be less than %d", serverIndex, servers.size() + )); + } + baseURL = servers.get(serverIndex).URL(serverVariables); + } else { + baseURL = basePath; + } + url.append(baseURL).append(path); + } if (queryParams != null && !queryParams.isEmpty()) { // support (constant) query string in `path`, e.g. "/posts?draft=1" @@ -1168,14 +1372,19 @@ public void processCookieParams(Map cookieParams, Request.Builde * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws com.adzerk.sdk.generated.ApiException If fails to update the parameters */ - public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, Map cookieParams) { + public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams, + Map cookieParams, String payload, String method, URI uri) throws ApiException { for (String authName : authNames) { Authentication auth = authentications.get(authName); if (auth == null) { throw new RuntimeException("Authentication undefined: " + authName); } - auth.applyToParams(queryParams, headerParams, cookieParams); + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); } } @@ -1205,12 +1414,18 @@ public RequestBody buildRequestBodyMultipart(Map formParams) { for (Entry param : formParams.entrySet()) { if (param.getValue() instanceof File) { File file = (File) param.getValue(); - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\"; filename=\"" + file.getName() + "\""); - MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); - mpBuilder.addPart(partHeaders, RequestBody.create(mediaType, file)); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), file); + } else if (param.getValue() instanceof List) { + List list = (List) param.getValue(); + for (Object item: list) { + if (item instanceof File) { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), (File) item); + } else { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } } else { - Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + param.getKey() + "\""); - mpBuilder.addPart(partHeaders, RequestBody.create(null, parameterToString(param.getValue()))); + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); } } return mpBuilder.build(); @@ -1231,11 +1446,49 @@ public String guessContentTypeFromFile(File file) { } } + /** + * Add a Content-Disposition Header for the given key and file to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param file The file to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, File file) { + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\"; filename=\"" + file.getName() + "\""); + MediaType mediaType = MediaType.parse(guessContentTypeFromFile(file)); + mpBuilder.addPart(partHeaders, RequestBody.create(file, mediaType)); + } + + /** + * Add a Content-Disposition Header for the given key and complex object to the MultipartBody Builder. + * + * @param mpBuilder MultipartBody.Builder + * @param key The key of the Header element + * @param obj The complex object to add to the Header + */ + protected void addPartToMultiPartBuilder(MultipartBody.Builder mpBuilder, String key, Object obj) { + RequestBody requestBody; + if (obj instanceof String) { + requestBody = RequestBody.create((String) obj, MediaType.parse("text/plain")); + } else { + String content; + if (obj != null) { + content = JSON.serialize(obj); + } else { + content = null; + } + requestBody = RequestBody.create(content, MediaType.parse("application/json")); + } + + Headers partHeaders = Headers.of("Content-Disposition", "form-data; name=\"" + key + "\""); + mpBuilder.addPart(partHeaders, requestBody); + } + /** * Get network interceptor to add it to the httpClient to track download progress for * async requests. */ - private Interceptor getProgressInterceptor() { + protected Interceptor getProgressInterceptor() { return new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { @@ -1256,7 +1509,7 @@ public Response intercept(Interceptor.Chain chain) throws IOException { * Apply SSL related settings to httpClient according to the current values of * verifyingSsl and sslCaCert. */ - private void applySslSettings() { + protected void applySslSettings() { try { TrustManager[] trustManagers; HostnameVerifier hostnameVerifier; @@ -1298,7 +1551,7 @@ public boolean verify(String hostname, SSLSession session) { KeyStore caKeyStore = newEmptyKeyStore(password); int index = 0; for (Certificate certificate : certificates) { - String certificateAlias = "ca" + Integer.toString(index++); + String certificateAlias = "ca" + (index++); caKeyStore.setCertificateEntry(certificateAlias, certificate); } trustManagerFactory.init(caKeyStore); @@ -1318,7 +1571,7 @@ public boolean verify(String hostname, SSLSession session) { } } - private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + protected KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { try { KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); keyStore.load(null, password); @@ -1327,4 +1580,26 @@ private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityExcepti throw new AssertionError(e); } } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws com.adzerk.sdk.generated.ApiException If fail to serialize the request body object into a string + */ + protected String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } } diff --git a/src/main/java/com/adzerk/sdk/generated/ApiException.java b/src/main/java/com/adzerk/sdk/generated/ApiException.java index 6aaf702..4671569 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiException.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiException.java @@ -16,22 +16,51 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class ApiException extends Exception { + private static final long serialVersionUID = 1L; + private int code = 0; private Map> responseHeaders = null; private String responseBody = null; + /** + *

Constructor for ApiException.

+ */ public ApiException() {} + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ public ApiException(Throwable throwable) { super(throwable); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ public ApiException(String message) { super(message); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { super(message, throwable); this.code = code; @@ -39,23 +68,60 @@ public ApiException(String message, Throwable throwable, int code, MapConstructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(String message, int code, Map> responseHeaders, String responseBody) { this(message, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { this(message, throwable, code, responseHeaders, null); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, Map> responseHeaders, String responseBody) { - this((String) null, (Throwable) null, code, responseHeaders, responseBody); + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ public ApiException(int code, String message) { super(message); this.code = code; } + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ public ApiException(int code, String message, Map> responseHeaders, String responseBody) { this(code, message); this.responseHeaders = responseHeaders; @@ -88,4 +154,14 @@ public Map> getResponseHeaders() { public String getResponseBody() { return responseBody; } + + /** + * Get the exception message including HTTP response data. + * + * @return The exception message + */ + public String getMessage() { + return String.format("Message: %s%nHTTP response code: %s%nHTTP response body: %s%nHTTP response headers: %s", + super.getMessage(), this.getCode(), this.getResponseBody(), this.getResponseHeaders()); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/ApiResponse.java b/src/main/java/com/adzerk/sdk/generated/ApiResponse.java index 0c05a15..fdce0be 100644 --- a/src/main/java/com/adzerk/sdk/generated/ApiResponse.java +++ b/src/main/java/com/adzerk/sdk/generated/ApiResponse.java @@ -18,8 +18,6 @@ /** * API response returned by API call. - * - * @param The type of data that is deserialized from response body */ public class ApiResponse { final private int statusCode; @@ -27,6 +25,8 @@ public class ApiResponse { final private T data; /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response */ @@ -35,6 +35,8 @@ public ApiResponse(int statusCode, Map> headers) { } /** + *

Constructor for ApiResponse.

+ * * @param statusCode The status code of HTTP response * @param headers The headers of HTTP response * @param data The object deserialized from response bod @@ -45,14 +47,29 @@ public ApiResponse(int statusCode, Map> headers, T data) { this.data = data; } + /** + *

Get the status code.

+ * + * @return the status code + */ public int getStatusCode() { return statusCode; } + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ public Map> getHeaders() { return headers; } + /** + *

Get the data.

+ * + * @return the data + */ public T getData() { return data; } diff --git a/src/main/java/com/adzerk/sdk/generated/Configuration.java b/src/main/java/com/adzerk/sdk/generated/Configuration.java index f6b8c63..5d72958 100644 --- a/src/main/java/com/adzerk/sdk/generated/Configuration.java +++ b/src/main/java/com/adzerk/sdk/generated/Configuration.java @@ -13,27 +13,51 @@ package com.adzerk.sdk.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Configuration { - private static ApiClient defaultApiClient = new ApiClient(); - - /** - * Get the default API client, which would be used when creating API - * instances without providing an API client. - * - * @return Default API client - */ - public static ApiClient getDefaultApiClient() { - return defaultApiClient; - } + public static final String VERSION = "1.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; - /** - * Set the default API client, which would be used when creating API - * instances without providing an API client. - * - * @param apiClient API client - */ - public static void setDefaultApiClient(ApiClient apiClient) { - defaultApiClient = apiClient; + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); } -} + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/src/main/java/com/adzerk/sdk/generated/JSON.java b/src/main/java/com/adzerk/sdk/generated/JSON.java index abc9409..3bf0bf7 100644 --- a/src/main/java/com/adzerk/sdk/generated/JSON.java +++ b/src/main/java/com/adzerk/sdk/generated/JSON.java @@ -23,33 +23,42 @@ import com.google.gson.JsonElement; import io.gsonfire.GsonFireBuilder; import io.gsonfire.TypeSelector; -import org.threeten.bp.LocalDate; -import org.threeten.bp.OffsetDateTime; -import org.threeten.bp.format.DateTimeFormatter; -import com.adzerk.sdk.generated.model.*; import okio.ByteString; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.Locale; import java.util.Map; import java.util.HashMap; +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ public class JSON { - private Gson gson; - private boolean isLenientOnJson = false; - private DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); - private SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); - private OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); - private LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); - private ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() ; @@ -80,14 +89,26 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri return clazz; } - public JSON() { - gson = createGson() - .registerTypeAdapter(Date.class, dateTypeAdapter) - .registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter) - .registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter) - .registerTypeAdapter(LocalDate.class, localDateTypeAdapter) - .registerTypeAdapter(byte[].class, byteArrayAdapter) - .create(); + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.ConsentRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.Content.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.Decision.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.DecisionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.DecisionResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.DecisionResponseDecisionsValue.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.Event.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.MatchedPoint.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.Placement.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.PricingData.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.SkipFilters.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.adzerk.sdk.generated.model.User.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); } /** @@ -95,7 +116,7 @@ public JSON() { * * @return Gson */ - public Gson getGson() { + public static Gson getGson() { return gson; } @@ -103,16 +124,13 @@ public Gson getGson() { * Set Gson. * * @param gson Gson - * @return JSON */ - public JSON setGson(Gson gson) { - this.gson = gson; - return this; + public static void setGson(Gson gson) { + JSON.gson = gson; } - public JSON setLenientOnJson(boolean lenientOnJson) { + public static void setLenientOnJson(boolean lenientOnJson) { isLenientOnJson = lenientOnJson; - return this; } /** @@ -121,7 +139,7 @@ public JSON setLenientOnJson(boolean lenientOnJson) { * @param obj Object * @return String representation of the JSON */ - public String serialize(Object obj) { + public static String serialize(Object obj) { return gson.toJson(obj); } @@ -134,7 +152,7 @@ public String serialize(Object obj) { * @return The deserialized Java object */ @SuppressWarnings("unchecked") - public T deserialize(String body, Type returnType) { + public static T deserialize(String body, Type returnType) { try { if (isLenientOnJson) { JsonReader jsonReader = new JsonReader(new StringReader(body)); @@ -155,10 +173,32 @@ public T deserialize(String body, Type returnType) { } } + /** + * Deserialize the given JSON InputStream to a Java object. + * + * @param Type + * @param inputStream The JSON InputStream + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + public static T deserialize(InputStream inputStream, Type returnType) throws IOException { + try (InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { + if (isLenientOnJson) { + // see https://google-gson.googlecode.com/svn/trunk/gson/docs/javadocs/com/google/gson/stream/JsonReader.html#setLenient(boolean) + JsonReader jsonReader = new JsonReader(reader); + jsonReader.setLenient(true); + return gson.fromJson(jsonReader, returnType); + } else { + return gson.fromJson(reader, returnType); + } + } + } + /** * Gson TypeAdapter for Byte Array type */ - public class ByteArrayAdapter extends TypeAdapter { + public static class ByteArrayAdapter extends TypeAdapter { @Override public void write(JsonWriter out, byte[] value) throws IOException { @@ -230,7 +270,7 @@ public OffsetDateTime read(JsonReader in) throws IOException { /** * Gson TypeAdapter for JSR310 LocalDate type */ - public class LocalDateTypeAdapter extends TypeAdapter { + public static class LocalDateTypeAdapter extends TypeAdapter { private DateTimeFormatter formatter; @@ -268,14 +308,12 @@ public LocalDate read(JsonReader in) throws IOException { } } - public JSON setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { offsetDateTimeTypeAdapter.setFormat(dateFormat); - return this; } - public JSON setLocalDateFormat(DateTimeFormatter dateFormat) { + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { localDateTypeAdapter.setFormat(dateFormat); - return this; } /** @@ -389,14 +427,11 @@ public Date read(JsonReader in) throws IOException { } } - public JSON setDateFormat(DateFormat dateFormat) { + public static void setDateFormat(DateFormat dateFormat) { dateTypeAdapter.setFormat(dateFormat); - return this; } - public JSON setSqlDateFormat(DateFormat dateFormat) { + public static void setSqlDateFormat(DateFormat dateFormat) { sqlDateTypeAdapter.setFormat(dateFormat); - return this; } - } diff --git a/src/main/java/com/adzerk/sdk/generated/Pair.java b/src/main/java/com/adzerk/sdk/generated/Pair.java index 24b7bbc..85cb758 100644 --- a/src/main/java/com/adzerk/sdk/generated/Pair.java +++ b/src/main/java/com/adzerk/sdk/generated/Pair.java @@ -13,7 +13,7 @@ package com.adzerk.sdk.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Pair { private String name = ""; private String value = ""; @@ -52,10 +52,6 @@ private boolean isValidString(String arg) { return false; } - if (arg.trim().isEmpty()) { - return false; - } - return true; } } diff --git a/src/main/java/com/adzerk/sdk/generated/ProgressResponseBody.java b/src/main/java/com/adzerk/sdk/generated/ProgressResponseBody.java index e2b0215..2f113b4 100644 --- a/src/main/java/com/adzerk/sdk/generated/ProgressResponseBody.java +++ b/src/main/java/com/adzerk/sdk/generated/ProgressResponseBody.java @@ -68,5 +68,3 @@ public long read(Buffer sink, long byteCount) throws IOException { }; } } - - diff --git a/src/main/java/com/adzerk/sdk/generated/ServerConfiguration.java b/src/main/java/com/adzerk/sdk/generated/ServerConfiguration.java index 1588927..cab03e4 100644 --- a/src/main/java/com/adzerk/sdk/generated/ServerConfiguration.java +++ b/src/main/java/com/adzerk/sdk/generated/ServerConfiguration.java @@ -1,3 +1,16 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.adzerk.sdk.generated; import java.util.Map; @@ -5,6 +18,7 @@ /** * Representing a Server configuration. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class ServerConfiguration { public String URL; public String description; @@ -12,7 +26,7 @@ public class ServerConfiguration { /** * @param URL A URL to the target host. - * @param description A describtion of the host designated by the URL. + * @param description A description of the host designated by the URL. * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. */ public ServerConfiguration(String URL, String description, Map variables) { @@ -39,10 +53,10 @@ public String URL(Map variables) { if (variables != null && variables.containsKey(name)) { value = variables.get(name); if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { - throw new RuntimeException("The variable " + name + " in the server URL has invalid value " + value + "."); + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); } } - url = url.replaceAll("\\{" + name + "\\}", value); + url = url.replace("{" + name + "}", value); } return url; } diff --git a/src/main/java/com/adzerk/sdk/generated/ServerVariable.java b/src/main/java/com/adzerk/sdk/generated/ServerVariable.java index 445cef2..064990a 100644 --- a/src/main/java/com/adzerk/sdk/generated/ServerVariable.java +++ b/src/main/java/com/adzerk/sdk/generated/ServerVariable.java @@ -1,3 +1,16 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + package com.adzerk.sdk.generated; import java.util.HashSet; @@ -5,6 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/adzerk/sdk/generated/StringUtil.java b/src/main/java/com/adzerk/sdk/generated/StringUtil.java index 3dd7a5c..c1d28ea 100644 --- a/src/main/java/com/adzerk/sdk/generated/StringUtil.java +++ b/src/main/java/com/adzerk/sdk/generated/StringUtil.java @@ -13,7 +13,10 @@ package com.adzerk.sdk.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). @@ -58,4 +61,23 @@ public static String join(String[] array, String separator) { } return out.toString(); } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java b/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java index 796ac9a..9ce3750 100644 --- a/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java +++ b/src/main/java/com/adzerk/sdk/generated/api/DecisionApi.java @@ -38,6 +38,8 @@ public class DecisionApi { private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; public DecisionApi() { this(Configuration.getDefaultApiClient()); @@ -55,6 +57,22 @@ public void setApiClient(ApiClient apiClient) { this.localVarApiClient = apiClient; } + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + /** * Build call for getDecisions * @param decisionRequest (optional) @@ -62,13 +80,27 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
400 Bad Request -
200 Successful decision request -
*/ - public okhttp3.Call getDecisionsCall(DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDecisionsCall(@javax.annotation.Nullable DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = decisionRequest; // create path and map variables @@ -79,6 +111,7 @@ public okhttp3.Call getDecisionsCall(DecisionRequest decisionRequest, final ApiC Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + final String[] localVarAccepts = { "application/json" }; @@ -91,18 +124,17 @@ public okhttp3.Call getDecisionsCall(DecisionRequest decisionRequest, final ApiC "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call getDecisionsValidateBeforeCall(DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { - - - okhttp3.Call localVarCall = getDecisionsCall(decisionRequest, _callback); - return localVarCall; + private okhttp3.Call getDecisionsValidateBeforeCall(@javax.annotation.Nullable DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { + return getDecisionsCall(decisionRequest, _callback); } @@ -113,13 +145,14 @@ private okhttp3.Call getDecisionsValidateBeforeCall(DecisionRequest decisionRequ * @return DecisionResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
400 Bad Request -
200 Successful decision request -
*/ - public DecisionResponse getDecisions(DecisionRequest decisionRequest) throws ApiException { + public DecisionResponse getDecisions(@javax.annotation.Nullable DecisionRequest decisionRequest) throws ApiException { ApiResponse localVarResp = getDecisionsWithHttpInfo(decisionRequest); return localVarResp.getData(); } @@ -131,13 +164,14 @@ public DecisionResponse getDecisions(DecisionRequest decisionRequest) throws Api * @return ApiResponse<DecisionResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
400 Bad Request -
200 Successful decision request -
*/ - public ApiResponse getDecisionsWithHttpInfo(DecisionRequest decisionRequest) throws ApiException { + public ApiResponse getDecisionsWithHttpInfo(@javax.annotation.Nullable DecisionRequest decisionRequest) throws ApiException { okhttp3.Call localVarCall = getDecisionsValidateBeforeCall(decisionRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -151,13 +185,14 @@ public ApiResponse getDecisionsWithHttpInfo(DecisionRequest de * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
400 Bad Request -
200 Successful decision request -
*/ - public okhttp3.Call getDecisionsAsync(DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getDecisionsAsync(@javax.annotation.Nullable DecisionRequest decisionRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getDecisionsValidateBeforeCall(decisionRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); diff --git a/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java b/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java index 2f752ff..86cafc8 100644 --- a/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java +++ b/src/main/java/com/adzerk/sdk/generated/api/UserdbApi.java @@ -38,6 +38,8 @@ public class UserdbApi { private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; public UserdbApi() { this(Configuration.getDefaultApiClient()); @@ -55,6 +57,22 @@ public void setApiClient(ApiClient apiClient) { this.localVarApiClient = apiClient; } + public int getHostIndex() { + return localHostIndex; + } + + public void setHostIndex(int hostIndex) { + this.localHostIndex = hostIndex; + } + + public String getCustomBaseUrl() { + return localCustomBaseUrl; + } + + public void setCustomBaseUrl(String customBaseUrl) { + this.localCustomBaseUrl = customBaseUrl; + } + /** * Build call for addCustomProperties * @param networkId Your Network Id (required) @@ -64,27 +82,42 @@ public void setApiClient(ApiClient apiClient) { * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addCustomPropertiesCall(Integer networkId, String userKey, Object body, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addCustomPropertiesCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = body; // create path and map variables String localVarPath = "/udb/{networkId}/custom" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -97,28 +130,27 @@ public okhttp3.Call addCustomPropertiesCall(Integer networkId, String userKey, O "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addCustomPropertiesValidateBeforeCall(Integer networkId, String userKey, Object body, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addCustomPropertiesValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling addCustomProperties(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling addCustomProperties(Async)"); } - - okhttp3.Call localVarCall = addCustomPropertiesCall(networkId, userKey, body, _callback); - return localVarCall; + return addCustomPropertiesCall(networkId, userKey, body, _callback); } @@ -131,12 +163,13 @@ private okhttp3.Call addCustomPropertiesValidateBeforeCall(Integer networkId, St * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public File addCustomProperties(Integer networkId, String userKey, Object body) throws ApiException { + public File addCustomProperties(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nullable Object body) throws ApiException { ApiResponse localVarResp = addCustomPropertiesWithHttpInfo(networkId, userKey, body); return localVarResp.getData(); } @@ -150,12 +183,13 @@ public File addCustomProperties(Integer networkId, String userKey, Object body) * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse addCustomPropertiesWithHttpInfo(Integer networkId, String userKey, Object body) throws ApiException { + public ApiResponse addCustomPropertiesWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nullable Object body) throws ApiException { okhttp3.Call localVarCall = addCustomPropertiesValidateBeforeCall(networkId, userKey, body, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -171,12 +205,13 @@ public ApiResponse addCustomPropertiesWithHttpInfo(Integer networkId, Stri * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addCustomPropertiesAsync(Integer networkId, String userKey, Object body, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addCustomPropertiesAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nullable Object body, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = addCustomPropertiesValidateBeforeCall(networkId, userKey, body, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -192,20 +227,38 @@ public okhttp3.Call addCustomPropertiesAsync(Integer networkId, String userKey, * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addInterestsCall(Integer networkId, String userKey, String interest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addInterestsCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String interest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/interest/i.gif" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -214,9 +267,6 @@ public okhttp3.Call addInterestsCall(Integer networkId, String userKey, String i localVarQueryParams.addAll(localVarApiClient.parameterToPair("interest", interest)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -226,36 +276,34 @@ public okhttp3.Call addInterestsCall(Integer networkId, String userKey, String i } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addInterestsValidateBeforeCall(Integer networkId, String userKey, String interest, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addInterestsValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String interest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling addInterests(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling addInterests(Async)"); } - + // verify the required parameter 'interest' is set if (interest == null) { throw new ApiException("Missing the required parameter 'interest' when calling addInterests(Async)"); } - - okhttp3.Call localVarCall = addInterestsCall(networkId, userKey, interest, _callback); - return localVarCall; + return addInterestsCall(networkId, userKey, interest, _callback); } @@ -268,12 +316,13 @@ private okhttp3.Call addInterestsValidateBeforeCall(Integer networkId, String us * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public File addInterests(Integer networkId, String userKey, String interest) throws ApiException { + public File addInterests(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String interest) throws ApiException { ApiResponse localVarResp = addInterestsWithHttpInfo(networkId, userKey, interest); return localVarResp.getData(); } @@ -287,12 +336,13 @@ public File addInterests(Integer networkId, String userKey, String interest) thr * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse addInterestsWithHttpInfo(Integer networkId, String userKey, String interest) throws ApiException { + public ApiResponse addInterestsWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String interest) throws ApiException { okhttp3.Call localVarCall = addInterestsValidateBeforeCall(networkId, userKey, interest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -308,12 +358,13 @@ public ApiResponse addInterestsWithHttpInfo(Integer networkId, String user * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addInterestsAsync(Integer networkId, String userKey, String interest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addInterestsAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String interest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = addInterestsValidateBeforeCall(networkId, userKey, interest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -330,29 +381,44 @@ public okhttp3.Call addInterestsAsync(Integer networkId, String userKey, String * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addRetargetingSegmentCall(Integer networkId, Integer advertiserId, Integer retargetingSegmentId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addRetargetingSegmentCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull Integer advertiserId, @javax.annotation.Nonnull Integer retargetingSegmentId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/rt/{advertiserId}/{retargetingSegmentId}/i.gif" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())) - .replaceAll("\\{" + "advertiserId" + "\\}", localVarApiClient.escapeString(advertiserId.toString())) - .replaceAll("\\{" + "retargetingSegmentId" + "\\}", localVarApiClient.escapeString(retargetingSegmentId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())) + .replace("{" + "advertiserId" + "}", localVarApiClient.escapeString(advertiserId.toString())) + .replace("{" + "retargetingSegmentId" + "}", localVarApiClient.escapeString(retargetingSegmentId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -362,41 +428,39 @@ public okhttp3.Call addRetargetingSegmentCall(Integer networkId, Integer adverti } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call addRetargetingSegmentValidateBeforeCall(Integer networkId, Integer advertiserId, Integer retargetingSegmentId, String userKey, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call addRetargetingSegmentValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull Integer advertiserId, @javax.annotation.Nonnull Integer retargetingSegmentId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling addRetargetingSegment(Async)"); } - + // verify the required parameter 'advertiserId' is set if (advertiserId == null) { throw new ApiException("Missing the required parameter 'advertiserId' when calling addRetargetingSegment(Async)"); } - + // verify the required parameter 'retargetingSegmentId' is set if (retargetingSegmentId == null) { throw new ApiException("Missing the required parameter 'retargetingSegmentId' when calling addRetargetingSegment(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling addRetargetingSegment(Async)"); } - - okhttp3.Call localVarCall = addRetargetingSegmentCall(networkId, advertiserId, retargetingSegmentId, userKey, _callback); - return localVarCall; + return addRetargetingSegmentCall(networkId, advertiserId, retargetingSegmentId, userKey, _callback); } @@ -410,12 +474,13 @@ private okhttp3.Call addRetargetingSegmentValidateBeforeCall(Integer networkId, * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public File addRetargetingSegment(Integer networkId, Integer advertiserId, Integer retargetingSegmentId, String userKey) throws ApiException { + public File addRetargetingSegment(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull Integer advertiserId, @javax.annotation.Nonnull Integer retargetingSegmentId, @javax.annotation.Nonnull String userKey) throws ApiException { ApiResponse localVarResp = addRetargetingSegmentWithHttpInfo(networkId, advertiserId, retargetingSegmentId, userKey); return localVarResp.getData(); } @@ -430,12 +495,13 @@ public File addRetargetingSegment(Integer networkId, Integer advertiserId, Integ * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse addRetargetingSegmentWithHttpInfo(Integer networkId, Integer advertiserId, Integer retargetingSegmentId, String userKey) throws ApiException { + public ApiResponse addRetargetingSegmentWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull Integer advertiserId, @javax.annotation.Nonnull Integer retargetingSegmentId, @javax.annotation.Nonnull String userKey) throws ApiException { okhttp3.Call localVarCall = addRetargetingSegmentValidateBeforeCall(networkId, advertiserId, retargetingSegmentId, userKey, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -452,12 +518,13 @@ public ApiResponse addRetargetingSegmentWithHttpInfo(Integer networkId, In * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call addRetargetingSegmentAsync(Integer networkId, Integer advertiserId, Integer retargetingSegmentId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call addRetargetingSegmentAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull Integer advertiserId, @javax.annotation.Nonnull Integer retargetingSegmentId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = addRetargetingSegmentValidateBeforeCall(networkId, advertiserId, retargetingSegmentId, userKey, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -472,29 +539,43 @@ public okhttp3.Call addRetargetingSegmentAsync(Integer networkId, Integer advert * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call forgetCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call forgetCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { - }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { @@ -502,31 +583,29 @@ public okhttp3.Call forgetCall(Integer networkId, String userKey, final ApiCallb } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; - return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call forgetValidateBeforeCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call forgetValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling forget(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling forget(Async)"); } - - okhttp3.Call localVarCall = forgetCall(networkId, userKey, _callback); - return localVarCall; + return forgetCall(networkId, userKey, _callback); } @@ -537,12 +616,13 @@ private okhttp3.Call forgetValidateBeforeCall(Integer networkId, String userKey, * @param userKey The User's UserDB Key (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public void forget(Integer networkId, String userKey) throws ApiException { + public void forget(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { forgetWithHttpInfo(networkId, userKey); } @@ -554,12 +634,13 @@ public void forget(Integer networkId, String userKey) throws ApiException { * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse forgetWithHttpInfo(Integer networkId, String userKey) throws ApiException { + public ApiResponse forgetWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { okhttp3.Call localVarCall = forgetValidateBeforeCall(networkId, userKey, null); return localVarApiClient.execute(localVarCall); } @@ -573,12 +654,13 @@ public ApiResponse forgetWithHttpInfo(Integer networkId, String userKey) t * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call forgetAsync(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call forgetAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = forgetValidateBeforeCall(networkId, userKey, _callback); localVarApiClient.executeAsync(localVarCall, _callback); @@ -592,23 +674,38 @@ public okhttp3.Call forgetAsync(Integer networkId, String userKey, final ApiCall * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call gdprConsentCall(Integer networkId, ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call gdprConsentCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nullable ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = consentRequest; // create path and map variables String localVarPath = "/udb/{networkId}/consent" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); + final String[] localVarAccepts = { "image/gif" }; @@ -621,23 +718,22 @@ public okhttp3.Call gdprConsentCall(Integer networkId, ConsentRequest consentReq "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; - return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call gdprConsentValidateBeforeCall(Integer networkId, ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call gdprConsentValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nullable ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling gdprConsent(Async)"); } - - okhttp3.Call localVarCall = gdprConsentCall(networkId, consentRequest, _callback); - return localVarCall; + return gdprConsentCall(networkId, consentRequest, _callback); } @@ -649,12 +745,13 @@ private okhttp3.Call gdprConsentValidateBeforeCall(Integer networkId, ConsentReq * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public File gdprConsent(Integer networkId, ConsentRequest consentRequest) throws ApiException { + public File gdprConsent(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nullable ConsentRequest consentRequest) throws ApiException { ApiResponse localVarResp = gdprConsentWithHttpInfo(networkId, consentRequest); return localVarResp.getData(); } @@ -667,12 +764,13 @@ public File gdprConsent(Integer networkId, ConsentRequest consentRequest) throws * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse gdprConsentWithHttpInfo(Integer networkId, ConsentRequest consentRequest) throws ApiException { + public ApiResponse gdprConsentWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nullable ConsentRequest consentRequest) throws ApiException { okhttp3.Call localVarCall = gdprConsentValidateBeforeCall(networkId, consentRequest, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -687,12 +785,13 @@ public ApiResponse gdprConsentWithHttpInfo(Integer networkId, ConsentReque * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call gdprConsentAsync(Integer networkId, ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { + public okhttp3.Call gdprConsentAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nullable ConsentRequest consentRequest, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = gdprConsentValidateBeforeCall(networkId, consentRequest, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -708,20 +807,38 @@ public okhttp3.Call gdprConsentAsync(Integer networkId, ConsentRequest consentRe * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The updated UserDB record -
*/ - public okhttp3.Call ipOverrideCall(Integer networkId, String userKey, String ip, final ApiCallback _callback) throws ApiException { + public okhttp3.Call ipOverrideCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String ip, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/ip/i.gif" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -730,9 +847,6 @@ public okhttp3.Call ipOverrideCall(Integer networkId, String userKey, String ip, localVarQueryParams.addAll(localVarApiClient.parameterToPair("ip", ip)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -742,36 +856,34 @@ public okhttp3.Call ipOverrideCall(Integer networkId, String userKey, String ip, } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call ipOverrideValidateBeforeCall(Integer networkId, String userKey, String ip, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call ipOverrideValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String ip, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling ipOverride(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling ipOverride(Async)"); } - + // verify the required parameter 'ip' is set if (ip == null) { throw new ApiException("Missing the required parameter 'ip' when calling ipOverride(Async)"); } - - okhttp3.Call localVarCall = ipOverrideCall(networkId, userKey, ip, _callback); - return localVarCall; + return ipOverrideCall(networkId, userKey, ip, _callback); } @@ -784,12 +896,13 @@ private okhttp3.Call ipOverrideValidateBeforeCall(Integer networkId, String user * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The updated UserDB record -
*/ - public File ipOverride(Integer networkId, String userKey, String ip) throws ApiException { + public File ipOverride(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String ip) throws ApiException { ApiResponse localVarResp = ipOverrideWithHttpInfo(networkId, userKey, ip); return localVarResp.getData(); } @@ -803,12 +916,13 @@ public File ipOverride(Integer networkId, String userKey, String ip) throws ApiE * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The updated UserDB record -
*/ - public ApiResponse ipOverrideWithHttpInfo(Integer networkId, String userKey, String ip) throws ApiException { + public ApiResponse ipOverrideWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String ip) throws ApiException { okhttp3.Call localVarCall = ipOverrideValidateBeforeCall(networkId, userKey, ip, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -824,12 +938,13 @@ public ApiResponse ipOverrideWithHttpInfo(Integer networkId, String userKe * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The updated UserDB record -
*/ - public okhttp3.Call ipOverrideAsync(Integer networkId, String userKey, String ip, final ApiCallback _callback) throws ApiException { + public okhttp3.Call ipOverrideAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull String ip, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = ipOverrideValidateBeforeCall(networkId, userKey, ip, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -846,20 +961,38 @@ public okhttp3.Call ipOverrideAsync(Integer networkId, String userKey, String ip * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call matchUserCall(Integer networkId, String userKey, Integer partnerId, Integer userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call matchUserCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull Integer partnerId, @javax.annotation.Nonnull Integer userId, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/sync/i.gif" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } @@ -872,9 +1005,6 @@ public okhttp3.Call matchUserCall(Integer networkId, String userKey, Integer par localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -884,41 +1014,39 @@ public okhttp3.Call matchUserCall(Integer networkId, String userKey, Integer par } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call matchUserValidateBeforeCall(Integer networkId, String userKey, Integer partnerId, Integer userId, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call matchUserValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull Integer partnerId, @javax.annotation.Nonnull Integer userId, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling matchUser(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling matchUser(Async)"); } - + // verify the required parameter 'partnerId' is set if (partnerId == null) { throw new ApiException("Missing the required parameter 'partnerId' when calling matchUser(Async)"); } - + // verify the required parameter 'userId' is set if (userId == null) { throw new ApiException("Missing the required parameter 'userId' when calling matchUser(Async)"); } - - okhttp3.Call localVarCall = matchUserCall(networkId, userKey, partnerId, userId, _callback); - return localVarCall; + return matchUserCall(networkId, userKey, partnerId, userId, _callback); } @@ -932,12 +1060,13 @@ private okhttp3.Call matchUserValidateBeforeCall(Integer networkId, String userK * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public File matchUser(Integer networkId, String userKey, Integer partnerId, Integer userId) throws ApiException { + public File matchUser(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull Integer partnerId, @javax.annotation.Nonnull Integer userId) throws ApiException { ApiResponse localVarResp = matchUserWithHttpInfo(networkId, userKey, partnerId, userId); return localVarResp.getData(); } @@ -952,12 +1081,13 @@ public File matchUser(Integer networkId, String userKey, Integer partnerId, Inte * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public ApiResponse matchUserWithHttpInfo(Integer networkId, String userKey, Integer partnerId, Integer userId) throws ApiException { + public ApiResponse matchUserWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull Integer partnerId, @javax.annotation.Nonnull Integer userId) throws ApiException { okhttp3.Call localVarCall = matchUserValidateBeforeCall(networkId, userKey, partnerId, userId, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -974,12 +1104,13 @@ public ApiResponse matchUserWithHttpInfo(Integer networkId, String userKey * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Success -
*/ - public okhttp3.Call matchUserAsync(Integer networkId, String userKey, Integer partnerId, Integer userId, final ApiCallback _callback) throws ApiException { + public okhttp3.Call matchUserAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, @javax.annotation.Nonnull Integer partnerId, @javax.annotation.Nonnull Integer userId, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = matchUserValidateBeforeCall(networkId, userKey, partnerId, userId, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -994,27 +1125,42 @@ public okhttp3.Call matchUserAsync(Integer networkId, String userKey, Integer pa * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Sucess -
*/ - public okhttp3.Call optOutCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call optOutCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/optout/i.gif" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "image/gif" }; @@ -1024,31 +1170,29 @@ public okhttp3.Call optOutCall(Integer networkId, String userKey, final ApiCallb } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call optOutValidateBeforeCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call optOutValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling optOut(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling optOut(Async)"); } - - okhttp3.Call localVarCall = optOutCall(networkId, userKey, _callback); - return localVarCall; + return optOutCall(networkId, userKey, _callback); } @@ -1060,12 +1204,13 @@ private okhttp3.Call optOutValidateBeforeCall(Integer networkId, String userKey, * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Sucess -
*/ - public File optOut(Integer networkId, String userKey) throws ApiException { + public File optOut(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { ApiResponse localVarResp = optOutWithHttpInfo(networkId, userKey); return localVarResp.getData(); } @@ -1078,12 +1223,13 @@ public File optOut(Integer networkId, String userKey) throws ApiException { * @return ApiResponse<File> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Sucess -
*/ - public ApiResponse optOutWithHttpInfo(Integer networkId, String userKey) throws ApiException { + public ApiResponse optOutWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { okhttp3.Call localVarCall = optOutValidateBeforeCall(networkId, userKey, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -1098,12 +1244,13 @@ public ApiResponse optOutWithHttpInfo(Integer networkId, String userKey) t * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 Sucess -
*/ - public okhttp3.Call optOutAsync(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call optOutAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = optOutValidateBeforeCall(networkId, userKey, _callback); Type localVarReturnType = new TypeToken(){}.getType(); @@ -1118,27 +1265,42 @@ public okhttp3.Call optOutAsync(Integer networkId, String userKey, final ApiCall * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The UserDB record -
*/ - public okhttp3.Call readCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call readCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + Object localVarPostBody = null; // create path and map variables String localVarPath = "/udb/{networkId}/read" - .replaceAll("\\{" + "networkId" + "\\}", localVarApiClient.escapeString(networkId.toString())); + .replace("{" + "networkId" + "}", localVarApiClient.escapeString(networkId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + if (userKey != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userKey", userKey)); } - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; @@ -1148,31 +1310,29 @@ public okhttp3.Call readCall(Integer networkId, String userKey, final ApiCallbac } final String[] localVarContentTypes = { - }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } String[] localVarAuthNames = new String[] { }; - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") - private okhttp3.Call readValidateBeforeCall(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { - + private okhttp3.Call readValidateBeforeCall(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { // verify the required parameter 'networkId' is set if (networkId == null) { throw new ApiException("Missing the required parameter 'networkId' when calling read(Async)"); } - + // verify the required parameter 'userKey' is set if (userKey == null) { throw new ApiException("Missing the required parameter 'userKey' when calling read(Async)"); } - - okhttp3.Call localVarCall = readCall(networkId, userKey, _callback); - return localVarCall; + return readCall(networkId, userKey, _callback); } @@ -1184,12 +1344,13 @@ private okhttp3.Call readValidateBeforeCall(Integer networkId, String userKey, f * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The UserDB record -
*/ - public Object read(Integer networkId, String userKey) throws ApiException { + public Object read(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { ApiResponse localVarResp = readWithHttpInfo(networkId, userKey); return localVarResp.getData(); } @@ -1202,12 +1363,13 @@ public Object read(Integer networkId, String userKey) throws ApiException { * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The UserDB record -
*/ - public ApiResponse readWithHttpInfo(Integer networkId, String userKey) throws ApiException { + public ApiResponse readWithHttpInfo(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey) throws ApiException { okhttp3.Call localVarCall = readValidateBeforeCall(networkId, userKey, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); @@ -1222,12 +1384,13 @@ public ApiResponse readWithHttpInfo(Integer networkId, String userKey) t * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details - +
+
Response Details
Status Code Description Response Headers
200 The UserDB record -
*/ - public okhttp3.Call readAsync(Integer networkId, String userKey, final ApiCallback _callback) throws ApiException { + public okhttp3.Call readAsync(@javax.annotation.Nonnull Integer networkId, @javax.annotation.Nonnull String userKey, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = readValidateBeforeCall(networkId, userKey, _callback); Type localVarReturnType = new TypeToken(){}.getType(); diff --git a/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java b/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java index 4aeb5de..82ee832 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/ApiKeyAuth.java @@ -13,12 +13,14 @@ package com.adzerk.sdk.generated.auth; +import com.adzerk.sdk.generated.ApiException; import com.adzerk.sdk.generated.Pair; +import java.net.URI; import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; @@ -56,7 +58,8 @@ public void setApiKeyPrefix(String apiKeyPrefix) { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { if (apiKey == null) { return; } diff --git a/src/main/java/com/adzerk/sdk/generated/auth/Authentication.java b/src/main/java/com/adzerk/sdk/generated/auth/Authentication.java index 7ab1162..362d081 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/Authentication.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/Authentication.java @@ -14,10 +14,13 @@ package com.adzerk.sdk.generated.auth; import com.adzerk.sdk.generated.Pair; +import com.adzerk.sdk.generated.ApiException; +import java.net.URI; import java.util.Map; import java.util.List; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public interface Authentication { /** * Apply authentication settings to header and query params. @@ -25,6 +28,10 @@ public interface Authentication { * @param queryParams List of query parameters * @param headerParams Map of header parameters * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters */ - void applyToParams(List queryParams, Map headerParams, Map cookieParams); + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; } diff --git a/src/main/java/com/adzerk/sdk/generated/auth/HttpBasicAuth.java b/src/main/java/com/adzerk/sdk/generated/auth/HttpBasicAuth.java index 6dc6582..421f060 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/HttpBasicAuth.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/HttpBasicAuth.java @@ -14,14 +14,14 @@ package com.adzerk.sdk.generated.auth; import com.adzerk.sdk.generated.Pair; +import com.adzerk.sdk.generated.ApiException; import okhttp3.Credentials; +import java.net.URI; import java.util.Map; import java.util.List; -import java.io.UnsupportedEncodingException; - public class HttpBasicAuth implements Authentication { private String username; private String password; @@ -43,7 +43,8 @@ public void setPassword(String password) { } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { if (username == null && password == null) { return; } diff --git a/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java b/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java index a6f0405..75f2fc3 100644 --- a/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java +++ b/src/main/java/com/adzerk/sdk/generated/auth/HttpBearerAuth.java @@ -13,15 +13,19 @@ package com.adzerk.sdk.generated.auth; +import com.adzerk.sdk.generated.ApiException; import com.adzerk.sdk.generated.Pair; -import java.util.Map; +import java.net.URI; import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class HttpBearerAuth implements Authentication { private final String scheme; - private String bearerToken; + private Supplier tokenSupplier; public HttpBearerAuth(String scheme) { this.scheme = scheme; @@ -33,7 +37,7 @@ public HttpBearerAuth(String scheme) { * @return The bearer token */ public String getBearerToken() { - return bearerToken; + return tokenSupplier.get(); } /** @@ -42,12 +46,23 @@ public String getBearerToken() { * @param bearerToken The bearer token to send in the Authorization header */ public void setBearerToken(String bearerToken) { - this.bearerToken = bearerToken; + this.tokenSupplier = () -> bearerToken; + } + + /** + * Sets the supplier of tokens, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param tokenSupplier The supplier of bearer tokens to send in the Authorization header + */ + public void setBearerToken(Supplier tokenSupplier) { + this.tokenSupplier = tokenSupplier; } @Override - public void applyToParams(List queryParams, Map headerParams, Map cookieParams) { - if(bearerToken == null) { + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + String bearerToken = Optional.ofNullable(tokenSupplier).map(Supplier::get).orElse(null); + if (bearerToken == null) { return; } diff --git a/src/main/java/com/adzerk/sdk/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/adzerk/sdk/generated/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000..50cb3a9 --- /dev/null +++ b/src/main/java/com/adzerk/sdk/generated/model/AbstractOpenApiSchema.java @@ -0,0 +1,146 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adzerk.sdk.generated.model; + +import com.adzerk.sdk.generated.ApiException; +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + //@JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java b/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java index 036a863..b718c8f 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java +++ b/src/main/java/com/adzerk/sdk/generated/model/ConsentRequest.java @@ -14,81 +14,99 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * ConsentRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class ConsentRequest implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_USER_KEY = "userKey"; @SerializedName(SERIALIZED_NAME_USER_KEY) + @javax.annotation.Nullable private String userKey; public static final String SERIALIZED_NAME_CONSENT = "consent"; @SerializedName(SERIALIZED_NAME_CONSENT) + @javax.annotation.Nullable private Object consent; + public ConsentRequest() { + } - public ConsentRequest userKey(String userKey) { - + public ConsentRequest userKey(@javax.annotation.Nullable String userKey) { this.userKey = userKey; return this; } - /** + /** * Get userKey * @return userKey - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getUserKey() { return userKey; } - - public void setUserKey(String userKey) { + public void setUserKey(@javax.annotation.Nullable String userKey) { this.userKey = userKey; } - public ConsentRequest consent(Object consent) { - + public ConsentRequest consent(@javax.annotation.Nullable Object consent) { this.consent = consent; return this; } - /** + /** * Get consent * @return consent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Object getConsent() { return consent; } - - public void setConsent(Object consent) { + public void setConsent(@javax.annotation.Nullable Object consent) { this.consent = consent; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -105,7 +123,6 @@ public int hashCode() { return Objects.hash(userKey, consent); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,12 +137,98 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("userKey", "consent")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConsentRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConsentRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConsentRequest is not found in the empty JSON string", ConsentRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ConsentRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConsentRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("userKey") != null && !jsonObj.get("userKey").isJsonNull()) && !jsonObj.get("userKey").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `userKey` to be a primitive type in the JSON string but got `%s`", jsonObj.get("userKey").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConsentRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConsentRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConsentRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConsentRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ConsentRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConsentRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConsentRequest + * @throws IOException if the JSON string is invalid with respect to ConsentRequest + */ + public static ConsentRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConsentRequest.class); + } + + /** + * Convert an instance of ConsentRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Content.java b/src/main/java/com/adzerk/sdk/generated/model/Content.java index 3f53c40..33a8b23 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Content.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Content.java @@ -14,162 +14,171 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * Content */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Content implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) + @javax.annotation.Nullable private String type; public static final String SERIALIZED_NAME_TEMPLATE = "template"; @SerializedName(SERIALIZED_NAME_TEMPLATE) + @javax.annotation.Nullable private String template; public static final String SERIALIZED_NAME_CUSTOM_TEMPLATE = "customTemplate"; @SerializedName(SERIALIZED_NAME_CUSTOM_TEMPLATE) + @javax.annotation.Nullable private String customTemplate; public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) + @javax.annotation.Nullable private Object data; public static final String SERIALIZED_NAME_BODY = "body"; @SerializedName(SERIALIZED_NAME_BODY) + @javax.annotation.Nullable private String body; + public Content() { + } - public Content type(String type) { - + public Content type(@javax.annotation.Nullable String type) { this.type = type; return this; } - /** + /** * Get type * @return type - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getType() { return type; } - - public void setType(String type) { + public void setType(@javax.annotation.Nullable String type) { this.type = type; } - public Content template(String template) { - + public Content template(@javax.annotation.Nullable String template) { this.template = template; return this; } - /** + /** * Get template * @return template - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getTemplate() { return template; } - - public void setTemplate(String template) { + public void setTemplate(@javax.annotation.Nullable String template) { this.template = template; } - public Content customTemplate(String customTemplate) { - + public Content customTemplate(@javax.annotation.Nullable String customTemplate) { this.customTemplate = customTemplate; return this; } - /** + /** * Get customTemplate * @return customTemplate - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getCustomTemplate() { return customTemplate; } - - public void setCustomTemplate(String customTemplate) { + public void setCustomTemplate(@javax.annotation.Nullable String customTemplate) { this.customTemplate = customTemplate; } - public Content data(Object data) { - + public Content data(@javax.annotation.Nullable Object data) { this.data = data; return this; } - /** + /** * Get data * @return data - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Object getData() { return data; } - - public void setData(Object data) { + public void setData(@javax.annotation.Nullable Object data) { this.data = data; } - public Content body(String body) { - + public Content body(@javax.annotation.Nullable String body) { this.body = body; return this; } - /** + /** * Get body * @return body - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getBody() { return body; } - - public void setBody(String body) { + public void setBody(@javax.annotation.Nullable String body) { this.body = body; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -189,7 +198,6 @@ public int hashCode() { return Objects.hash(type, template, customTemplate, data, body); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -207,12 +215,107 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("type", "template", "customTemplate", "data", "body")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Content + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Content.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Content is not found in the empty JSON string", Content.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Content.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Content` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) && !jsonObj.get("type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("type").toString())); + } + if ((jsonObj.get("template") != null && !jsonObj.get("template").isJsonNull()) && !jsonObj.get("template").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `template` to be a primitive type in the JSON string but got `%s`", jsonObj.get("template").toString())); + } + if ((jsonObj.get("customTemplate") != null && !jsonObj.get("customTemplate").isJsonNull()) && !jsonObj.get("customTemplate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `customTemplate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("customTemplate").toString())); + } + if ((jsonObj.get("body") != null && !jsonObj.get("body").isJsonNull()) && !jsonObj.get("body").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `body` to be a primitive type in the JSON string but got `%s`", jsonObj.get("body").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Content.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Content' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Content.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Content value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Content read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Content given an JSON string + * + * @param jsonString JSON string + * @return An instance of Content + * @throws IOException if the JSON string is invalid with respect to Content + */ + public static Content fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Content.class); + } + + /** + * Convert an instance of Content to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Decision.java b/src/main/java/com/adzerk/sdk/generated/model/Decision.java index 4e07156..55969c0 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Decision.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Decision.java @@ -14,7 +14,6 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.adzerk.sdk.generated.model.Content; import com.adzerk.sdk.generated.model.Event; import com.adzerk.sdk.generated.model.MatchedPoint; @@ -24,372 +23,409 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * Decision */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Decision implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_AD_ID = "adId"; @SerializedName(SERIALIZED_NAME_AD_ID) + @javax.annotation.Nullable private Integer adId; public static final String SERIALIZED_NAME_ADVERTISER_ID = "advertiserId"; @SerializedName(SERIALIZED_NAME_ADVERTISER_ID) + @javax.annotation.Nullable private Integer advertiserId; public static final String SERIALIZED_NAME_CREATIVE_ID = "creativeId"; @SerializedName(SERIALIZED_NAME_CREATIVE_ID) + @javax.annotation.Nullable private Integer creativeId; public static final String SERIALIZED_NAME_FLIGHT_ID = "flightId"; @SerializedName(SERIALIZED_NAME_FLIGHT_ID) + @javax.annotation.Nullable private Integer flightId; public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId"; @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID) + @javax.annotation.Nullable private Integer campaignId; public static final String SERIALIZED_NAME_PRIORITY_ID = "priorityId"; @SerializedName(SERIALIZED_NAME_PRIORITY_ID) + @javax.annotation.Nullable private Integer priorityId; public static final String SERIALIZED_NAME_CLICK_URL = "clickUrl"; @SerializedName(SERIALIZED_NAME_CLICK_URL) + @javax.annotation.Nullable private URI clickUrl; public static final String SERIALIZED_NAME_CONTENTS = "contents"; @SerializedName(SERIALIZED_NAME_CONTENTS) - private List contents = null; + @javax.annotation.Nullable + private List contents = new ArrayList<>(); public static final String SERIALIZED_NAME_IMPRESSION_URL = "impressionUrl"; @SerializedName(SERIALIZED_NAME_IMPRESSION_URL) + @javax.annotation.Nullable private URI impressionUrl; public static final String SERIALIZED_NAME_EVENTS = "events"; @SerializedName(SERIALIZED_NAME_EVENTS) - private List events = null; + @javax.annotation.Nullable + private List events = new ArrayList<>(); public static final String SERIALIZED_NAME_MATCHED_POINTS = "matchedPoints"; @SerializedName(SERIALIZED_NAME_MATCHED_POINTS) - private List matchedPoints = null; + @javax.annotation.Nullable + private List matchedPoints = new ArrayList<>(); public static final String SERIALIZED_NAME_PRICING = "pricing"; @SerializedName(SERIALIZED_NAME_PRICING) + @javax.annotation.Nullable private PricingData pricing; + public static final String SERIALIZED_NAME_HEIGHT = "height"; + @SerializedName(SERIALIZED_NAME_HEIGHT) + @javax.annotation.Nullable + private Integer height; + + public static final String SERIALIZED_NAME_WIDTH = "width"; + @SerializedName(SERIALIZED_NAME_WIDTH) + @javax.annotation.Nullable + private Integer width; - public Decision adId(Integer adId) { - + public Decision() { + } + + public Decision adId(@javax.annotation.Nullable Integer adId) { this.adId = adId; return this; } - /** + /** * Get adId * @return adId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getAdId() { return adId; } - - public void setAdId(Integer adId) { + public void setAdId(@javax.annotation.Nullable Integer adId) { this.adId = adId; } - public Decision advertiserId(Integer advertiserId) { - + public Decision advertiserId(@javax.annotation.Nullable Integer advertiserId) { this.advertiserId = advertiserId; return this; } - /** + /** * Get advertiserId * @return advertiserId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getAdvertiserId() { return advertiserId; } - - public void setAdvertiserId(Integer advertiserId) { + public void setAdvertiserId(@javax.annotation.Nullable Integer advertiserId) { this.advertiserId = advertiserId; } - public Decision creativeId(Integer creativeId) { - + public Decision creativeId(@javax.annotation.Nullable Integer creativeId) { this.creativeId = creativeId; return this; } - /** + /** * Get creativeId * @return creativeId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getCreativeId() { return creativeId; } - - public void setCreativeId(Integer creativeId) { + public void setCreativeId(@javax.annotation.Nullable Integer creativeId) { this.creativeId = creativeId; } - public Decision flightId(Integer flightId) { - + public Decision flightId(@javax.annotation.Nullable Integer flightId) { this.flightId = flightId; return this; } - /** + /** * Get flightId * @return flightId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getFlightId() { return flightId; } - - public void setFlightId(Integer flightId) { + public void setFlightId(@javax.annotation.Nullable Integer flightId) { this.flightId = flightId; } - public Decision campaignId(Integer campaignId) { - + public Decision campaignId(@javax.annotation.Nullable Integer campaignId) { this.campaignId = campaignId; return this; } - /** + /** * Get campaignId * @return campaignId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getCampaignId() { return campaignId; } - - public void setCampaignId(Integer campaignId) { + public void setCampaignId(@javax.annotation.Nullable Integer campaignId) { this.campaignId = campaignId; } - public Decision priorityId(Integer priorityId) { - + public Decision priorityId(@javax.annotation.Nullable Integer priorityId) { this.priorityId = priorityId; return this; } - /** + /** * Get priorityId * @return priorityId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getPriorityId() { return priorityId; } - - public void setPriorityId(Integer priorityId) { + public void setPriorityId(@javax.annotation.Nullable Integer priorityId) { this.priorityId = priorityId; } - public Decision clickUrl(URI clickUrl) { - + public Decision clickUrl(@javax.annotation.Nullable URI clickUrl) { this.clickUrl = clickUrl; return this; } - /** + /** * Get clickUrl * @return clickUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public URI getClickUrl() { return clickUrl; } - - public void setClickUrl(URI clickUrl) { + public void setClickUrl(@javax.annotation.Nullable URI clickUrl) { this.clickUrl = clickUrl; } - public Decision contents(List contents) { - + public Decision contents(@javax.annotation.Nullable List contents) { this.contents = contents; return this; } public Decision addContentsItem(Content contentsItem) { if (this.contents == null) { - this.contents = new ArrayList(); + this.contents = new ArrayList<>(); } this.contents.add(contentsItem); return this; } - /** + /** * Get contents * @return contents - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getContents() { return contents; } - - public void setContents(List contents) { + public void setContents(@javax.annotation.Nullable List contents) { this.contents = contents; } - public Decision impressionUrl(URI impressionUrl) { - + public Decision impressionUrl(@javax.annotation.Nullable URI impressionUrl) { this.impressionUrl = impressionUrl; return this; } - /** + /** * Get impressionUrl * @return impressionUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public URI getImpressionUrl() { return impressionUrl; } - - public void setImpressionUrl(URI impressionUrl) { + public void setImpressionUrl(@javax.annotation.Nullable URI impressionUrl) { this.impressionUrl = impressionUrl; } - public Decision events(List events) { - + public Decision events(@javax.annotation.Nullable List events) { this.events = events; return this; } public Decision addEventsItem(Event eventsItem) { if (this.events == null) { - this.events = new ArrayList(); + this.events = new ArrayList<>(); } this.events.add(eventsItem); return this; } - /** + /** * Get events * @return events - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getEvents() { return events; } - - public void setEvents(List events) { + public void setEvents(@javax.annotation.Nullable List events) { this.events = events; } - public Decision matchedPoints(List matchedPoints) { - + public Decision matchedPoints(@javax.annotation.Nullable List matchedPoints) { this.matchedPoints = matchedPoints; return this; } public Decision addMatchedPointsItem(MatchedPoint matchedPointsItem) { if (this.matchedPoints == null) { - this.matchedPoints = new ArrayList(); + this.matchedPoints = new ArrayList<>(); } this.matchedPoints.add(matchedPointsItem); return this; } - /** + /** * Get matchedPoints * @return matchedPoints - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public List getMatchedPoints() { return matchedPoints; } - - public void setMatchedPoints(List matchedPoints) { + public void setMatchedPoints(@javax.annotation.Nullable List matchedPoints) { this.matchedPoints = matchedPoints; } - public Decision pricing(PricingData pricing) { - + public Decision pricing(@javax.annotation.Nullable PricingData pricing) { this.pricing = pricing; return this; } - /** + /** * Get pricing * @return pricing - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public PricingData getPricing() { return pricing; } - - public void setPricing(PricingData pricing) { + public void setPricing(@javax.annotation.Nullable PricingData pricing) { this.pricing = pricing; } + public Decision height(@javax.annotation.Nullable Integer height) { + this.height = height; + return this; + } + + /** + * Get height + * @return height + */ + @javax.annotation.Nullable + public Integer getHeight() { + return height; + } + + public void setHeight(@javax.annotation.Nullable Integer height) { + this.height = height; + } + + + public Decision width(@javax.annotation.Nullable Integer width) { + this.width = width; + return this; + } + + /** + * Get width + * @return width + */ + @javax.annotation.Nullable + public Integer getWidth() { + return width; + } + + public void setWidth(@javax.annotation.Nullable Integer width) { + this.width = width; + } + + + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -408,15 +444,16 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.impressionUrl, decision.impressionUrl) && Objects.equals(this.events, decision.events) && Objects.equals(this.matchedPoints, decision.matchedPoints) && - Objects.equals(this.pricing, decision.pricing); + Objects.equals(this.pricing, decision.pricing) && + Objects.equals(this.height, decision.height) && + Objects.equals(this.width, decision.width); } @Override public int hashCode() { - return Objects.hash(adId, advertiserId, creativeId, flightId, campaignId, priorityId, clickUrl, contents, impressionUrl, events, matchedPoints, pricing); + return Objects.hash(adId, advertiserId, creativeId, flightId, campaignId, priorityId, clickUrl, contents, impressionUrl, events, matchedPoints, pricing, height, width); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -433,6 +470,8 @@ public String toString() { sb.append(" events: ").append(toIndentedString(events)).append("\n"); sb.append(" matchedPoints: ").append(toIndentedString(matchedPoints)).append("\n"); sb.append(" pricing: ").append(toIndentedString(pricing)).append("\n"); + sb.append(" height: ").append(toIndentedString(height)).append("\n"); + sb.append(" width: ").append(toIndentedString(width)).append("\n"); sb.append("}"); return sb.toString(); } @@ -441,12 +480,147 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("adId", "advertiserId", "creativeId", "flightId", "campaignId", "priorityId", "clickUrl", "contents", "impressionUrl", "events", "matchedPoints", "pricing", "height", "width")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Decision + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Decision.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Decision is not found in the empty JSON string", Decision.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Decision.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Decision` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("clickUrl") != null && !jsonObj.get("clickUrl").isJsonNull()) && !jsonObj.get("clickUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clickUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clickUrl").toString())); + } + if (jsonObj.get("contents") != null && !jsonObj.get("contents").isJsonNull()) { + JsonArray jsonArraycontents = jsonObj.getAsJsonArray("contents"); + if (jsonArraycontents != null) { + // ensure the json data is an array + if (!jsonObj.get("contents").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `contents` to be an array in the JSON string but got `%s`", jsonObj.get("contents").toString())); + } + + // validate the optional field `contents` (array) + for (int i = 0; i < jsonArraycontents.size(); i++) { + Content.validateJsonElement(jsonArraycontents.get(i)); + }; + } + } + if ((jsonObj.get("impressionUrl") != null && !jsonObj.get("impressionUrl").isJsonNull()) && !jsonObj.get("impressionUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `impressionUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("impressionUrl").toString())); + } + if (jsonObj.get("events") != null && !jsonObj.get("events").isJsonNull()) { + JsonArray jsonArrayevents = jsonObj.getAsJsonArray("events"); + if (jsonArrayevents != null) { + // ensure the json data is an array + if (!jsonObj.get("events").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `events` to be an array in the JSON string but got `%s`", jsonObj.get("events").toString())); + } + + // validate the optional field `events` (array) + for (int i = 0; i < jsonArrayevents.size(); i++) { + Event.validateJsonElement(jsonArrayevents.get(i)); + }; + } + } + if (jsonObj.get("matchedPoints") != null && !jsonObj.get("matchedPoints").isJsonNull()) { + JsonArray jsonArraymatchedPoints = jsonObj.getAsJsonArray("matchedPoints"); + if (jsonArraymatchedPoints != null) { + // ensure the json data is an array + if (!jsonObj.get("matchedPoints").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `matchedPoints` to be an array in the JSON string but got `%s`", jsonObj.get("matchedPoints").toString())); + } + + // validate the optional field `matchedPoints` (array) + for (int i = 0; i < jsonArraymatchedPoints.size(); i++) { + MatchedPoint.validateJsonElement(jsonArraymatchedPoints.get(i)); + }; + } + } + // validate the optional field `pricing` + if (jsonObj.get("pricing") != null && !jsonObj.get("pricing").isJsonNull()) { + PricingData.validateJsonElement(jsonObj.get("pricing")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Decision.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Decision' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Decision.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Decision value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Decision read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Decision given an JSON string + * + * @param jsonString JSON string + * @return An instance of Decision + * @throws IOException if the JSON string is invalid with respect to Decision + */ + public static Decision fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Decision.class); + } + + /** + * Convert an instance of Decision to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java b/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java index 8ba439f..93fd5e3 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java +++ b/src/main/java/com/adzerk/sdk/generated/model/DecisionRequest.java @@ -14,7 +14,6 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.adzerk.sdk.generated.model.Placement; import com.adzerk.sdk.generated.model.User; import com.google.gson.TypeAdapter; @@ -22,556 +21,534 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * DecisionRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class DecisionRequest implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_PLACEMENTS = "placements"; @SerializedName(SERIALIZED_NAME_PLACEMENTS) - private List placements = new ArrayList(); + @javax.annotation.Nonnull + private List placements = new ArrayList<>(); public static final String SERIALIZED_NAME_USER = "user"; @SerializedName(SERIALIZED_NAME_USER) + @javax.annotation.Nullable private User user; public static final String SERIALIZED_NAME_KEYWORDS = "keywords"; @SerializedName(SERIALIZED_NAME_KEYWORDS) - private List keywords = null; + @javax.annotation.Nullable + private List keywords; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable private String url; public static final String SERIALIZED_NAME_REFERRER = "referrer"; @SerializedName(SERIALIZED_NAME_REFERRER) + @javax.annotation.Nullable private String referrer; public static final String SERIALIZED_NAME_IP = "ip"; @SerializedName(SERIALIZED_NAME_IP) + @javax.annotation.Nullable private String ip; public static final String SERIALIZED_NAME_BLOCKED_CREATIVES = "blockedCreatives"; @SerializedName(SERIALIZED_NAME_BLOCKED_CREATIVES) - private List blockedCreatives = null; + @javax.annotation.Nullable + private List blockedCreatives; public static final String SERIALIZED_NAME_IS_MOBILE = "isMobile"; + @Deprecated @SerializedName(SERIALIZED_NAME_IS_MOBILE) + @javax.annotation.Nullable private Boolean isMobile; public static final String SERIALIZED_NAME_INCLUDE_PRICING_DATA = "includePricingData"; @SerializedName(SERIALIZED_NAME_INCLUDE_PRICING_DATA) + @javax.annotation.Nullable private Boolean includePricingData; public static final String SERIALIZED_NAME_NOTRACK = "notrack"; @SerializedName(SERIALIZED_NAME_NOTRACK) + @javax.annotation.Nullable private Boolean notrack; public static final String SERIALIZED_NAME_ENABLE_BOT_FILTERING = "enableBotFiltering"; @SerializedName(SERIALIZED_NAME_ENABLE_BOT_FILTERING) + @javax.annotation.Nullable private Boolean enableBotFiltering; public static final String SERIALIZED_NAME_ENABLE_USER_D_B_I_P = "enableUserDBIP"; @SerializedName(SERIALIZED_NAME_ENABLE_USER_D_B_I_P) + @javax.annotation.Nullable private Boolean enableUserDBIP; public static final String SERIALIZED_NAME_CONSENT = "consent"; @SerializedName(SERIALIZED_NAME_CONSENT) + @javax.annotation.Nullable private Object consent; public static final String SERIALIZED_NAME_DEVICE_I_D = "deviceID"; @SerializedName(SERIALIZED_NAME_DEVICE_I_D) + @javax.annotation.Nullable private String deviceID; public static final String SERIALIZED_NAME_PARALLEL = "parallel"; @SerializedName(SERIALIZED_NAME_PARALLEL) + @javax.annotation.Nullable private Boolean parallel; public static final String SERIALIZED_NAME_INTENDED_LATITUDE = "intendedLatitude"; @SerializedName(SERIALIZED_NAME_INTENDED_LATITUDE) + @javax.annotation.Nullable private Float intendedLatitude; public static final String SERIALIZED_NAME_INTENDED_LONGITUDE = "intendedLongitude"; @SerializedName(SERIALIZED_NAME_INTENDED_LONGITUDE) + @javax.annotation.Nullable private Float intendedLongitude; public static final String SERIALIZED_NAME_RADIUS = "radius"; @SerializedName(SERIALIZED_NAME_RADIUS) + @javax.annotation.Nullable private Float radius; public static final String SERIALIZED_NAME_INCLUDE_MATCHED_POINTS = "includeMatchedPoints"; @SerializedName(SERIALIZED_NAME_INCLUDE_MATCHED_POINTS) + @javax.annotation.Nullable private Boolean includeMatchedPoints; + public DecisionRequest() { + } - public DecisionRequest placements(List placements) { - + public DecisionRequest placements(@javax.annotation.Nonnull List placements) { this.placements = placements; return this; } public DecisionRequest addPlacementsItem(Placement placementsItem) { + if (this.placements == null) { + this.placements = new ArrayList<>(); + } this.placements.add(placementsItem); return this; } - /** + /** * One or more Placement objects * @return placements - **/ - @ApiModelProperty(required = true, value = "One or more Placement objects") - + */ + @javax.annotation.Nonnull public List getPlacements() { return placements; } - - public void setPlacements(List placements) { + public void setPlacements(@javax.annotation.Nonnull List placements) { this.placements = placements; } - public DecisionRequest user(User user) { - + public DecisionRequest user(@javax.annotation.Nullable User user) { this.user = user; return this; } - /** + /** * Get user * @return user - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public User getUser() { return user; } - - public void setUser(User user) { + public void setUser(@javax.annotation.Nullable User user) { this.user = user; } - public DecisionRequest keywords(List keywords) { - + public DecisionRequest keywords(@javax.annotation.Nullable List keywords) { this.keywords = keywords; return this; } public DecisionRequest addKeywordsItem(String keywordsItem) { if (this.keywords == null) { - this.keywords = new ArrayList(); + this.keywords = new ArrayList<>(); } this.keywords.add(keywordsItem); return this; } - /** + /** * Keywords for keyword Targeting. Such as `\"keywords\": [\"foo\", \"bar\", \"baz\"]`. * @return keywords - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Keywords for keyword Targeting. Such as `\"keywords\": [\"foo\", \"bar\", \"baz\"]`.") - public List getKeywords() { return keywords; } - - public void setKeywords(List keywords) { + public void setKeywords(@javax.annotation.Nullable List keywords) { this.keywords = keywords; } - public DecisionRequest url(String url) { - + public DecisionRequest url(@javax.annotation.Nullable String url) { this.url = url; return this; } - /** + /** * The current page URL * @return url - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The current page URL") - public String getUrl() { return url; } - - public void setUrl(String url) { + public void setUrl(@javax.annotation.Nullable String url) { this.url = url; } - public DecisionRequest referrer(String referrer) { - + public DecisionRequest referrer(@javax.annotation.Nullable String referrer) { this.referrer = referrer; return this; } - /** + /** * The referrer URL * @return referrer - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The referrer URL") - public String getReferrer() { return referrer; } - - public void setReferrer(String referrer) { + public void setReferrer(@javax.annotation.Nullable String referrer) { this.referrer = referrer; } - public DecisionRequest ip(String ip) { - + public DecisionRequest ip(@javax.annotation.Nullable String ip) { this.ip = ip; return this; } - /** + /** * The IP address. Required for [Geo-Targeting](https://dev.adzerk.com/docs/geo-location) * @return ip - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The IP address. Required for [Geo-Targeting](https://dev.adzerk.com/docs/geo-location)") - public String getIp() { return ip; } - - public void setIp(String ip) { + public void setIp(@javax.annotation.Nullable String ip) { this.ip = ip; } - public DecisionRequest blockedCreatives(List blockedCreatives) { - + public DecisionRequest blockedCreatives(@javax.annotation.Nullable List blockedCreatives) { this.blockedCreatives = blockedCreatives; return this; } public DecisionRequest addBlockedCreativesItem(Integer blockedCreativesItem) { if (this.blockedCreatives == null) { - this.blockedCreatives = new ArrayList(); + this.blockedCreatives = new ArrayList<>(); } this.blockedCreatives.add(blockedCreativesItem); return this; } - /** + /** * Numeric creative ids to disregard for ad selection * @return blockedCreatives - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Numeric creative ids to disregard for ad selection") - public List getBlockedCreatives() { return blockedCreatives; } - - public void setBlockedCreatives(List blockedCreatives) { + public void setBlockedCreatives(@javax.annotation.Nullable List blockedCreatives) { this.blockedCreatives = blockedCreatives; } - public DecisionRequest isMobile(Boolean isMobile) { - + @Deprecated + public DecisionRequest isMobile(@javax.annotation.Nullable Boolean isMobile) { this.isMobile = isMobile; return this; } - /** + /** * If true, only ads containing a single image will be returned * @return isMobile - **/ + * @deprecated + */ + @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "If true, only ads containing a single image will be returned") - public Boolean getIsMobile() { return isMobile; } - - public void setIsMobile(Boolean isMobile) { + @Deprecated + public void setIsMobile(@javax.annotation.Nullable Boolean isMobile) { this.isMobile = isMobile; } - public DecisionRequest includePricingData(Boolean includePricingData) { - + public DecisionRequest includePricingData(@javax.annotation.Nullable Boolean includePricingData) { this.includePricingData = includePricingData; return this; } - /** + /** * If true, return pricing data for the decision in the response * @return includePricingData - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If true, return pricing data for the decision in the response") - public Boolean getIncludePricingData() { return includePricingData; } - - public void setIncludePricingData(Boolean includePricingData) { + public void setIncludePricingData(@javax.annotation.Nullable Boolean includePricingData) { this.includePricingData = includePricingData; } - public DecisionRequest notrack(Boolean notrack) { - + public DecisionRequest notrack(@javax.annotation.Nullable Boolean notrack) { this.notrack = notrack; return this; } - /** + /** * If true, only return ads that are set to honor Do Not Track * @return notrack - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If true, only return ads that are set to honor Do Not Track") - public Boolean getNotrack() { return notrack; } - - public void setNotrack(Boolean notrack) { + public void setNotrack(@javax.annotation.Nullable Boolean notrack) { this.notrack = notrack; } - public DecisionRequest enableBotFiltering(Boolean enableBotFiltering) { - + public DecisionRequest enableBotFiltering(@javax.annotation.Nullable Boolean enableBotFiltering) { this.enableBotFiltering = enableBotFiltering; return this; } - /** + /** * If making a client-side request, set to true. Defaults to false to ensure a server isn't seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info * @return enableBotFiltering - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If making a client-side request, set to true. Defaults to false to ensure a server isn't seen as a bot. See [here](https://dev.adzerk.com/docs/tracking-overview#section-bot-filtering) for more info") - public Boolean getEnableBotFiltering() { return enableBotFiltering; } - - public void setEnableBotFiltering(Boolean enableBotFiltering) { + public void setEnableBotFiltering(@javax.annotation.Nullable Boolean enableBotFiltering) { this.enableBotFiltering = enableBotFiltering; } - public DecisionRequest enableUserDBIP(Boolean enableUserDBIP) { - + public DecisionRequest enableUserDBIP(@javax.annotation.Nullable Boolean enableUserDBIP) { this.enableUserDBIP = enableUserDBIP; return this; } - /** + /** * If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB * @return enableUserDBIP - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "If true, override the IP address of the request with the IP address supplied on the UserKey. If no IP address is found on the UserKey, this will fall back to the IP address on the request. Requires UserDB") - public Boolean getEnableUserDBIP() { return enableUserDBIP; } - - public void setEnableUserDBIP(Boolean enableUserDBIP) { + public void setEnableUserDBIP(@javax.annotation.Nullable Boolean enableUserDBIP) { this.enableUserDBIP = enableUserDBIP; } - public DecisionRequest consent(Object consent) { - + public DecisionRequest consent(@javax.annotation.Nullable Object consent) { this.consent = consent; return this; } - /** + /** * Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation. * @return consent - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Object that sets the data consent preferences. Other consent settings are available in the GDPR settings documentation.") - public Object getConsent() { return consent; } - - public void setConsent(Object consent) { + public void setConsent(@javax.annotation.Nullable Object consent) { this.consent = consent; } - public DecisionRequest deviceID(String deviceID) { - + public DecisionRequest deviceID(@javax.annotation.Nullable String deviceID) { this.deviceID = deviceID; return this; } - /** + /** * RTB requests only - sets an Identifier for Advertisers (IFA or IDFA) * @return deviceID - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "RTB requests only - sets an Identifier for Advertisers (IFA or IDFA)") - public String getDeviceID() { return deviceID; } - - public void setDeviceID(String deviceID) { + public void setDeviceID(@javax.annotation.Nullable String deviceID) { this.deviceID = deviceID; } - public DecisionRequest parallel(Boolean parallel) { - + public DecisionRequest parallel(@javax.annotation.Nullable Boolean parallel) { this.parallel = parallel; return this; } - /** + /** * Get parallel * @return parallel - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getParallel() { return parallel; } - - public void setParallel(Boolean parallel) { + public void setParallel(@javax.annotation.Nullable Boolean parallel) { this.parallel = parallel; } - public DecisionRequest intendedLatitude(Float intendedLatitude) { - + public DecisionRequest intendedLatitude(@javax.annotation.Nullable Float intendedLatitude) { this.intendedLatitude = intendedLatitude; return this; } - /** + /** * Get intendedLatitude * @return intendedLatitude - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getIntendedLatitude() { return intendedLatitude; } - - public void setIntendedLatitude(Float intendedLatitude) { + public void setIntendedLatitude(@javax.annotation.Nullable Float intendedLatitude) { this.intendedLatitude = intendedLatitude; } - public DecisionRequest intendedLongitude(Float intendedLongitude) { - + public DecisionRequest intendedLongitude(@javax.annotation.Nullable Float intendedLongitude) { this.intendedLongitude = intendedLongitude; return this; } - /** + /** * Get intendedLongitude * @return intendedLongitude - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getIntendedLongitude() { return intendedLongitude; } - - public void setIntendedLongitude(Float intendedLongitude) { + public void setIntendedLongitude(@javax.annotation.Nullable Float intendedLongitude) { this.intendedLongitude = intendedLongitude; } - public DecisionRequest radius(Float radius) { - + public DecisionRequest radius(@javax.annotation.Nullable Float radius) { this.radius = radius; return this; } - /** + /** * Get radius * @return radius - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getRadius() { return radius; } - - public void setRadius(Float radius) { + public void setRadius(@javax.annotation.Nullable Float radius) { this.radius = radius; } - public DecisionRequest includeMatchedPoints(Boolean includeMatchedPoints) { - + public DecisionRequest includeMatchedPoints(@javax.annotation.Nullable Boolean includeMatchedPoints) { this.includeMatchedPoints = includeMatchedPoints; return this; } - /** + /** * Get includeMatchedPoints * @return includeMatchedPoints - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getIncludeMatchedPoints() { return includeMatchedPoints; } - - public void setIncludeMatchedPoints(Boolean includeMatchedPoints) { + public void setIncludeMatchedPoints(@javax.annotation.Nullable Boolean includeMatchedPoints) { this.includeMatchedPoints = includeMatchedPoints; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -600,11 +577,21 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.includeMatchedPoints, decisionRequest.includeMatchedPoints); } + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); + } + @Override public int hashCode() { return Objects.hash(placements, user, keywords, url, referrer, ip, blockedCreatives, isMobile, includePricingData, notrack, enableBotFiltering, enableUserDBIP, consent, deviceID, parallel, intendedLatitude, intendedLongitude, radius, includeMatchedPoints); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } @Override public String toString() { @@ -637,12 +624,136 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("placements", "user", "keywords", "url", "referrer", "ip", "blockedCreatives", "isMobile", "includePricingData", "notrack", "enableBotFiltering", "enableUserDBIP", "consent", "deviceID", "parallel", "intendedLatitude", "intendedLongitude", "radius", "includeMatchedPoints")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(Arrays.asList("placements")); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DecisionRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DecisionRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DecisionRequest is not found in the empty JSON string", DecisionRequest.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DecisionRequest.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DecisionRequest` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DecisionRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("placements").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `placements` to be an array in the JSON string but got `%s`", jsonObj.get("placements").toString())); + } + + JsonArray jsonArrayplacements = jsonObj.getAsJsonArray("placements"); + // validate the required field `placements` (array) + for (int i = 0; i < jsonArrayplacements.size(); i++) { + Placement.validateJsonElement(jsonArrayplacements.get(i)); + }; + // validate the optional field `user` + if (jsonObj.get("user") != null && !jsonObj.get("user").isJsonNull()) { + User.validateJsonElement(jsonObj.get("user")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("keywords") != null && !jsonObj.get("keywords").isJsonNull() && !jsonObj.get("keywords").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `keywords` to be an array in the JSON string but got `%s`", jsonObj.get("keywords").toString())); + } + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + if ((jsonObj.get("referrer") != null && !jsonObj.get("referrer").isJsonNull()) && !jsonObj.get("referrer").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referrer` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referrer").toString())); + } + if ((jsonObj.get("ip") != null && !jsonObj.get("ip").isJsonNull()) && !jsonObj.get("ip").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ip` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ip").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("blockedCreatives") != null && !jsonObj.get("blockedCreatives").isJsonNull() && !jsonObj.get("blockedCreatives").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `blockedCreatives` to be an array in the JSON string but got `%s`", jsonObj.get("blockedCreatives").toString())); + } + if ((jsonObj.get("deviceID") != null && !jsonObj.get("deviceID").isJsonNull()) && !jsonObj.get("deviceID").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `deviceID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("deviceID").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DecisionRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DecisionRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DecisionRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DecisionRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DecisionRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DecisionRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of DecisionRequest + * @throws IOException if the JSON string is invalid with respect to DecisionRequest + */ + public static DecisionRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DecisionRequest.class); + } + + /** + * Convert an instance of DecisionRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java index 1075c13..49176fa 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java +++ b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponse.java @@ -14,109 +14,159 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; +import com.adzerk.sdk.generated.model.DecisionResponseDecisionsValue; import com.adzerk.sdk.generated.model.User; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * DecisionResponse */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class DecisionResponse implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_USER = "user"; @SerializedName(SERIALIZED_NAME_USER) + @javax.annotation.Nullable private User user; public static final String SERIALIZED_NAME_DECISIONS = "decisions"; @SerializedName(SERIALIZED_NAME_DECISIONS) - private Object decisions; + @javax.annotation.Nullable + private Map decisions = new HashMap<>(); public static final String SERIALIZED_NAME_EXPLAIN = "explain"; @SerializedName(SERIALIZED_NAME_EXPLAIN) + @javax.annotation.Nullable private Object explain; + public static final String SERIALIZED_NAME_CANDIDATE_RETRIEVAL = "candidateRetrieval"; + @SerializedName(SERIALIZED_NAME_CANDIDATE_RETRIEVAL) + @javax.annotation.Nullable + private Object candidateRetrieval; + + public DecisionResponse() { + } - public DecisionResponse user(User user) { - + public DecisionResponse user(@javax.annotation.Nullable User user) { this.user = user; return this; } - /** + /** * Get user * @return user - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public User getUser() { return user; } - - public void setUser(User user) { + public void setUser(@javax.annotation.Nullable User user) { this.user = user; } - public DecisionResponse decisions(Object decisions) { - + public DecisionResponse decisions(@javax.annotation.Nullable Map decisions) { this.decisions = decisions; return this; } - /** - * Get decisions + public DecisionResponse putDecisionsItem(String key, DecisionResponseDecisionsValue decisionsItem) { + if (this.decisions == null) { + this.decisions = new HashMap<>(); + } + this.decisions.put(key, decisionsItem); + return this; + } + + /** + * Single decision format with dynamic string key * @return decisions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public Object getDecisions() { + public Map getDecisions() { return decisions; } - - public void setDecisions(Object decisions) { + public void setDecisions(@javax.annotation.Nullable Map decisions) { this.decisions = decisions; } - public DecisionResponse explain(Object explain) { - + public DecisionResponse explain(@javax.annotation.Nullable Object explain) { this.explain = explain; return this; } - /** + /** * Get explain * @return explain - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Object getExplain() { return explain; } - - public void setExplain(Object explain) { + public void setExplain(@javax.annotation.Nullable Object explain) { this.explain = explain; } + public DecisionResponse candidateRetrieval(@javax.annotation.Nullable Object candidateRetrieval) { + this.candidateRetrieval = candidateRetrieval; + return this; + } + + /** + * Get candidateRetrieval + * @return candidateRetrieval + */ + @javax.annotation.Nullable + public Object getCandidateRetrieval() { + return candidateRetrieval; + } + + public void setCandidateRetrieval(@javax.annotation.Nullable Object candidateRetrieval) { + this.candidateRetrieval = candidateRetrieval; + } + + + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -126,15 +176,15 @@ public boolean equals(java.lang.Object o) { DecisionResponse decisionResponse = (DecisionResponse) o; return Objects.equals(this.user, decisionResponse.user) && Objects.equals(this.decisions, decisionResponse.decisions) && - Objects.equals(this.explain, decisionResponse.explain); + Objects.equals(this.explain, decisionResponse.explain) && + Objects.equals(this.candidateRetrieval, decisionResponse.candidateRetrieval); } @Override public int hashCode() { - return Objects.hash(user, decisions, explain); + return Objects.hash(user, decisions, explain, candidateRetrieval); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -142,6 +192,7 @@ public String toString() { sb.append(" user: ").append(toIndentedString(user)).append("\n"); sb.append(" decisions: ").append(toIndentedString(decisions)).append("\n"); sb.append(" explain: ").append(toIndentedString(explain)).append("\n"); + sb.append(" candidateRetrieval: ").append(toIndentedString(candidateRetrieval)).append("\n"); sb.append("}"); return sb.toString(); } @@ -150,12 +201,99 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("user", "decisions", "explain", "candidateRetrieval")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DecisionResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DecisionResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DecisionResponse is not found in the empty JSON string", DecisionResponse.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DecisionResponse.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DecisionResponse` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `user` + if (jsonObj.get("user") != null && !jsonObj.get("user").isJsonNull()) { + User.validateJsonElement(jsonObj.get("user")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DecisionResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DecisionResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DecisionResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DecisionResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DecisionResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of DecisionResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of DecisionResponse + * @throws IOException if the JSON string is invalid with respect to DecisionResponse + */ + public static DecisionResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DecisionResponse.class); + } + + /** + * Convert an instance of DecisionResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/DecisionResponseDecisionsValue.java b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponseDecisionsValue.java new file mode 100644 index 0000000..47f6207 --- /dev/null +++ b/src/main/java/com/adzerk/sdk/generated/model/DecisionResponseDecisionsValue.java @@ -0,0 +1,297 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adzerk.sdk.generated.model; + +import java.util.Objects; +import com.adzerk.sdk.generated.model.Content; +import com.adzerk.sdk.generated.model.Decision; +import com.adzerk.sdk.generated.model.Event; +import com.adzerk.sdk.generated.model.MatchedPoint; +import com.adzerk.sdk.generated.model.PricingData; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.io.Serializable; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; + +import com.adzerk.sdk.generated.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") +public class DecisionResponseDecisionsValue extends AbstractOpenApiSchema implements Serializable { + private static final Logger log = Logger.getLogger(DecisionResponseDecisionsValue.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DecisionResponseDecisionsValue.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DecisionResponseDecisionsValue' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterDecision = gson.getDelegateAdapter(this, TypeToken.get(Decision.class)); + + final Type typeInstanceListDecision = new TypeToken>(){}.getType(); + final TypeAdapter> adapterListDecision = (TypeAdapter>) gson.getDelegateAdapter(this, TypeToken.get(typeInstanceListDecision)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DecisionResponseDecisionsValue value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `Decision` + if (value.getActualInstance() instanceof Decision) { + JsonElement element = adapterDecision.toJsonTree((Decision)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `List` + if (value.getActualInstance() instanceof List) { + List list = (List) value.getActualInstance(); + if (list.get(0) instanceof Decision) { + JsonArray array = adapterListDecision.toJsonTree((List)value.getActualInstance()).getAsJsonArray(); + elementAdapter.write(out, array); + return; + } + } + throw new IOException("Failed to serialize as the type doesn't match anyOf schemas: Decision, List"); + } + + @Override + public DecisionResponseDecisionsValue read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize Decision + try { + // validate the JSON object to see if any exception is thrown + Decision.validateJsonElement(jsonElement); + actualAdapter = adapterDecision; + DecisionResponseDecisionsValue ret = new DecisionResponseDecisionsValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for Decision failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'Decision'", e); + } + // deserialize List + try { + // validate the JSON object to see if any exception is thrown + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + Decision.validateJsonElement(element); + } + actualAdapter = adapterListDecision; + DecisionResponseDecisionsValue ret = new DecisionResponseDecisionsValue(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'List'", e); + } + + throw new IOException(String.format("Failed deserialization for DecisionResponseDecisionsValue: no class matches result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } + } + + // store a list of schema names defined in anyOf + public static final Map> schemas = new HashMap>(); + + public DecisionResponseDecisionsValue() { + super("anyOf", Boolean.FALSE); + } + + public DecisionResponseDecisionsValue(Object o) { + super("anyOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("Decision", Decision.class); + schemas.put("List", List.class); + } + + @Override + public Map> getSchemas() { + return DecisionResponseDecisionsValue.schemas; + } + + /** + * Set the instance that matches the anyOf child schema, check + * the instance parameter is valid against the anyOf child schemas: + * Decision, List + * + * It could be an instance of the 'anyOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof Decision) { + super.setActualInstance(instance); + return; + } + + if (instance instanceof List) { + List list = (List) instance; + if (list.get(0) instanceof Decision) { + super.setActualInstance(instance); + return; + } + } + + throw new RuntimeException("Invalid instance type. Must be Decision, List"); + } + + /** + * Get the actual instance, which can be the following: + * Decision, List + * + * @return The actual instance (Decision, List) + */ + @SuppressWarnings("unchecked") + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `Decision`. If the actual instance is not `Decision`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `Decision` + * @throws ClassCastException if the instance is not `Decision` + */ + public Decision getDecision() throws ClassCastException { + return (Decision)super.getActualInstance(); + } + + /** + * Get the actual instance of `List`. If the actual instance is not `List`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `List` + * @throws ClassCastException if the instance is not `List` + */ + public List getListDecision() throws ClassCastException { + return (List)super.getActualInstance(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DecisionResponseDecisionsValue + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + // validate anyOf schemas one by one + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with Decision + try { + Decision.validateJsonElement(jsonElement); + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for Decision failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with List + try { + if (!jsonElement.isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected json element to be a array type in the JSON string but got `%s`", jsonElement.toString())); + } + JsonArray array = jsonElement.getAsJsonArray(); + // validate array items + for(JsonElement element : array) { + Decision.validateJsonElement(element); + } + return; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for List failed with `%s`.", e.getMessage())); + // continue to the next one + } + throw new IOException(String.format("The JSON string is invalid for DecisionResponseDecisionsValue with anyOf schemas: Decision, List. no class match the result, expected at least 1. Detailed failure message for anyOf schemas: %s. JSON: %s", errorMessages, jsonElement.toString())); + } + + /** + * Create an instance of DecisionResponseDecisionsValue given an JSON string + * + * @param jsonString JSON string + * @return An instance of DecisionResponseDecisionsValue + * @throws IOException if the JSON string is invalid with respect to DecisionResponseDecisionsValue + */ + public static DecisionResponseDecisionsValue fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DecisionResponseDecisionsValue.class); + } + + /** + * Convert an instance of DecisionResponseDecisionsValue to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/adzerk/sdk/generated/model/Event.java b/src/main/java/com/adzerk/sdk/generated/model/Event.java index 128e3ed..2280ac6 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Event.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Event.java @@ -14,82 +14,100 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.net.URI; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * Event */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Event implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) + @javax.annotation.Nullable private Integer id; public static final String SERIALIZED_NAME_URL = "url"; @SerializedName(SERIALIZED_NAME_URL) + @javax.annotation.Nullable private URI url; + public Event() { + } - public Event id(Integer id) { - + public Event id(@javax.annotation.Nullable Integer id) { this.id = id; return this; } - /** + /** * Get id * @return id - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getId() { return id; } - - public void setId(Integer id) { + public void setId(@javax.annotation.Nullable Integer id) { this.id = id; } - public Event url(URI url) { - + public Event url(@javax.annotation.Nullable URI url) { this.url = url; return this; } - /** + /** * Get url * @return url - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public URI getUrl() { return url; } - - public void setUrl(URI url) { + public void setUrl(@javax.annotation.Nullable URI url) { this.url = url; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -106,7 +124,6 @@ public int hashCode() { return Objects.hash(id, url); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -121,12 +138,98 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("id", "url")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Event + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Event.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Event is not found in the empty JSON string", Event.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Event.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Event` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("url") != null && !jsonObj.get("url").isJsonNull()) && !jsonObj.get("url").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `url` to be a primitive type in the JSON string but got `%s`", jsonObj.get("url").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Event.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Event' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Event.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Event value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Event read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Event given an JSON string + * + * @param jsonString JSON string + * @return An instance of Event + * @throws IOException if the JSON string is invalid with respect to Event + */ + public static Event fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Event.class); + } + + /** + * Convert an instance of Event to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java b/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java index 4df88ff..28ed24b 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java +++ b/src/main/java/com/adzerk/sdk/generated/model/MatchedPoint.java @@ -14,81 +14,99 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * MatchedPoint */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class MatchedPoint implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_LAT = "lat"; @SerializedName(SERIALIZED_NAME_LAT) + @javax.annotation.Nullable private String lat; public static final String SERIALIZED_NAME_LON = "lon"; @SerializedName(SERIALIZED_NAME_LON) + @javax.annotation.Nullable private String lon; + public MatchedPoint() { + } - public MatchedPoint lat(String lat) { - + public MatchedPoint lat(@javax.annotation.Nullable String lat) { this.lat = lat; return this; } - /** + /** * Get lat * @return lat - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getLat() { return lat; } - - public void setLat(String lat) { + public void setLat(@javax.annotation.Nullable String lat) { this.lat = lat; } - public MatchedPoint lon(String lon) { - + public MatchedPoint lon(@javax.annotation.Nullable String lon) { this.lon = lon; return this; } - /** + /** * Get lon * @return lon - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public String getLon() { return lon; } - - public void setLon(String lon) { + public void setLon(@javax.annotation.Nullable String lon) { this.lon = lon; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -105,7 +123,6 @@ public int hashCode() { return Objects.hash(lat, lon); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -120,12 +137,101 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("lat", "lon")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MatchedPoint + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MatchedPoint.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MatchedPoint is not found in the empty JSON string", MatchedPoint.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MatchedPoint.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MatchedPoint` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("lat") != null && !jsonObj.get("lat").isJsonNull()) && !jsonObj.get("lat").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lat` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lat").toString())); + } + if ((jsonObj.get("lon") != null && !jsonObj.get("lon").isJsonNull()) && !jsonObj.get("lon").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lon` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lon").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MatchedPoint.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MatchedPoint' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MatchedPoint.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MatchedPoint value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MatchedPoint read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MatchedPoint given an JSON string + * + * @param jsonString JSON string + * @return An instance of MatchedPoint + * @throws IOException if the JSON string is invalid with respect to MatchedPoint + */ + public static MatchedPoint fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MatchedPoint.class); + } + + /** + * Convert an instance of MatchedPoint to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/Placement.java b/src/main/java/com/adzerk/sdk/generated/model/Placement.java index 4525aef..d919a02 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/Placement.java +++ b/src/main/java/com/adzerk/sdk/generated/model/Placement.java @@ -14,667 +14,656 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; +import com.adzerk.sdk.generated.model.SkipFilters; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.openapitools.jackson.nullable.JsonNullable; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * Placement */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class Placement implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_DIV_NAME = "divName"; @SerializedName(SERIALIZED_NAME_DIV_NAME) + @javax.annotation.Nullable private String divName; public static final String SERIALIZED_NAME_NETWORK_ID = "networkId"; @SerializedName(SERIALIZED_NAME_NETWORK_ID) + @javax.annotation.Nullable private Integer networkId; public static final String SERIALIZED_NAME_SITE_ID = "siteId"; @SerializedName(SERIALIZED_NAME_SITE_ID) + @javax.annotation.Nullable private Integer siteId; public static final String SERIALIZED_NAME_AD_TYPES = "adTypes"; @SerializedName(SERIALIZED_NAME_AD_TYPES) - private List adTypes = null; + @javax.annotation.Nullable + private List adTypes = new ArrayList<>(); public static final String SERIALIZED_NAME_ZONE_IDS = "zoneIds"; @SerializedName(SERIALIZED_NAME_ZONE_IDS) - private List zoneIds = null; + @javax.annotation.Nullable + private List zoneIds; public static final String SERIALIZED_NAME_CAMPAIGN_ID = "campaignId"; @SerializedName(SERIALIZED_NAME_CAMPAIGN_ID) + @javax.annotation.Nullable private Integer campaignId; public static final String SERIALIZED_NAME_FLIGHT_ID = "flightId"; @SerializedName(SERIALIZED_NAME_FLIGHT_ID) + @javax.annotation.Nullable private Integer flightId; public static final String SERIALIZED_NAME_AD_ID = "adId"; @SerializedName(SERIALIZED_NAME_AD_ID) + @javax.annotation.Nullable private Integer adId; public static final String SERIALIZED_NAME_CLICK_URL = "clickUrl"; @SerializedName(SERIALIZED_NAME_CLICK_URL) + @javax.annotation.Nullable private String clickUrl; public static final String SERIALIZED_NAME_PROPERTIES = "properties"; @SerializedName(SERIALIZED_NAME_PROPERTIES) + @javax.annotation.Nullable private Object properties; public static final String SERIALIZED_NAME_EVENT_IDS = "eventIds"; @SerializedName(SERIALIZED_NAME_EVENT_IDS) - private List eventIds = null; + @javax.annotation.Nullable + private List eventIds; public static final String SERIALIZED_NAME_OVERRIDES = "overrides"; @SerializedName(SERIALIZED_NAME_OVERRIDES) + @javax.annotation.Nullable private Object overrides; public static final String SERIALIZED_NAME_CONTENT_KEYS = "contentKeys"; @SerializedName(SERIALIZED_NAME_CONTENT_KEYS) - private Map contentKeys = null; + @javax.annotation.Nullable + private Map contentKeys; public static final String SERIALIZED_NAME_COUNT = "count"; @SerializedName(SERIALIZED_NAME_COUNT) + @javax.annotation.Nullable private Integer count; public static final String SERIALIZED_NAME_PROPORTIONALITY = "proportionality"; @SerializedName(SERIALIZED_NAME_PROPORTIONALITY) + @javax.annotation.Nullable private Boolean proportionality; public static final String SERIALIZED_NAME_ECPM_PARTITION = "ecpmPartition"; + @Deprecated @SerializedName(SERIALIZED_NAME_ECPM_PARTITION) + @javax.annotation.Nullable private String ecpmPartition; public static final String SERIALIZED_NAME_ECPM_PARTITIONS = "ecpmPartitions"; @SerializedName(SERIALIZED_NAME_ECPM_PARTITIONS) - private List ecpmPartitions = null; + @javax.annotation.Nullable + private List ecpmPartitions; public static final String SERIALIZED_NAME_EVENT_MULTIPLIER = "eventMultiplier"; @SerializedName(SERIALIZED_NAME_EVENT_MULTIPLIER) + @javax.annotation.Nullable private Integer eventMultiplier; public static final String SERIALIZED_NAME_SKIP_SELECTION = "skipSelection"; @SerializedName(SERIALIZED_NAME_SKIP_SELECTION) + @javax.annotation.Nullable private Boolean skipSelection; public static final String SERIALIZED_NAME_AD_QUERY = "adQuery"; @SerializedName(SERIALIZED_NAME_AD_QUERY) + @javax.annotation.Nullable private Object adQuery; public static final String SERIALIZED_NAME_FLOOR_PRICE = "floorPrice"; @SerializedName(SERIALIZED_NAME_FLOOR_PRICE) + @javax.annotation.Nullable private Float floorPrice; public static final String SERIALIZED_NAME_FLOOR_CPC = "floorCpc"; @SerializedName(SERIALIZED_NAME_FLOOR_CPC) + @javax.annotation.Nullable private Float floorCpc; + public static final String SERIALIZED_NAME_SKIP_FILTERS = "skipFilters"; + @SerializedName(SERIALIZED_NAME_SKIP_FILTERS) + @javax.annotation.Nullable + private SkipFilters skipFilters; + + public Placement() { + } - public Placement divName(String divName) { - + public Placement divName(@javax.annotation.Nullable String divName) { this.divName = divName; return this; } - /** + /** * A unique name for the placement defined by you * @return divName - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A unique name for the placement defined by you") - public String getDivName() { return divName; } - - public void setDivName(String divName) { + public void setDivName(@javax.annotation.Nullable String divName) { this.divName = divName; } - public Placement networkId(Integer networkId) { - + public Placement networkId(@javax.annotation.Nullable Integer networkId) { this.networkId = networkId; return this; } - /** + /** * The numeric network id * @return networkId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The numeric network id") - public Integer getNetworkId() { return networkId; } - - public void setNetworkId(Integer networkId) { + public void setNetworkId(@javax.annotation.Nullable Integer networkId) { this.networkId = networkId; } - public Placement siteId(Integer siteId) { - + public Placement siteId(@javax.annotation.Nullable Integer siteId) { this.siteId = siteId; return this; } - /** + /** * The numeric site id * @return siteId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The numeric site id") - public Integer getSiteId() { return siteId; } - - public void setSiteId(Integer siteId) { + public void setSiteId(@javax.annotation.Nullable Integer siteId) { this.siteId = siteId; } - public Placement adTypes(List adTypes) { - + public Placement adTypes(@javax.annotation.Nullable List adTypes) { this.adTypes = adTypes; return this; } public Placement addAdTypesItem(Integer adTypesItem) { if (this.adTypes == null) { - this.adTypes = new ArrayList(); + this.adTypes = new ArrayList<>(); } this.adTypes.add(adTypesItem); return this; } - /** + /** * One or more integer ad types. More info [here](https://dev.adzerk.com/docs/ad-sizes) * @return adTypes - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "One or more integer ad types. More info [here](https://dev.adzerk.com/docs/ad-sizes)") - public List getAdTypes() { return adTypes; } - - public void setAdTypes(List adTypes) { + public void setAdTypes(@javax.annotation.Nullable List adTypes) { this.adTypes = adTypes; } - public Placement zoneIds(List zoneIds) { - + public Placement zoneIds(@javax.annotation.Nullable List zoneIds) { this.zoneIds = zoneIds; return this; } public Placement addZoneIdsItem(Integer zoneIdsItem) { if (this.zoneIds == null) { - this.zoneIds = new ArrayList(); + this.zoneIds = new ArrayList<>(); } this.zoneIds.add(zoneIdsItem); return this; } - /** + /** * Zone IDs to use * @return zoneIds - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "Zone IDs to use") - public List getZoneIds() { return zoneIds; } - - public void setZoneIds(List zoneIds) { + public void setZoneIds(@javax.annotation.Nullable List zoneIds) { this.zoneIds = zoneIds; } - public Placement campaignId(Integer campaignId) { - + public Placement campaignId(@javax.annotation.Nullable Integer campaignId) { this.campaignId = campaignId; return this; } - /** + /** * A numeric campaign id; if specified, only consider ads in that campaign * @return campaignId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A numeric campaign id; if specified, only consider ads in that campaign") - public Integer getCampaignId() { return campaignId; } - - public void setCampaignId(Integer campaignId) { + public void setCampaignId(@javax.annotation.Nullable Integer campaignId) { this.campaignId = campaignId; } - public Placement flightId(Integer flightId) { - + public Placement flightId(@javax.annotation.Nullable Integer flightId) { this.flightId = flightId; return this; } - /** + /** * A numeric ad (flight-creative map) id; if specified, only serve that ad if possible * @return flightId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A numeric ad (flight-creative map) id; if specified, only serve that ad if possible") - public Integer getFlightId() { return flightId; } - - public void setFlightId(Integer flightId) { + public void setFlightId(@javax.annotation.Nullable Integer flightId) { this.flightId = flightId; } - public Placement adId(Integer adId) { - + public Placement adId(@javax.annotation.Nullable Integer adId) { this.adId = adId; return this; } - /** + /** * A numeric ad (flight-creative map) id; if specified, only serve that ad if possible * @return adId - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A numeric ad (flight-creative map) id; if specified, only serve that ad if possible") - public Integer getAdId() { return adId; } - - public void setAdId(Integer adId) { + public void setAdId(@javax.annotation.Nullable Integer adId) { this.adId = adId; } - public Placement clickUrl(String clickUrl) { - + public Placement clickUrl(@javax.annotation.Nullable String clickUrl) { this.clickUrl = clickUrl; return this; } - /** + /** * The ad's click-through URL * @return clickUrl - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The ad's click-through URL") - public String getClickUrl() { return clickUrl; } - - public void setClickUrl(String clickUrl) { + public void setClickUrl(@javax.annotation.Nullable String clickUrl) { this.clickUrl = clickUrl; } - public Placement properties(Object properties) { - + public Placement properties(@javax.annotation.Nullable Object properties) { this.properties = properties; return this; } - /** + /** * A map of key/value pairs used for [Custom Targeting](https://dev.adzerk.com/docs/custom-targeting) * @return properties - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A map of key/value pairs used for [Custom Targeting](https://dev.adzerk.com/docs/custom-targeting)") - public Object getProperties() { return properties; } - - public void setProperties(Object properties) { + public void setProperties(@javax.annotation.Nullable Object properties) { this.properties = properties; } - public Placement eventIds(List eventIds) { - + public Placement eventIds(@javax.annotation.Nullable List eventIds) { this.eventIds = eventIds; return this; } public Placement addEventIdsItem(Integer eventIdsItem) { if (this.eventIds == null) { - this.eventIds = new ArrayList(); + this.eventIds = new ArrayList<>(); } this.eventIds.add(eventIdsItem); return this; } - /** + /** * An array of numeric event types. Requests tracking URLs for custom events. See here for [Event Tracking IDs](https://dev.adzerk.com/v1.0/docs/custom-event-tracking) * @return eventIds - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An array of numeric event types. Requests tracking URLs for custom events. See here for [Event Tracking IDs](https://dev.adzerk.com/v1.0/docs/custom-event-tracking)") - public List getEventIds() { return eventIds; } - - public void setEventIds(List eventIds) { + public void setEventIds(@javax.annotation.Nullable List eventIds) { this.eventIds = eventIds; } - public Placement overrides(Object overrides) { - + public Placement overrides(@javax.annotation.Nullable Object overrides) { this.overrides = overrides; return this; } - /** + /** * An object that overrides values for an advertiser, campaign, flight or ad. Used especially for header bidding * @return overrides - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "An object that overrides values for an advertiser, campaign, flight or ad. Used especially for header bidding") - public Object getOverrides() { return overrides; } - - public void setOverrides(Object overrides) { + public void setOverrides(@javax.annotation.Nullable Object overrides) { this.overrides = overrides; } - public Placement contentKeys(Map contentKeys) { - + public Placement contentKeys(@javax.annotation.Nullable Map contentKeys) { this.contentKeys = contentKeys; return this; } public Placement putContentKeysItem(String key, String contentKeysItem) { if (this.contentKeys == null) { - this.contentKeys = new HashMap(); + this.contentKeys = new HashMap<>(); } this.contentKeys.put(key, contentKeysItem); return this; } - /** + /** * A map of key/value pairs used with [ContentDB](https://dev.adzerk.com/docs/contentdb-1). The format is `\"contentKeys\": {\"schema\": \"contentKey\"}` * @return contentKeys - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "A map of key/value pairs used with [ContentDB](https://dev.adzerk.com/docs/contentdb-1). The format is `\"contentKeys\": {\"schema\": \"contentKey\"}`") - public Map getContentKeys() { return contentKeys; } - - public void setContentKeys(Map contentKeys) { + public void setContentKeys(@javax.annotation.Nullable Map contentKeys) { this.contentKeys = contentKeys; } - public Placement count(Integer count) { - + public Placement count(@javax.annotation.Nullable Integer count) { this.count = count; return this; } - /** + /** * (BETA) The number of ads to return per placement. Integer between 1 and 20 * @return count - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "(BETA) The number of ads to return per placement. Integer between 1 and 20") - public Integer getCount() { return count; } - - public void setCount(Integer count) { + public void setCount(@javax.annotation.Nullable Integer count) { this.count = count; } - public Placement proportionality(Boolean proportionality) { - + public Placement proportionality(@javax.annotation.Nullable Boolean proportionality) { this.proportionality = proportionality; return this; } - /** + /** * (BETA) If true, fills ads in a multi-winner placement in proportion to the flight's goals * @return proportionality - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "(BETA) If true, fills ads in a multi-winner placement in proportion to the flight's goals") - public Boolean getProportionality() { return proportionality; } - - public void setProportionality(Boolean proportionality) { + public void setProportionality(@javax.annotation.Nullable Boolean proportionality) { this.proportionality = proportionality; } - public Placement ecpmPartition(String ecpmPartition) { - + @Deprecated + public Placement ecpmPartition(@javax.annotation.Nullable String ecpmPartition) { this.ecpmPartition = ecpmPartition; return this; } - /** + /** * (BETA) The name of the eCPM Partition that should be used to source eCPM data for auctions * @return ecpmPartition - **/ + * @deprecated + */ + @Deprecated @javax.annotation.Nullable - @ApiModelProperty(value = "(BETA) The name of the eCPM Partition that should be used to source eCPM data for auctions") - public String getEcpmPartition() { return ecpmPartition; } - - public void setEcpmPartition(String ecpmPartition) { + @Deprecated + public void setEcpmPartition(@javax.annotation.Nullable String ecpmPartition) { this.ecpmPartition = ecpmPartition; } - public Placement ecpmPartitions(List ecpmPartitions) { - + public Placement ecpmPartitions(@javax.annotation.Nullable List ecpmPartitions) { this.ecpmPartitions = ecpmPartitions; return this; } public Placement addEcpmPartitionsItem(String ecpmPartitionsItem) { if (this.ecpmPartitions == null) { - this.ecpmPartitions = new ArrayList(); + this.ecpmPartitions = new ArrayList<>(); } this.ecpmPartitions.add(ecpmPartitionsItem); return this; } - /** + /** * (BETA) The names of the eCPM Partitions that should be used to source eCPM data for auctions * @return ecpmPartitions - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "(BETA) The names of the eCPM Partitions that should be used to source eCPM data for auctions") - public List getEcpmPartitions() { return ecpmPartitions; } - - public void setEcpmPartitions(List ecpmPartitions) { + public void setEcpmPartitions(@javax.annotation.Nullable List ecpmPartitions) { this.ecpmPartitions = ecpmPartitions; } - public Placement eventMultiplier(Integer eventMultiplier) { - + public Placement eventMultiplier(@javax.annotation.Nullable Integer eventMultiplier) { this.eventMultiplier = eventMultiplier; return this; } - /** + /** * Get eventMultiplier * minimum: -100000000 * maximum: 100000000 * @return eventMultiplier - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getEventMultiplier() { return eventMultiplier; } - - public void setEventMultiplier(Integer eventMultiplier) { + public void setEventMultiplier(@javax.annotation.Nullable Integer eventMultiplier) { this.eventMultiplier = eventMultiplier; } - public Placement skipSelection(Boolean skipSelection) { - + public Placement skipSelection(@javax.annotation.Nullable Boolean skipSelection) { this.skipSelection = skipSelection; return this; } - /** + /** * Get skipSelection * @return skipSelection - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Boolean getSkipSelection() { return skipSelection; } - - public void setSkipSelection(Boolean skipSelection) { + public void setSkipSelection(@javax.annotation.Nullable Boolean skipSelection) { this.skipSelection = skipSelection; } - public Placement adQuery(Object adQuery) { - + public Placement adQuery(@javax.annotation.Nullable Object adQuery) { this.adQuery = adQuery; return this; } - /** + /** * Get adQuery * @return adQuery - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Object getAdQuery() { return adQuery; } - - public void setAdQuery(Object adQuery) { + public void setAdQuery(@javax.annotation.Nullable Object adQuery) { this.adQuery = adQuery; } - public Placement floorPrice(Float floorPrice) { - + public Placement floorPrice(@javax.annotation.Nullable Float floorPrice) { this.floorPrice = floorPrice; return this; } - /** + /** * Get floorPrice * @return floorPrice - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getFloorPrice() { return floorPrice; } - - public void setFloorPrice(Float floorPrice) { + public void setFloorPrice(@javax.annotation.Nullable Float floorPrice) { this.floorPrice = floorPrice; } - public Placement floorCpc(Float floorCpc) { - + public Placement floorCpc(@javax.annotation.Nullable Float floorCpc) { this.floorCpc = floorCpc; return this; } - /** + /** * Get floorCpc * @return floorCpc - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getFloorCpc() { return floorCpc; } - - public void setFloorCpc(Float floorCpc) { + public void setFloorCpc(@javax.annotation.Nullable Float floorCpc) { this.floorCpc = floorCpc; } + public Placement skipFilters(@javax.annotation.Nullable SkipFilters skipFilters) { + this.skipFilters = skipFilters; + return this; + } + + /** + * Get skipFilters + * @return skipFilters + */ + @javax.annotation.Nullable + public SkipFilters getSkipFilters() { + return skipFilters; + } + + public void setSkipFilters(@javax.annotation.Nullable SkipFilters skipFilters) { + this.skipFilters = skipFilters; + } + + + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -703,14 +692,25 @@ public boolean equals(java.lang.Object o) { Objects.equals(this.skipSelection, placement.skipSelection) && Objects.equals(this.adQuery, placement.adQuery) && Objects.equals(this.floorPrice, placement.floorPrice) && - Objects.equals(this.floorCpc, placement.floorCpc); + Objects.equals(this.floorCpc, placement.floorCpc) && + Objects.equals(this.skipFilters, placement.skipFilters); + } + + private static boolean equalsNullable(JsonNullable a, JsonNullable b) { + return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); } @Override public int hashCode() { - return Objects.hash(divName, networkId, siteId, adTypes, zoneIds, campaignId, flightId, adId, clickUrl, properties, eventIds, overrides, contentKeys, count, proportionality, ecpmPartition, ecpmPartitions, eventMultiplier, skipSelection, adQuery, floorPrice, floorCpc); + return Objects.hash(divName, networkId, siteId, adTypes, zoneIds, campaignId, flightId, adId, clickUrl, properties, eventIds, overrides, contentKeys, count, proportionality, ecpmPartition, ecpmPartitions, eventMultiplier, skipSelection, adQuery, floorPrice, floorCpc, skipFilters); } + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } @Override public String toString() { @@ -738,6 +738,7 @@ public String toString() { sb.append(" adQuery: ").append(toIndentedString(adQuery)).append("\n"); sb.append(" floorPrice: ").append(toIndentedString(floorPrice)).append("\n"); sb.append(" floorCpc: ").append(toIndentedString(floorCpc)).append("\n"); + sb.append(" skipFilters: ").append(toIndentedString(skipFilters)).append("\n"); sb.append("}"); return sb.toString(); } @@ -746,12 +747,124 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("divName", "networkId", "siteId", "adTypes", "zoneIds", "campaignId", "flightId", "adId", "clickUrl", "properties", "eventIds", "overrides", "contentKeys", "count", "proportionality", "ecpmPartition", "ecpmPartitions", "eventMultiplier", "skipSelection", "adQuery", "floorPrice", "floorCpc", "skipFilters")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Placement + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Placement.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Placement is not found in the empty JSON string", Placement.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Placement.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Placement` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("divName") != null && !jsonObj.get("divName").isJsonNull()) && !jsonObj.get("divName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `divName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("divName").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("adTypes") != null && !jsonObj.get("adTypes").isJsonNull() && !jsonObj.get("adTypes").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `adTypes` to be an array in the JSON string but got `%s`", jsonObj.get("adTypes").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("zoneIds") != null && !jsonObj.get("zoneIds").isJsonNull() && !jsonObj.get("zoneIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `zoneIds` to be an array in the JSON string but got `%s`", jsonObj.get("zoneIds").toString())); + } + if ((jsonObj.get("clickUrl") != null && !jsonObj.get("clickUrl").isJsonNull()) && !jsonObj.get("clickUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clickUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clickUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("eventIds") != null && !jsonObj.get("eventIds").isJsonNull() && !jsonObj.get("eventIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `eventIds` to be an array in the JSON string but got `%s`", jsonObj.get("eventIds").toString())); + } + if ((jsonObj.get("ecpmPartition") != null && !jsonObj.get("ecpmPartition").isJsonNull()) && !jsonObj.get("ecpmPartition").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `ecpmPartition` to be a primitive type in the JSON string but got `%s`", jsonObj.get("ecpmPartition").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("ecpmPartitions") != null && !jsonObj.get("ecpmPartitions").isJsonNull() && !jsonObj.get("ecpmPartitions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ecpmPartitions` to be an array in the JSON string but got `%s`", jsonObj.get("ecpmPartitions").toString())); + } + // validate the optional field `skipFilters` + if (jsonObj.get("skipFilters") != null && !jsonObj.get("skipFilters").isJsonNull()) { + SkipFilters.validateJsonElement(jsonObj.get("skipFilters")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Placement.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Placement' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Placement.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Placement value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Placement read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Placement given an JSON string + * + * @param jsonString JSON string + * @return An instance of Placement + * @throws IOException if the JSON string is invalid with respect to Placement + */ + public static Placement fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Placement.class); + } + + /** + * Convert an instance of Placement to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/PricingData.java b/src/main/java/com/adzerk/sdk/generated/model/PricingData.java index 0b7a168..84099fe 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/PricingData.java +++ b/src/main/java/com/adzerk/sdk/generated/model/PricingData.java @@ -14,162 +14,171 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * PricingData */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class PricingData implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_PRICE = "price"; @SerializedName(SERIALIZED_NAME_PRICE) + @javax.annotation.Nullable private Float price; public static final String SERIALIZED_NAME_CLEAR_PRICE = "clearPrice"; @SerializedName(SERIALIZED_NAME_CLEAR_PRICE) + @javax.annotation.Nullable private Float clearPrice; public static final String SERIALIZED_NAME_REVENUE = "revenue"; @SerializedName(SERIALIZED_NAME_REVENUE) + @javax.annotation.Nullable private Float revenue; public static final String SERIALIZED_NAME_RATE_TYPE = "rateType"; @SerializedName(SERIALIZED_NAME_RATE_TYPE) + @javax.annotation.Nullable private Integer rateType; public static final String SERIALIZED_NAME_E_C_P_M = "eCPM"; @SerializedName(SERIALIZED_NAME_E_C_P_M) + @javax.annotation.Nullable private Float eCPM; + public PricingData() { + } - public PricingData price(Float price) { - + public PricingData price(@javax.annotation.Nullable Float price) { this.price = price; return this; } - /** + /** * Get price * @return price - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getPrice() { return price; } - - public void setPrice(Float price) { + public void setPrice(@javax.annotation.Nullable Float price) { this.price = price; } - public PricingData clearPrice(Float clearPrice) { - + public PricingData clearPrice(@javax.annotation.Nullable Float clearPrice) { this.clearPrice = clearPrice; return this; } - /** + /** * Get clearPrice * @return clearPrice - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getClearPrice() { return clearPrice; } - - public void setClearPrice(Float clearPrice) { + public void setClearPrice(@javax.annotation.Nullable Float clearPrice) { this.clearPrice = clearPrice; } - public PricingData revenue(Float revenue) { - + public PricingData revenue(@javax.annotation.Nullable Float revenue) { this.revenue = revenue; return this; } - /** + /** * Get revenue * @return revenue - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float getRevenue() { return revenue; } - - public void setRevenue(Float revenue) { + public void setRevenue(@javax.annotation.Nullable Float revenue) { this.revenue = revenue; } - public PricingData rateType(Integer rateType) { - + public PricingData rateType(@javax.annotation.Nullable Integer rateType) { this.rateType = rateType; return this; } - /** + /** * Get rateType * @return rateType - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Integer getRateType() { return rateType; } - - public void setRateType(Integer rateType) { + public void setRateType(@javax.annotation.Nullable Integer rateType) { this.rateType = rateType; } - public PricingData eCPM(Float eCPM) { - + public PricingData eCPM(@javax.annotation.Nullable Float eCPM) { this.eCPM = eCPM; return this; } - /** + /** * Get eCPM * @return eCPM - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "") - public Float geteCPM() { return eCPM; } - - public void seteCPM(Float eCPM) { + public void seteCPM(@javax.annotation.Nullable Float eCPM) { this.eCPM = eCPM; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -189,7 +198,6 @@ public int hashCode() { return Objects.hash(price, clearPrice, revenue, rateType, eCPM); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -207,12 +215,95 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("price", "clearPrice", "revenue", "rateType", "eCPM")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PricingData + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PricingData.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PricingData is not found in the empty JSON string", PricingData.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PricingData.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PricingData` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PricingData.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PricingData' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PricingData.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PricingData value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PricingData read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of PricingData given an JSON string + * + * @param jsonString JSON string + * @return An instance of PricingData + * @throws IOException if the JSON string is invalid with respect to PricingData + */ + public static PricingData fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PricingData.class); + } + + /** + * Convert an instance of PricingData to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java b/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java deleted file mode 100644 index 1021811..0000000 --- a/src/main/java/com/adzerk/sdk/generated/model/RequestLocation.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Adzerk Decision API - * Adzerk Decision API - * - * The version of the OpenAPI document: 1.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package com.adzerk.sdk.generated.model; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.io.Serializable; - -/** - * RequestLocation - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-10-16T14:55:19.451-04:00[America/New_York]") -public class RequestLocation implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String SERIALIZED_NAME_LATITUDE = "latitude"; - @SerializedName(SERIALIZED_NAME_LATITUDE) - private String latitude; - - public static final String SERIALIZED_NAME_LONGITUDE = "longitude"; - @SerializedName(SERIALIZED_NAME_LONGITUDE) - private String longitude; - - - public RequestLocation latitude(String latitude) { - - this.latitude = latitude; - return this; - } - - /** - * Get latitude - * @return latitude - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public String getLatitude() { - return latitude; - } - - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - - public RequestLocation longitude(String longitude) { - - this.longitude = longitude; - return this; - } - - /** - * Get longitude - * @return longitude - **/ - @javax.annotation.Nullable - @ApiModelProperty(value = "") - - public String getLongitude() { - return longitude; - } - - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - - @Override - public boolean equals(java.lang.Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RequestLocation requestLocation = (RequestLocation) o; - return Objects.equals(this.latitude, requestLocation.latitude) && - Objects.equals(this.longitude, requestLocation.longitude); - } - - @Override - public int hashCode() { - return Objects.hash(latitude, longitude); - } - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RequestLocation {\n"); - sb.append(" latitude: ").append(toIndentedString(latitude)).append("\n"); - sb.append(" longitude: ").append(toIndentedString(longitude)).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/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java b/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java new file mode 100644 index 0000000..b314eee --- /dev/null +++ b/src/main/java/com/adzerk/sdk/generated/model/SkipFilters.java @@ -0,0 +1,387 @@ +/* + * Adzerk Decision API + * Adzerk Decision API + * + * The version of the OpenAPI document: 1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.adzerk.sdk.generated.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.io.Serializable; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + +/** + * SkipFilters + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") +public class SkipFilters implements Serializable { + private static final long serialVersionUID = 1L; + + public static final String SERIALIZED_NAME_DISTANCE = "distance"; + @SerializedName(SERIALIZED_NAME_DISTANCE) + @javax.annotation.Nullable + private Boolean distance; + + public static final String SERIALIZED_NAME_FACET = "facet"; + @SerializedName(SERIALIZED_NAME_FACET) + @javax.annotation.Nullable + private Boolean facet; + + public static final String SERIALIZED_NAME_GEODISTANCE = "geodistance"; + @SerializedName(SERIALIZED_NAME_GEODISTANCE) + @javax.annotation.Nullable + private Boolean geodistance; + + public static final String SERIALIZED_NAME_GEOLOCATION = "geolocation"; + @SerializedName(SERIALIZED_NAME_GEOLOCATION) + @javax.annotation.Nullable + private Boolean geolocation; + + public static final String SERIALIZED_NAME_KEYWORD = "keyword"; + @SerializedName(SERIALIZED_NAME_KEYWORD) + @javax.annotation.Nullable + private Boolean keyword; + + public static final String SERIALIZED_NAME_LOCATION = "location"; + @SerializedName(SERIALIZED_NAME_LOCATION) + @javax.annotation.Nullable + private Boolean location; + + public static final String SERIALIZED_NAME_PLACEMENT_LIMIT = "placementLimit"; + @SerializedName(SERIALIZED_NAME_PLACEMENT_LIMIT) + @javax.annotation.Nullable + private Boolean placementLimit; + + public static final String SERIALIZED_NAME_SITE_ZONE = "siteZone"; + @SerializedName(SERIALIZED_NAME_SITE_ZONE) + @javax.annotation.Nullable + private Boolean siteZone; + + public SkipFilters() { + } + + public SkipFilters distance(@javax.annotation.Nullable Boolean distance) { + this.distance = distance; + return this; + } + + /** + * Geodistance filter, which skips geodistance targeting if true. + * @return distance + */ + @javax.annotation.Nullable + public Boolean getDistance() { + return distance; + } + + public void setDistance(@javax.annotation.Nullable Boolean distance) { + this.distance = distance; + } + + + public SkipFilters facet(@javax.annotation.Nullable Boolean facet) { + this.facet = facet; + return this; + } + + /** + * Facet targeting filter, which skips facet targeting if true. + * @return facet + */ + @javax.annotation.Nullable + public Boolean getFacet() { + return facet; + } + + public void setFacet(@javax.annotation.Nullable Boolean facet) { + this.facet = facet; + } + + + public SkipFilters geodistance(@javax.annotation.Nullable Boolean geodistance) { + this.geodistance = geodistance; + return this; + } + + /** + * Geodistance filter, which skips geodistance targeting if true. + * @return geodistance + */ + @javax.annotation.Nullable + public Boolean getGeodistance() { + return geodistance; + } + + public void setGeodistance(@javax.annotation.Nullable Boolean geodistance) { + this.geodistance = geodistance; + } + + + public SkipFilters geolocation(@javax.annotation.Nullable Boolean geolocation) { + this.geolocation = geolocation; + return this; + } + + /** + * Geolocation filter, which skips location targeting if true. + * @return geolocation + */ + @javax.annotation.Nullable + public Boolean getGeolocation() { + return geolocation; + } + + public void setGeolocation(@javax.annotation.Nullable Boolean geolocation) { + this.geolocation = geolocation; + } + + + public SkipFilters keyword(@javax.annotation.Nullable Boolean keyword) { + this.keyword = keyword; + return this; + } + + /** + * Keyword limit filter, which skips all (ad and/or flight) keyword targeting if true. + * @return keyword + */ + @javax.annotation.Nullable + public Boolean getKeyword() { + return keyword; + } + + public void setKeyword(@javax.annotation.Nullable Boolean keyword) { + this.keyword = keyword; + } + + + public SkipFilters location(@javax.annotation.Nullable Boolean location) { + this.location = location; + return this; + } + + /** + * Geolocation filter, which skips location targeting if true. + * @return location + */ + @javax.annotation.Nullable + public Boolean getLocation() { + return location; + } + + public void setLocation(@javax.annotation.Nullable Boolean location) { + this.location = location; + } + + + public SkipFilters placementLimit(@javax.annotation.Nullable Boolean placementLimit) { + this.placementLimit = placementLimit; + return this; + } + + /** + * Placement limit filter, where no advertiser placement limit if true. + * @return placementLimit + */ + @javax.annotation.Nullable + public Boolean getPlacementLimit() { + return placementLimit; + } + + public void setPlacementLimit(@javax.annotation.Nullable Boolean placementLimit) { + this.placementLimit = placementLimit; + } + + + public SkipFilters siteZone(@javax.annotation.Nullable Boolean siteZone) { + this.siteZone = siteZone; + return this; + } + + /** + * Site/zone limit filter, which skips site/zone targeting if true. + * @return siteZone + */ + @javax.annotation.Nullable + public Boolean getSiteZone() { + return siteZone; + } + + public void setSiteZone(@javax.annotation.Nullable Boolean siteZone) { + this.siteZone = siteZone; + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SkipFilters skipFilters = (SkipFilters) o; + return Objects.equals(this.distance, skipFilters.distance) && + Objects.equals(this.facet, skipFilters.facet) && + Objects.equals(this.geodistance, skipFilters.geodistance) && + Objects.equals(this.geolocation, skipFilters.geolocation) && + Objects.equals(this.keyword, skipFilters.keyword) && + Objects.equals(this.location, skipFilters.location) && + Objects.equals(this.placementLimit, skipFilters.placementLimit) && + Objects.equals(this.siteZone, skipFilters.siteZone); + } + + @Override + public int hashCode() { + return Objects.hash(distance, facet, geodistance, geolocation, keyword, location, placementLimit, siteZone); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SkipFilters {\n"); + sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); + sb.append(" facet: ").append(toIndentedString(facet)).append("\n"); + sb.append(" geodistance: ").append(toIndentedString(geodistance)).append("\n"); + sb.append(" geolocation: ").append(toIndentedString(geolocation)).append("\n"); + sb.append(" keyword: ").append(toIndentedString(keyword)).append("\n"); + sb.append(" location: ").append(toIndentedString(location)).append("\n"); + sb.append(" placementLimit: ").append(toIndentedString(placementLimit)).append("\n"); + sb.append(" siteZone: ").append(toIndentedString(siteZone)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("distance", "facet", "geodistance", "geolocation", "keyword", "location", "placementLimit", "siteZone")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SkipFilters + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SkipFilters.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SkipFilters is not found in the empty JSON string", SkipFilters.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SkipFilters.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SkipFilters` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SkipFilters.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SkipFilters' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SkipFilters.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SkipFilters value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SkipFilters read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SkipFilters given an JSON string + * + * @param jsonString JSON string + * @return An instance of SkipFilters + * @throws IOException if the JSON string is invalid with respect to SkipFilters + */ + public static SkipFilters fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SkipFilters.class); + } + + /** + * Convert an instance of SkipFilters to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/adzerk/sdk/generated/model/User.java b/src/main/java/com/adzerk/sdk/generated/model/User.java index d6ae06b..3f41fc8 100644 --- a/src/main/java/com/adzerk/sdk/generated/model/User.java +++ b/src/main/java/com/adzerk/sdk/generated/model/User.java @@ -14,55 +14,75 @@ package com.adzerk.sdk.generated.model; import java.util.Objects; -import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.io.IOException; +import java.util.Arrays; import java.io.Serializable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.adzerk.sdk.generated.JSON; + /** * Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1) */ -@ApiModel(description = "Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1)") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2022-12-10T07:56:36.651701-06:00[America/Chicago]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-08-16T20:15:30.057879Z[Etc/UTC]", comments = "Generator version: 7.14.0") public class User implements Serializable { private static final long serialVersionUID = 1L; public static final String SERIALIZED_NAME_KEY = "key"; @SerializedName(SERIALIZED_NAME_KEY) + @javax.annotation.Nullable private String key; + public User() { + } - public User key(String key) { - + public User key(@javax.annotation.Nullable String key) { this.key = key; return this; } - /** + /** * The UserKey used for UserDB Targeting * @return key - **/ + */ @javax.annotation.Nullable - @ApiModelProperty(value = "The UserKey used for UserDB Targeting") - public String getKey() { return key; } - - public void setKey(String key) { + public void setKey(@javax.annotation.Nullable String key) { this.key = key; } + @Override - public boolean equals(java.lang.Object o) { + public boolean equals(Object o) { if (this == o) { return true; } @@ -78,7 +98,6 @@ public int hashCode() { return Objects.hash(key); } - @Override public String toString() { StringBuilder sb = new StringBuilder(); @@ -92,12 +111,98 @@ public String 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) { + private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("key")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to User + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!User.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in User is not found in the empty JSON string", User.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!User.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `User` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("key") != null && !jsonObj.get("key").isJsonNull()) && !jsonObj.get("key").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `key` to be a primitive type in the JSON string but got `%s`", jsonObj.get("key").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!User.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'User' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(User.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, User value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public User read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of User given an JSON string + * + * @param jsonString JSON string + * @return An instance of User + * @throws IOException if the JSON string is invalid with respect to User + */ + public static User fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, User.class); + } + + /** + * Convert an instance of User to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } From 01199535fb0e43978b2ac3679b12d05bf65fc406 Mon Sep 17 00:00:00 2001 From: lqrs <64920932+lqrs@users.noreply.github.com> Date: Sat, 16 Aug 2025 20:21:44 +0000 Subject: [PATCH 3/3] Catch up based on the latest generated --- build.gradle | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 313a210..df04126 100644 --- a/build.gradle +++ b/build.gradle @@ -103,18 +103,13 @@ task execute(type:JavaExec) { classpath = sourceSets.main.runtimeClasspath } -task javadocJar(type: Jar) { - archiveClassifier.set('javadoc') - from javadoc -} - task sourcesJar(type: Jar) { archiveClassifier.set('sources') from sourceSets.main.allSource } artifacts { - archives javadocJar, sourcesJar + archives sourcesJar } dependencies { @@ -122,14 +117,18 @@ dependencies { implementation "com.google.code.findbugs:jsr305:3.0.2" implementation 'com.squareup.okhttp3:okhttp:4.12.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' - implementation 'com.google.code.gson:gson:2.8.6' - implementation 'io.gsonfire:gson-fire:1.8.4' - implementation 'org.apache.commons:commons-lang3:3.10' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation 'org.apache.commons:commons-lang3:3.17.0' + implementation "jakarta.annotation:jakarta.annotation-api:1.3.5" implementation 'org.threeten:threetenbp:1.4.3' - implementation 'javax.annotation:javax.annotation-api:1.3.2' implementation 'org.slf4j:slf4j-api:2.0.17' implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0' - testImplementation 'junit:junit:4.13.1' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' } javadoc {