diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28d7bf4..a05b571 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,3 +16,27 @@ jobs: java-version: "17" - uses: gradle/actions/setup-gradle@v4 - run: ./gradlew test + + regeneration: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: "17" + - uses: gradle/actions/setup-gradle@v4 + - name: Verify normalization, repeatable generation, and response contracts + run: | + set -euo pipefail + # Freeze one upstream spec for both runs, even if main changes meanwhile. + curl -fsSL https://raw.githubusercontent.com/frain-dev/convoy/main/docs/v3/openapi3.yaml \ + -o "$RUNNER_TEMP/openapi3.yaml" + export SPEC_URL="file://$RUNNER_TEMP/openapi3.yaml" + export GENERATOR_JAR="$RUNNER_TEMP/openapi-generator.jar" + ./scripts/generate.sh + python3 scripts/test_normalize_spec.py "$GENERATOR_JAR" + cp -R src/main/java "$RUNNER_TEMP/generated-once" + ./scripts/generate.sh + diff -ru "$RUNNER_TEMP/generated-once" src/main/java + ./gradlew test diff --git a/README.md b/README.md index 46bf1e6..9fabd47 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,16 @@ artifacts change. Locally: ./gradlew test ``` +Generation first names the delivery-attempt array alternative in a temporary +copy of the spec and enables an alias model only for that collection. This works around the +Java/native generator's inline-array `oneOf` bug while preserving both response +shapes: `DeliveryAttemptList` for the default array, or +`GetDeliveryAttempts200ResponseAllOfDataOneOf` for a page with `content` and +`next_cursor`. `scripts/NormalizeSpec.java` uses Jackson from the verified +generator JAR; no additional dependencies are required. It also derives a +template override from that JAR so the collection retains `ArrayList`'s +equality/hash behavior rather than the generator's POJO equality behavior. + ## License [MIT](LICENSE) diff --git a/scripts/NormalizeSpec.java b/scripts/NormalizeSpec.java new file mode 100644 index 0000000..6b71049 --- /dev/null +++ b/scripts/NormalizeSpec.java @@ -0,0 +1,90 @@ +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; + +/** + * Keep Java/native generation compatible with the delivery-attempts union. + * + * OpenAPI Generator 7.23.0 emits invalid Java for an inline array in oneOf + * (List.class, getList(), etc.). A named array schema, together with + * x-generate-alias-as-model, uses its supported concrete collection model. + * This only changes the temporary generation input, never the wire schema. + * Jackson/YAML are provided by the checksum-verified generator JAR, so this + * source-file launcher needs no additional build tool or dependency download. + */ +class NormalizeSpec { + private static final String ARRAY_MODEL = "DeliveryAttemptList"; + + public static void main(String[] args) throws Exception { + ObjectMapper yaml = new ObjectMapper(new YAMLFactory()); + ObjectNode spec = (ObjectNode) yaml.readTree(Path.of(args[0]).toFile()); + ObjectNode schemas = (ObjectNode) spec.path("components").path("schemas"); + + for (JsonNode path : spec.path("paths")) { + JsonNode operation = path.path("get"); + if (!"GetDeliveryAttempts".equals(operation.path("operationId").asText())) { + continue; + } + JsonNode response = operation.path("responses").path("200") + .path("content").path("application/json").path("schema"); + normalizeResponse(response, schemas); + } + + new ObjectMapper().writerWithDefaultPrettyPrinter() + .writeValue(Path.of(args[1]).toFile(), spec); + prepareTemplates(Path.of(args[2])); + } + + private static void normalizeResponse(JsonNode response, ObjectNode schemas) { + JsonNode variants = response.path("properties").path("data").path("oneOf"); + if (variants.isArray()) { + ArrayNode oneOf = (ArrayNode) variants; + for (int i = 0; i < oneOf.size(); i++) { + JsonNode variant = oneOf.get(i); + if (!"array".equals(variant.path("type").asText())) { + continue; + } + JsonNode existing = schemas.get(ARRAY_MODEL); + if (existing != null && !existing.equals(variant)) { + throw new IllegalArgumentException("Conflicting schema: " + ARRAY_MODEL); + } + // Preserve items, constraints and descriptions verbatim. + ObjectNode array = variant.deepCopy(); + array.put("x-generate-alias-as-model", true); + array.put("x-convoy-array-alias", true); + schemas.set(ARRAY_MODEL, array); + oneOf.set(i, schemas.objectNode().put("$ref", "#/components/schemas/" + ARRAY_MODEL)); + } + } + for (JsonNode component : response.path("allOf")) { + normalizeResponse(component, schemas); + } + } + + private static void prepareTemplates(Path directory) throws Exception { + // The stock POJO equality/hash template violates the List contract for + // array aliases. Keep ArrayList's implementations for this alias only. + // Read the pinned template from the verified JAR instead of vendoring + // or silently patching generated Java. Fail closed if its layout moves. + String template; + try (var source = NormalizeSpec.class.getResourceAsStream("/Java/libraries/native/pojo.mustache")) { + template = new String(source.readAllBytes(), StandardCharsets.UTF_8); + } + int start = template.indexOf(" /**\n * Return true if this {{name}} object is equal to o."); + int end = template.indexOf(" @Override\n public String toString()", start); + if (start < 0 || end < start) { + throw new IllegalStateException("Generator POJO equality template changed; review the array alias workaround"); + } + String guard = "vendorExtensions.x-convoy-array-alias"; + template = template.substring(0, start) + "{{^" + guard + "}}\n" + + template.substring(start, end) + "{{/" + guard + "}}\n" + template.substring(end); + Path target = directory.resolve("libraries/native/pojo.mustache"); + Files.createDirectories(target.getParent()); + Files.writeString(target, template); + } +} diff --git a/scripts/generate.sh b/scripts/generate.sh index 71eb8e2..27cb61e 100755 --- a/scripts/generate.sh +++ b/scripts/generate.sh @@ -33,15 +33,26 @@ echo "${GENERATOR_SHA256} ${GENERATOR_JAR}" | shasum -a 256 -c - >/dev/null || curl -fsSL "$SPEC_URL" -o "$tmp/openapi3.yaml" +# Name the delivery-attempt array alternative in our temporary input. The +# native generator cannot compile inline array alternatives in oneOf, but +# supports named collection models without changing either JSON wire shape. +java -cp "$GENERATOR_JAR" scripts/NormalizeSpec.java \ + "$tmp/openapi3.yaml" "$tmp/openapi3.json" "$tmp/templates" + # hideGenerationTimestamp: @Generated annotations must not embed a wall-clock # date or every regeneration diffs all 200+ files and "no diff, no PR" breaks. java -jar "$GENERATOR_JAR" generate \ - -i "$tmp/openapi3.yaml" \ + -i "$tmp/openapi3.json" \ -g java \ --library native \ + -t "$tmp/templates" \ -o "$tmp/gen" \ --additional-properties=groupId=io.github.frain-dev,artifactId=convoy,apiPackage=com.getconvoy.api,modelPackage=com.getconvoy.models,invokerPackage=com.getconvoy.client,useJakartaEe=true,hideGenerationTimestamp=true +# Restore released method overloads and the list-shaped response API. +# Fail if generator output changes enough to invalidate the compatibility patch. +patch -s -f -F 0 -p1 -d "$tmp/gen" < scripts/preserve-sdk-compatibility.patch + # Mirror only the three generated packages. The hand-written verify package # (com/getconvoy/webhook) is a sibling and is never created or removed here. # --delete keeps each generated package an exact mirror of generator output. diff --git a/scripts/preserve-sdk-compatibility.patch b/scripts/preserve-sdk-compatibility.patch new file mode 100644 index 0000000..878d79d --- /dev/null +++ b/scripts/preserve-sdk-compatibility.patch @@ -0,0 +1,345 @@ +diff --git a/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java b/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java +index a750f6e..f960c18 100644 +--- a/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java ++++ b/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java +@@ -300,6 +300,14 @@ public class DeliveryAttemptsApi { + return localVarRequestBuilder; + } + ++ public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { ++ return getDeliveryAttempts(projectID, eventDeliveryID, null, null); ++ } ++ ++ public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { ++ return getDeliveryAttempts(projectID, eventDeliveryID, null, null, headers); ++ } ++ + /** + * List delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. +@@ -330,6 +338,14 @@ public class DeliveryAttemptsApi { + return localVarResponse.getData(); + } + ++ public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { ++ return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, null, null); ++ } ++ ++ public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { ++ return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, null, null, headers); ++ } ++ + /** + * List delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. +diff --git a/src/main/java/com/getconvoy/api/EventDeliveriesApi.java b/src/main/java/com/getconvoy/api/EventDeliveriesApi.java +index 1048252..e1174e2 100644 +--- a/src/main/java/com/getconvoy/api/EventDeliveriesApi.java ++++ b/src/main/java/com/getconvoy/api/EventDeliveriesApi.java +@@ -165,6 +165,14 @@ public class EventDeliveriesApi { + return file; + } + ++ public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { ++ return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); ++ } ++ ++ public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { ++ return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); ++ } ++ + /** + * Batch retry event delivery + * This endpoint batch retries multiple event deliveries at once. +@@ -223,6 +231,14 @@ public class EventDeliveriesApi { + return localVarResponse.getData(); + } + ++ public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { ++ return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); ++ } ++ ++ public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { ++ return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); ++ } ++ + /** + * Batch retry event delivery + * This endpoint batch retries multiple event deliveries at once. +@@ -530,6 +546,14 @@ public class EventDeliveriesApi { + return localVarRequestBuilder; + } + ++ public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { ++ return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); ++ } ++ ++ public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { ++ return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); ++ } ++ + /** + * List all event deliveries + * This endpoint retrieves all event deliveries paginated. +@@ -588,6 +612,14 @@ public class EventDeliveriesApi { + return localVarResponse.getData(); + } + ++ public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { ++ return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); ++ } ++ ++ public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { ++ return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); ++ } ++ + /** + * List all event deliveries + * This endpoint retrieves all event deliveries paginated. +diff --git a/src/main/java/com/getconvoy/api/EventsApi.java b/src/main/java/com/getconvoy/api/EventsApi.java +index f46aac7..86d2d9a 100644 +--- a/src/main/java/com/getconvoy/api/EventsApi.java ++++ b/src/main/java/com/getconvoy/api/EventsApi.java +@@ -171,6 +171,14 @@ public class EventsApi { + return file; + } + ++ public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * Batch replay events + * This endpoint replays multiple events at once. +@@ -223,6 +231,14 @@ public class EventsApi { + return localVarResponse.getData(); + } + ++ public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * Batch replay events + * This endpoint replays multiple events at once. +@@ -386,6 +402,14 @@ public class EventsApi { + return localVarRequestBuilder; + } + ++ public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * Count events matching batch replay filters + * This endpoint returns how many events would be affected by a batch replay with the given filters. +@@ -438,6 +462,14 @@ public class EventsApi { + return localVarResponse.getData(); + } + ++ public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * Count events matching batch replay filters + * This endpoint returns how many events would be affected by a batch replay with the given filters. +@@ -1256,6 +1288,14 @@ public class EventsApi { + return localVarRequestBuilder; + } + ++ public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * List all events + * This endpoint fetches app events with pagination +@@ -1308,6 +1348,14 @@ public class EventsApi { + return localVarResponse.getData(); + } + ++ public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { ++ return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); ++ } ++ ++ public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { ++ return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); ++ } ++ + /** + * List all events + * This endpoint fetches app events with pagination +diff --git a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java +index e247e66..1ecbf4f 100644 +--- a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java ++++ b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java +@@ -19,13 +19,16 @@ import java.util.StringJoiner; + import java.util.Objects; + import java.util.Map; + import java.util.HashMap; ++import com.fasterxml.jackson.annotation.JsonIgnore; + import com.fasterxml.jackson.annotation.JsonInclude; + import com.fasterxml.jackson.annotation.JsonProperty; + import com.fasterxml.jackson.annotation.JsonCreator; + import com.fasterxml.jackson.annotation.JsonTypeName; + import com.fasterxml.jackson.annotation.JsonValue; + import com.getconvoy.models.GetDeliveryAttempts200ResponseAllOfData; ++import java.util.ArrayList; + import java.util.Arrays; ++import java.util.List; + import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +@@ -50,7 +53,10 @@ public class GetDeliveryAttempts200Response { + + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nullable +- private GetDeliveryAttempts200ResponseAllOfData data; ++ private List data = new ArrayList<>(); ++ ++ @jakarta.annotation.Nullable ++ private GetDeliveryAttempts200ResponseAllOfDataOneOf page; + + public GetDeliveryAttempts200Response() { + } +@@ -103,29 +109,56 @@ public class GetDeliveryAttempts200Response { + } + + +- public GetDeliveryAttempts200Response data(@jakarta.annotation.Nullable GetDeliveryAttempts200ResponseAllOfData data) { +- this.data = data; ++ public GetDeliveryAttempts200Response data(@jakarta.annotation.Nullable List data) { ++ setData(data); + return this; + } + +- /** +- * Get data +- * @return data +- */ ++ public GetDeliveryAttempts200Response addDataItem(DatastoreDeliveryAttempt dataItem) { ++ if (getData() == null) { ++ setData(new ArrayList<>()); ++ } ++ getData().add(dataItem); ++ return this; ++ } ++ ++ /** Returns attempts for either wire format. Use getPage() for the cursor. */ + @jakarta.annotation.Nullable +- @JsonProperty(value = JSON_PROPERTY_DATA, required = false) +- @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) +- public GetDeliveryAttempts200ResponseAllOfData getData() { +- return data; ++ @JsonIgnore ++ public List getData() { ++ return page == null ? data : page.getContent(); + } + ++ @JsonIgnore ++ public void setData(@jakarta.annotation.Nullable List data) { ++ this.data = data; ++ this.page = null; ++ } ++ ++ /** Returns pagination details when the server returned a page. */ ++ @jakarta.annotation.Nullable ++ @JsonIgnore ++ public GetDeliveryAttempts200ResponseAllOfDataOneOf getPage() { ++ return page; ++ } + + @JsonProperty(value = JSON_PROPERTY_DATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) +- public void setData(@jakarta.annotation.Nullable GetDeliveryAttempts200ResponseAllOfData data) { +- this.data = data; ++ private Object getWireData() { ++ return page == null ? data : page; + } + ++ @JsonProperty(value = JSON_PROPERTY_DATA, required = false) ++ private void setWireData(@jakarta.annotation.Nullable GetDeliveryAttempts200ResponseAllOfData wireData) { ++ if (wireData == null) { ++ setData(null); ++ } else if (wireData.getActualInstance() instanceof GetDeliveryAttempts200ResponseAllOfDataOneOf) { ++ this.data = null; ++ this.page = wireData.getGetDeliveryAttempts200ResponseAllOfDataOneOf(); ++ } else { ++ setData(wireData.getDeliveryAttemptList()); ++ } ++ } + + /** + * Return true if this GetDeliveryAttempts_200_response object is equal to o. +@@ -141,12 +174,12 @@ public class GetDeliveryAttempts200Response { + GetDeliveryAttempts200Response getDeliveryAttempts200Response = (GetDeliveryAttempts200Response) o; + return Objects.equals(this.message, getDeliveryAttempts200Response.message) && + Objects.equals(this.status, getDeliveryAttempts200Response.status) && +- Objects.equals(this.data, getDeliveryAttempts200Response.data); ++ Objects.equals(this.getWireData(), getDeliveryAttempts200Response.getWireData()); + } + + @Override + public int hashCode() { +- return Objects.hash(message, status, data); ++ return Objects.hash(message, status, getWireData()); + } + + @Override +@@ -155,7 +188,7 @@ public class GetDeliveryAttempts200Response { + sb.append("class GetDeliveryAttempts200Response {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); +- sb.append(" data: ").append(toIndentedString(data)).append("\n"); ++ sb.append(" data: ").append(toIndentedString(getWireData())).append("\n"); + sb.append("}"); + return sb.toString(); + } +@@ -212,7 +245,12 @@ public class GetDeliveryAttempts200Response { + + // add `data` to the URL query string + if (getData() != null) { +- joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); ++ for (int i = 0; i < getData().size(); i++) { ++ if (getData().get(i) != null) { ++ joiner.add(getData().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sdata%s%s", prefix, suffix, ++ "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); ++ } ++ } + } + + return joiner.toString(); +diff --git a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java +index e165a4c..6720977 100644 +--- a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java ++++ b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java +@@ -159,7 +159,7 @@ public class GetDeliveryAttempts200ResponseAllOfData extends AbstractOpenApiSche + */ + @Override + public GetDeliveryAttempts200ResponseAllOfData getNullValue(DeserializationContext ctxt) throws JsonMappingException { +- throw new JsonMappingException(ctxt.getParser(), "GetDeliveryAttempts200ResponseAllOfData cannot be null"); ++ return null; + } + } + diff --git a/scripts/test_normalize_spec.py b/scripts/test_normalize_spec.py new file mode 100644 index 0000000..17357d3 --- /dev/null +++ b/scripts/test_normalize_spec.py @@ -0,0 +1,88 @@ +"""Offline fixture checks. Pass the checksum-verified generator JAR as argv[1].""" + +import copy +import json +from pathlib import Path +import subprocess +import sys +import tempfile +import unittest + + +JAR = str(Path(sys.argv.pop(1)).resolve()) +ROOT = Path(__file__).resolve().parent.parent + + +class NormalizeSpecTest(unittest.TestCase): + def setUp(self): + self.array = { + "type": "array", + "items": {"$ref": "#/components/schemas/Attempt"}, + "minItems": 0, + "maxItems": 10, + "description": "Latest delivery attempts", + } + self.page = { + "type": "object", + "required": ["content", "next_cursor"], + "properties": {"content": copy.deepcopy(self.array), "next_cursor": {"type": "string"}}, + } + self.spec = { + "openapi": "3.0.3", + "paths": { + "/attempts": { + "get": { + "operationId": "GetDeliveryAttempts", + "responses": {"200": {"content": {"application/json": {"schema": { + "allOf": [{"type": "object", "properties": { + "data": {"oneOf": [copy.deepcopy(self.array), copy.deepcopy(self.page)]} + }}] + }}}}}, + } + } + }, + "components": {"schemas": { + "Attempt": {"type": "object", "properties": {"uid": {"type": "string"}}}, + "UnrelatedArray": {"type": "array", "items": {"type": "string"}}, + }}, + } + + def normalize(self, spec): + with tempfile.TemporaryDirectory() as directory: + folder = Path(directory) + source, output = folder / "input.json", folder / "output.json" + source.write_text(json.dumps(spec)) + subprocess.run( + ["java", "-cp", JAR, "scripts/NormalizeSpec.java", str(source), str(output), str(folder / "templates")], + cwd=ROOT, check=True, capture_output=True, text=True, + ) + template = (folder / "templates/libraries/native/pojo.mustache").read_text() + self.assertIn("{{^vendorExtensions.x-convoy-array-alias}}", template) + return json.loads(output.read_text()) + + def test_only_target_array_changes_and_constraints_survive(self): + expected = copy.deepcopy(self.spec) + schema = expected["paths"]["/attempts"]["get"]["responses"]["200"]["content"]["application/json"]["schema"] + schema["allOf"][0]["properties"]["data"]["oneOf"][0] = {"$ref": "#/components/schemas/DeliveryAttemptList"} + expected["components"]["schemas"]["DeliveryAttemptList"] = { + **self.array, "x-generate-alias-as-model": True, "x-convoy-array-alias": True, + } + self.assertEqual(expected, self.normalize(self.spec)) + + def test_normalization_is_idempotent(self): + normalized = self.normalize(self.spec) + self.assertEqual(normalized, self.normalize(normalized)) + + def test_other_operations_are_unchanged(self): + self.spec["paths"]["/attempts"]["get"]["operationId"] = "OtherOperation" + self.assertEqual(self.spec, self.normalize(self.spec)) + + def test_conflicting_schema_name_fails_clearly(self): + self.spec["components"]["schemas"]["DeliveryAttemptList"] = {"type": "string"} + with self.assertRaises(subprocess.CalledProcessError) as failure: + self.normalize(self.spec) + self.assertIn("Conflicting schema: DeliveryAttemptList", failure.exception.stderr) + + +if __name__ == "__main__": + unittest.main() diff --git a/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java b/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java index 4de50f6..f960c18 100644 --- a/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java +++ b/src/main/java/com/getconvoy/api/DeliveryAttemptsApi.java @@ -300,55 +300,79 @@ private HttpRequest.Builder getDeliveryAttemptRequestBuilder(@jakarta.annotation return localVarRequestBuilder; } + public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { + return getDeliveryAttempts(projectID, eventDeliveryID, null, null); + } + + public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { + return getDeliveryAttempts(projectID, eventDeliveryID, null, null, headers); + } + /** * List delivery attempts - * This endpoint fetches an app message's delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. * @param projectID Project ID (required) * @param eventDeliveryID event delivery id (required) + * @param paginated Return a page of ten attempts and next_cursor (optional) + * @param before Exclusive attempt cursor from next_cursor; requires paginated=true (optional) * @return GetDeliveryAttempts200Response * @throws ApiException if fails to make API call */ - public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { - return getDeliveryAttempts(projectID, eventDeliveryID, null); + public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, @jakarta.annotation.Nullable Boolean paginated, @jakarta.annotation.Nullable String before) throws ApiException { + return getDeliveryAttempts(projectID, eventDeliveryID, paginated, before, null); } /** * List delivery attempts - * This endpoint fetches an app message's delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. * @param projectID Project ID (required) * @param eventDeliveryID event delivery id (required) + * @param paginated Return a page of ten attempts and next_cursor (optional) + * @param before Exclusive attempt cursor from next_cursor; requires paginated=true (optional) * @param headers Optional headers to include in the request * @return GetDeliveryAttempts200Response * @throws ApiException if fails to make API call */ - public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { - ApiResponse localVarResponse = getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, headers); + public GetDeliveryAttempts200Response getDeliveryAttempts(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, @jakarta.annotation.Nullable Boolean paginated, @jakarta.annotation.Nullable String before, Map headers) throws ApiException { + ApiResponse localVarResponse = getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, paginated, before, headers); return localVarResponse.getData(); } + public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { + return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, null, null); + } + + public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { + return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, null, null, headers); + } + /** * List delivery attempts - * This endpoint fetches an app message's delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. * @param projectID Project ID (required) * @param eventDeliveryID event delivery id (required) + * @param paginated Return a page of ten attempts and next_cursor (optional) + * @param before Exclusive attempt cursor from next_cursor; requires paginated=true (optional) * @return ApiResponse<GetDeliveryAttempts200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID) throws ApiException { - return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, null); + public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, @jakarta.annotation.Nullable Boolean paginated, @jakarta.annotation.Nullable String before) throws ApiException { + return getDeliveryAttemptsWithHttpInfo(projectID, eventDeliveryID, paginated, before, null); } /** * List delivery attempts - * This endpoint fetches an app message's delivery attempts + * This endpoint fetches an app message's delivery attempts Default: latest ten attempts as an array. With paginated=true: content and next_cursor. Pass next_cursor as before for older history; empty means last page. Pages are oldest first. * @param projectID Project ID (required) * @param eventDeliveryID event delivery id (required) + * @param paginated Return a page of ten attempts and next_cursor (optional) + * @param before Exclusive attempt cursor from next_cursor; requires paginated=true (optional) * @param headers Optional headers to include in the request * @return ApiResponse<GetDeliveryAttempts200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getDeliveryAttemptsRequestBuilder(projectID, eventDeliveryID, headers); + public ApiResponse getDeliveryAttemptsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, @jakarta.annotation.Nullable Boolean paginated, @jakarta.annotation.Nullable String before, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getDeliveryAttemptsRequestBuilder(projectID, eventDeliveryID, paginated, before, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -395,7 +419,7 @@ public ApiResponse getDeliveryAttemptsWithHttpIn } } - private HttpRequest.Builder getDeliveryAttemptsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, Map headers) throws ApiException { + private HttpRequest.Builder getDeliveryAttemptsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nonnull String eventDeliveryID, @jakarta.annotation.Nullable Boolean paginated, @jakarta.annotation.Nullable String before, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling getDeliveryAttempts"); @@ -411,7 +435,24 @@ private HttpRequest.Builder getDeliveryAttemptsRequestBuilder(@jakarta.annotatio .replace("{projectID}", ApiClient.urlEncode(projectID.toString())) .replace("{eventDeliveryID}", ApiClient.urlEncode(eventDeliveryID.toString())); - localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + List localVarQueryParams = new ArrayList<>(); + StringJoiner localVarQueryStringJoiner = new StringJoiner("&"); + String localVarQueryParameterBaseName; + localVarQueryParameterBaseName = "paginated"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("paginated", paginated)); + localVarQueryParameterBaseName = "before"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("before", before)); + + if (!localVarQueryParams.isEmpty() || localVarQueryStringJoiner.length() != 0) { + StringJoiner queryJoiner = new StringJoiner("&"); + localVarQueryParams.forEach(p -> queryJoiner.add(p.getName() + '=' + p.getValue())); + if (localVarQueryStringJoiner.length() != 0) { + queryJoiner.add(localVarQueryStringJoiner.toString()); + } + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath + '?' + queryJoiner.toString())); + } else { + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + } localVarRequestBuilder.header("Accept", "application/json"); diff --git a/src/main/java/com/getconvoy/api/EventDeliveriesApi.java b/src/main/java/com/getconvoy/api/EventDeliveriesApi.java index bc65099..e1174e2 100644 --- a/src/main/java/com/getconvoy/api/EventDeliveriesApi.java +++ b/src/main/java/com/getconvoy/api/EventDeliveriesApi.java @@ -165,6 +165,14 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx return file; } + public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); + } + + public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); + } + /** * Batch retry event delivery * This endpoint batch retries multiple event deliveries at once. @@ -175,19 +183,22 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) * @return GetProjects400Response * @throws ApiException if fails to make API call */ - public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { - return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, null); + public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return batchRetryEventDelivery(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, null); } /** @@ -200,11 +211,14 @@ public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnul * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) @@ -212,11 +226,19 @@ public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnul * @return GetProjects400Response * @throws ApiException if fails to make API call */ - public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { - ApiResponse localVarResponse = batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, headers); + public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + ApiResponse localVarResponse = batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, headers); return localVarResponse.getData(); } + public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); + } + + public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); + } + /** * Batch retry event delivery * This endpoint batch retries multiple event deliveries at once. @@ -227,19 +249,22 @@ public GetProjects400Response batchRetryEventDelivery(@jakarta.annotation.Nonnul * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) * @return ApiResponse<GetProjects400Response> * @throws ApiException if fails to make API call */ - public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { - return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, null); + public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return batchRetryEventDeliveryWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, null); } /** @@ -252,11 +277,14 @@ public ApiResponse batchRetryEventDeliveryWithHttpInfo(@ * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) @@ -264,8 +292,8 @@ public ApiResponse batchRetryEventDeliveryWithHttpInfo(@ * @return ApiResponse<GetProjects400Response> * @throws ApiException if fails to make API call */ - public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = batchRetryEventDeliveryRequestBuilder(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, headers); + public ApiResponse batchRetryEventDeliveryWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = batchRetryEventDeliveryRequestBuilder(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -312,7 +340,7 @@ public ApiResponse batchRetryEventDeliveryWithHttpInfo(@ } } - private HttpRequest.Builder batchRetryEventDeliveryRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + private HttpRequest.Builder batchRetryEventDeliveryRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling batchRetryEventDelivery"); @@ -334,10 +362,14 @@ private HttpRequest.Builder batchRetryEventDeliveryRequestBuilder(@jakarta.annot localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "endpointId", endpointId)); localVarQueryParameterBaseName = "eventId"; localVarQueryParams.addAll(ApiClient.parameterToPairs("eventId", eventId)); - localVarQueryParameterBaseName = "event_type"; - localVarQueryParams.addAll(ApiClient.parameterToPairs("event_type", eventType)); + localVarQueryParameterBaseName = "eventType"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("eventType", eventType)); localVarQueryParameterBaseName = "idempotencyKey"; localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyKey", idempotencyKey)); + localVarQueryParameterBaseName = "idempotencyValue"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyValue", idempotencyValue)); + localVarQueryParameterBaseName = "minTrials"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("minTrials", minTrials)); localVarQueryParameterBaseName = "next_page_cursor"; localVarQueryParams.addAll(ApiClient.parameterToPairs("next_page_cursor", nextPageCursor)); localVarQueryParameterBaseName = "perPage"; @@ -348,6 +380,8 @@ private HttpRequest.Builder batchRetryEventDeliveryRequestBuilder(@jakarta.annot localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); localVarQueryParameterBaseName = "sort"; localVarQueryParams.addAll(ApiClient.parameterToPairs("sort", sort)); + localVarQueryParameterBaseName = "sourceId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "sourceId", sourceId)); localVarQueryParameterBaseName = "startDate"; localVarQueryParams.addAll(ApiClient.parameterToPairs("startDate", startDate)); localVarQueryParameterBaseName = "status"; @@ -512,6 +546,14 @@ private HttpRequest.Builder forceResendEventDeliveriesRequestBuilder(@jakarta.an return localVarRequestBuilder; } + public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); + } + + public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); + } + /** * List all event deliveries * This endpoint retrieves all event deliveries paginated. @@ -522,19 +564,22 @@ private HttpRequest.Builder forceResendEventDeliveriesRequestBuilder(@jakarta.an * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) * @return GetEventDeliveriesPaged200Response * @throws ApiException if fails to make API call */ - public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { - return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, null); + public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return getEventDeliveriesPaged(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, null); } /** @@ -547,11 +592,14 @@ public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annot * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) @@ -559,11 +607,19 @@ public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annot * @return GetEventDeliveriesPaged200Response * @throws ApiException if fails to make API call */ - public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { - ApiResponse localVarResponse = getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, headers); + public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + ApiResponse localVarResponse = getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, headers); return localVarResponse.getData(); } + public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId); + } + + public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, null, null, nextPageCursor, perPage, prevPageCursor, query, sort, null, startDate, status, subscriptionId, headers); + } + /** * List all event deliveries * This endpoint retrieves all event deliveries paginated. @@ -574,19 +630,22 @@ public GetEventDeliveriesPaged200Response getEventDeliveriesPaged(@jakarta.annot * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) * @return ApiResponse<GetEventDeliveriesPaged200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { - return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, null); + public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId) throws ApiException { + return getEventDeliveriesPagedWithHttpInfo(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, null); } /** @@ -599,11 +658,14 @@ public ApiResponse getEventDeliveriesPagedWi * @param eventId Event ID to filter by (optional) * @param eventType EventType to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. Matches deliveries of events ingested with it. Not combinable with idempotencyKey. (optional) + * @param minTrials Only return deliveries with at least this many attempts; 2 or more means retried. Requires idempotencyValue, eventId, or endpointId. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches delivery id, event id, event type prefix, and endpoint name. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) + * @param sourceId Limits idempotencyValue matching to these source IDs. (optional) * @param startDate The start date (optional) * @param status A list of event delivery statuses to filter by (optional) * @param subscriptionId SubscriptionID to filter by (optional) @@ -611,8 +673,8 @@ public ApiResponse getEventDeliveriesPagedWi * @return ApiResponse<GetEventDeliveriesPaged200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getEventDeliveriesPagedRequestBuilder(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, startDate, status, subscriptionId, headers); + public ApiResponse getEventDeliveriesPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getEventDeliveriesPagedRequestBuilder(projectID, direction, endDate, endpointId, eventId, eventType, idempotencyKey, idempotencyValue, minTrials, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, status, subscriptionId, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -659,7 +721,7 @@ public ApiResponse getEventDeliveriesPagedWi } } - private HttpRequest.Builder getEventDeliveriesPagedRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { + private HttpRequest.Builder getEventDeliveriesPagedRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String eventId, @jakarta.annotation.Nullable String eventType, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable Integer minTrials, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, @jakarta.annotation.Nullable List status, @jakarta.annotation.Nullable String subscriptionId, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling getEventDeliveriesPaged"); @@ -681,10 +743,14 @@ private HttpRequest.Builder getEventDeliveriesPagedRequestBuilder(@jakarta.annot localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "endpointId", endpointId)); localVarQueryParameterBaseName = "eventId"; localVarQueryParams.addAll(ApiClient.parameterToPairs("eventId", eventId)); - localVarQueryParameterBaseName = "event_type"; - localVarQueryParams.addAll(ApiClient.parameterToPairs("event_type", eventType)); + localVarQueryParameterBaseName = "eventType"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("eventType", eventType)); localVarQueryParameterBaseName = "idempotencyKey"; localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyKey", idempotencyKey)); + localVarQueryParameterBaseName = "idempotencyValue"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyValue", idempotencyValue)); + localVarQueryParameterBaseName = "minTrials"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("minTrials", minTrials)); localVarQueryParameterBaseName = "next_page_cursor"; localVarQueryParams.addAll(ApiClient.parameterToPairs("next_page_cursor", nextPageCursor)); localVarQueryParameterBaseName = "perPage"; @@ -695,6 +761,8 @@ private HttpRequest.Builder getEventDeliveriesPagedRequestBuilder(@jakarta.annot localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); localVarQueryParameterBaseName = "sort"; localVarQueryParams.addAll(ApiClient.parameterToPairs("sort", sort)); + localVarQueryParameterBaseName = "sourceId"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "sourceId", sourceId)); localVarQueryParameterBaseName = "startDate"; localVarQueryParams.addAll(ApiClient.parameterToPairs("startDate", startDate)); localVarQueryParameterBaseName = "status"; diff --git a/src/main/java/com/getconvoy/api/EventsApi.java b/src/main/java/com/getconvoy/api/EventsApi.java index 316f26f..86d2d9a 100644 --- a/src/main/java/com/getconvoy/api/EventsApi.java +++ b/src/main/java/com/getconvoy/api/EventsApi.java @@ -171,6 +171,14 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx return file; } + public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * Batch replay events * This endpoint replays multiple events at once. @@ -180,18 +188,20 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return BatchReplayEvents200Response * @throws ApiException if fails to make API call */ - public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return batchReplayEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -203,10 +213,12 @@ public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnul * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -214,11 +226,19 @@ public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnul * @return BatchReplayEvents200Response * @throws ApiException if fails to make API call */ - public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - ApiResponse localVarResponse = batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + ApiResponse localVarResponse = batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); return localVarResponse.getData(); } + public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * Batch replay events * This endpoint replays multiple events at once. @@ -228,18 +248,20 @@ public BatchReplayEvents200Response batchReplayEvents(@jakarta.annotation.Nonnul * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return ApiResponse<BatchReplayEvents200Response> * @throws ApiException if fails to make API call */ - public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return batchReplayEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -251,10 +273,12 @@ public ApiResponse batchReplayEventsWithHttpInfo(@ * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -262,8 +286,8 @@ public ApiResponse batchReplayEventsWithHttpInfo(@ * @return ApiResponse<BatchReplayEvents200Response> * @throws ApiException if fails to make API call */ - public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = batchReplayEventsRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public ApiResponse batchReplayEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = batchReplayEventsRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -310,7 +334,7 @@ public ApiResponse batchReplayEventsWithHttpInfo(@ } } - private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling batchReplayEvents"); @@ -334,6 +358,8 @@ private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation. localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "endpointId", endpointId)); localVarQueryParameterBaseName = "idempotencyKey"; localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyKey", idempotencyKey)); + localVarQueryParameterBaseName = "idempotencyValue"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyValue", idempotencyValue)); localVarQueryParameterBaseName = "next_page_cursor"; localVarQueryParams.addAll(ApiClient.parameterToPairs("next_page_cursor", nextPageCursor)); localVarQueryParameterBaseName = "perPage"; @@ -342,6 +368,8 @@ private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation. localVarQueryParams.addAll(ApiClient.parameterToPairs("prev_page_cursor", prevPageCursor)); localVarQueryParameterBaseName = "query"; localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); + localVarQueryParameterBaseName = "queryMode"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("queryMode", queryMode)); localVarQueryParameterBaseName = "sort"; localVarQueryParams.addAll(ApiClient.parameterToPairs("sort", sort)); localVarQueryParameterBaseName = "sourceId"; @@ -374,6 +402,14 @@ private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation. return localVarRequestBuilder; } + public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * Count events matching batch replay filters * This endpoint returns how many events would be affected by a batch replay with the given filters. @@ -383,18 +419,20 @@ private HttpRequest.Builder batchReplayEventsRequestBuilder(@jakarta.annotation. * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return CountAffectedEvents200Response * @throws ApiException if fails to make API call */ - public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return countAffectedEvents(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -406,10 +444,12 @@ public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.No * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -417,11 +457,19 @@ public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.No * @return CountAffectedEvents200Response * @throws ApiException if fails to make API call */ - public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - ApiResponse localVarResponse = countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + ApiResponse localVarResponse = countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); return localVarResponse.getData(); } + public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * Count events matching batch replay filters * This endpoint returns how many events would be affected by a batch replay with the given filters. @@ -431,18 +479,20 @@ public CountAffectedEvents200Response countAffectedEvents(@jakarta.annotation.No * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return ApiResponse<CountAffectedEvents200Response> * @throws ApiException if fails to make API call */ - public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return countAffectedEventsWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -454,10 +504,12 @@ public ApiResponse countAffectedEventsWithHttpIn * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -465,8 +517,8 @@ public ApiResponse countAffectedEventsWithHttpIn * @return ApiResponse<CountAffectedEvents200Response> * @throws ApiException if fails to make API call */ - public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = countAffectedEventsRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public ApiResponse countAffectedEventsWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = countAffectedEventsRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -513,7 +565,7 @@ public ApiResponse countAffectedEventsWithHttpIn } } - private HttpRequest.Builder countAffectedEventsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + private HttpRequest.Builder countAffectedEventsRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling countAffectedEvents"); @@ -537,6 +589,8 @@ private HttpRequest.Builder countAffectedEventsRequestBuilder(@jakarta.annotatio localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "endpointId", endpointId)); localVarQueryParameterBaseName = "idempotencyKey"; localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyKey", idempotencyKey)); + localVarQueryParameterBaseName = "idempotencyValue"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyValue", idempotencyValue)); localVarQueryParameterBaseName = "next_page_cursor"; localVarQueryParams.addAll(ApiClient.parameterToPairs("next_page_cursor", nextPageCursor)); localVarQueryParameterBaseName = "perPage"; @@ -545,6 +599,8 @@ private HttpRequest.Builder countAffectedEventsRequestBuilder(@jakarta.annotatio localVarQueryParams.addAll(ApiClient.parameterToPairs("prev_page_cursor", prevPageCursor)); localVarQueryParameterBaseName = "query"; localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); + localVarQueryParameterBaseName = "queryMode"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("queryMode", queryMode)); localVarQueryParameterBaseName = "sort"; localVarQueryParams.addAll(ApiClient.parameterToPairs("sort", sort)); localVarQueryParameterBaseName = "sourceId"; @@ -1232,6 +1288,14 @@ private HttpRequest.Builder getEndpointEventRequestBuilder(@jakarta.annotation.N return localVarRequestBuilder; } + public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * List all events * This endpoint fetches app events with pagination @@ -1241,18 +1305,20 @@ private HttpRequest.Builder getEndpointEventRequestBuilder(@jakarta.annotation.N * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return GetEventsPaged200Response * @throws ApiException if fails to make API call */ - public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return getEventsPaged(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -1264,10 +1330,12 @@ public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull Stri * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -1275,11 +1343,19 @@ public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull Stri * @return GetEventsPaged200Response * @throws ApiException if fails to make API call */ - public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - ApiResponse localVarResponse = getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + ApiResponse localVarResponse = getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); return localVarResponse.getData(); } + public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate); + } + + public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, null, nextPageCursor, perPage, prevPageCursor, query, null, sort, sourceId, startDate, headers); + } + /** * List all events * This endpoint fetches app events with pagination @@ -1289,18 +1365,20 @@ public GetEventsPaged200Response getEventsPaged(@jakarta.annotation.Nonnull Stri * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) * @return ApiResponse<GetEventsPaged200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { - return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, null); + public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate) throws ApiException { + return getEventsPagedWithHttpInfo(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, null); } /** @@ -1312,10 +1390,12 @@ public ApiResponse getEventsPagedWithHttpInfo(@jakart * @param endDate The end date (optional) * @param endpointId A list of endpoint ids to filter by (optional) * @param idempotencyKey IdempotencyKey to filter by (optional) + * @param idempotencyValue Raw value of a source's single idempotency key location, e.g. a provider delivery ID. List only; pass sourceId if several sources qualify. Not combinable with idempotencyKey. (optional) * @param nextPageCursor A pagination cursor to fetch the next page of a list (optional) * @param perPage The number of items to return per page (optional) * @param prevPageCursor A pagination cursor to fetch the previous page of a list (optional) * @param query Matches event id prefix, idempotency key, event type, and source name. A JSON object uses payload containment, same as body. Text plus JSON ANDs both. (optional) + * @param queryMode Set to text to search metadata literally, without interpreting JSON in query. (optional) * @param sort Sort order, values are `ASC` or `DESC`, defaults to `DESC` (optional) * @param sourceId A list of Source IDs to filter the events by. (optional) * @param startDate The start date (optional) @@ -1323,8 +1403,8 @@ public ApiResponse getEventsPagedWithHttpInfo(@jakart * @return ApiResponse<GetEventsPaged200Response> * @throws ApiException if fails to make API call */ - public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { - HttpRequest.Builder localVarRequestBuilder = getEventsPagedRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, nextPageCursor, perPage, prevPageCursor, query, sort, sourceId, startDate, headers); + public ApiResponse getEventsPagedWithHttpInfo(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + HttpRequest.Builder localVarRequestBuilder = getEventsPagedRequestBuilder(projectID, body, direction, endDate, endpointId, idempotencyKey, idempotencyValue, nextPageCursor, perPage, prevPageCursor, query, queryMode, sort, sourceId, startDate, headers); try { HttpResponse localVarResponse = memberVarHttpClient.send( localVarRequestBuilder.build(), @@ -1371,7 +1451,7 @@ public ApiResponse getEventsPagedWithHttpInfo(@jakart } } - private HttpRequest.Builder getEventsPagedRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { + private HttpRequest.Builder getEventsPagedRequestBuilder(@jakarta.annotation.Nonnull String projectID, @jakarta.annotation.Nullable String body, @jakarta.annotation.Nullable String direction, @jakarta.annotation.Nullable String endDate, @jakarta.annotation.Nullable List endpointId, @jakarta.annotation.Nullable String idempotencyKey, @jakarta.annotation.Nullable String idempotencyValue, @jakarta.annotation.Nullable String nextPageCursor, @jakarta.annotation.Nullable Integer perPage, @jakarta.annotation.Nullable String prevPageCursor, @jakarta.annotation.Nullable String query, @jakarta.annotation.Nullable String queryMode, @jakarta.annotation.Nullable String sort, @jakarta.annotation.Nullable List sourceId, @jakarta.annotation.Nullable String startDate, Map headers) throws ApiException { // verify the required parameter 'projectID' is set if (projectID == null) { throw new ApiException(400, "Missing the required parameter 'projectID' when calling getEventsPaged"); @@ -1395,6 +1475,8 @@ private HttpRequest.Builder getEventsPagedRequestBuilder(@jakarta.annotation.Non localVarQueryParams.addAll(ApiClient.parameterToPairs("multi", "endpointId", endpointId)); localVarQueryParameterBaseName = "idempotencyKey"; localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyKey", idempotencyKey)); + localVarQueryParameterBaseName = "idempotencyValue"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("idempotencyValue", idempotencyValue)); localVarQueryParameterBaseName = "next_page_cursor"; localVarQueryParams.addAll(ApiClient.parameterToPairs("next_page_cursor", nextPageCursor)); localVarQueryParameterBaseName = "perPage"; @@ -1403,6 +1485,8 @@ private HttpRequest.Builder getEventsPagedRequestBuilder(@jakarta.annotation.Non localVarQueryParams.addAll(ApiClient.parameterToPairs("prev_page_cursor", prevPageCursor)); localVarQueryParameterBaseName = "query"; localVarQueryParams.addAll(ApiClient.parameterToPairs("query", query)); + localVarQueryParameterBaseName = "queryMode"; + localVarQueryParams.addAll(ApiClient.parameterToPairs("queryMode", queryMode)); localVarQueryParameterBaseName = "sort"; localVarQueryParams.addAll(ApiClient.parameterToPairs("sort", sort)); localVarQueryParameterBaseName = "sourceId"; diff --git a/src/main/java/com/getconvoy/models/DeliveryAttemptList.java b/src/main/java/com/getconvoy/models/DeliveryAttemptList.java new file mode 100644 index 0000000..e693045 --- /dev/null +++ b/src/main/java/com/getconvoy/models/DeliveryAttemptList.java @@ -0,0 +1,91 @@ +/* + * Convoy API Reference + * Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification. + * + * The version of the OpenAPI document: 26.3.5 + * Contact: support@getconvoy.io + * + * 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.getconvoy.models; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.getconvoy.models.DatastoreDeliveryAttempt; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.getconvoy.client.ApiClient; +/** + * DeliveryAttemptList + */ +@JsonPropertyOrder({ +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0") +public class DeliveryAttemptList extends ArrayList { + public DeliveryAttemptList() { + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DeliveryAttemptList {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java index a100a92..1ecbf4f 100644 --- a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java +++ b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200Response.java @@ -19,12 +19,13 @@ import java.util.Objects; import java.util.Map; import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; -import com.getconvoy.models.DatastoreDeliveryAttempt; +import com.getconvoy.models.GetDeliveryAttempts200ResponseAllOfData; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -54,6 +55,9 @@ public class GetDeliveryAttempts200Response { @jakarta.annotation.Nullable private List data = new ArrayList<>(); + @jakarta.annotation.Nullable + private GetDeliveryAttempts200ResponseAllOfDataOneOf page; + public GetDeliveryAttempts200Response() { } @@ -106,36 +110,55 @@ public void setStatus(@jakarta.annotation.Nullable Boolean status) { public GetDeliveryAttempts200Response data(@jakarta.annotation.Nullable List data) { - this.data = data; + setData(data); return this; } public GetDeliveryAttempts200Response addDataItem(DatastoreDeliveryAttempt dataItem) { - if (this.data == null) { - this.data = new ArrayList<>(); + if (getData() == null) { + setData(new ArrayList<>()); } - this.data.add(dataItem); + getData().add(dataItem); return this; } - /** - * Get data - * @return data - */ + /** Returns attempts for either wire format. Use getPage() for the cursor. */ @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_DATA, required = false) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + @JsonIgnore public List getData() { - return data; + return page == null ? data : page.getContent(); } + @JsonIgnore + public void setData(@jakarta.annotation.Nullable List data) { + this.data = data; + this.page = null; + } + + /** Returns pagination details when the server returned a page. */ + @jakarta.annotation.Nullable + @JsonIgnore + public GetDeliveryAttempts200ResponseAllOfDataOneOf getPage() { + return page; + } @JsonProperty(value = JSON_PROPERTY_DATA, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setData(@jakarta.annotation.Nullable List data) { - this.data = data; + private Object getWireData() { + return page == null ? data : page; } + @JsonProperty(value = JSON_PROPERTY_DATA, required = false) + private void setWireData(@jakarta.annotation.Nullable GetDeliveryAttempts200ResponseAllOfData wireData) { + if (wireData == null) { + setData(null); + } else if (wireData.getActualInstance() instanceof GetDeliveryAttempts200ResponseAllOfDataOneOf) { + this.data = null; + this.page = wireData.getGetDeliveryAttempts200ResponseAllOfDataOneOf(); + } else { + setData(wireData.getDeliveryAttemptList()); + } + } /** * Return true if this GetDeliveryAttempts_200_response object is equal to o. @@ -151,12 +174,12 @@ public boolean equals(Object o) { GetDeliveryAttempts200Response getDeliveryAttempts200Response = (GetDeliveryAttempts200Response) o; return Objects.equals(this.message, getDeliveryAttempts200Response.message) && Objects.equals(this.status, getDeliveryAttempts200Response.status) && - Objects.equals(this.data, getDeliveryAttempts200Response.data); + Objects.equals(this.getWireData(), getDeliveryAttempts200Response.getWireData()); } @Override public int hashCode() { - return Objects.hash(message, status, data); + return Objects.hash(message, status, getWireData()); } @Override @@ -165,7 +188,7 @@ public String toString() { sb.append("class GetDeliveryAttempts200Response {\n"); sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" data: ").append(toIndentedString(getWireData())).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java new file mode 100644 index 0000000..6720977 --- /dev/null +++ b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfData.java @@ -0,0 +1,300 @@ +/* + * Convoy API Reference + * Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification. + * + * The version of the OpenAPI document: 26.3.5 + * Contact: support@getconvoy.io + * + * 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.getconvoy.models; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.getconvoy.models.DatastoreDeliveryAttempt; +import com.getconvoy.models.DeliveryAttemptList; +import com.getconvoy.models.GetDeliveryAttempts200ResponseAllOfDataOneOf; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +import com.fasterxml.jackson.core.type.TypeReference; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import com.getconvoy.client.ApiClient; +import com.getconvoy.client.JSON; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0") +@JsonDeserialize(using = GetDeliveryAttempts200ResponseAllOfData.GetDeliveryAttempts200ResponseAllOfDataDeserializer.class) +@JsonSerialize(using = GetDeliveryAttempts200ResponseAllOfData.GetDeliveryAttempts200ResponseAllOfDataSerializer.class) +public class GetDeliveryAttempts200ResponseAllOfData extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(GetDeliveryAttempts200ResponseAllOfData.class.getName()); + + public static class GetDeliveryAttempts200ResponseAllOfDataSerializer extends StdSerializer { + public GetDeliveryAttempts200ResponseAllOfDataSerializer(Class t) { + super(t); + } + + public GetDeliveryAttempts200ResponseAllOfDataSerializer() { + this(null); + } + + @Override + public void serialize(GetDeliveryAttempts200ResponseAllOfData value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class GetDeliveryAttempts200ResponseAllOfDataDeserializer extends StdDeserializer { + public GetDeliveryAttempts200ResponseAllOfDataDeserializer() { + this(GetDeliveryAttempts200ResponseAllOfData.class); + } + + public GetDeliveryAttempts200ResponseAllOfDataDeserializer(Class vc) { + super(vc); + } + + @Override + public GetDeliveryAttempts200ResponseAllOfData deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = ctxt.readTree(jp); + Object deserialized = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize DeliveryAttemptList + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (DeliveryAttemptList.class.equals(Integer.class) || DeliveryAttemptList.class.equals(Long.class) || DeliveryAttemptList.class.equals(Float.class) || DeliveryAttemptList.class.equals(Double.class) || DeliveryAttemptList.class.equals(Boolean.class) || DeliveryAttemptList.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((DeliveryAttemptList.class.equals(Integer.class) || DeliveryAttemptList.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((DeliveryAttemptList.class.equals(Float.class) || DeliveryAttemptList.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (DeliveryAttemptList.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (DeliveryAttemptList.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(DeliveryAttemptList.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'DeliveryAttemptList'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'DeliveryAttemptList'", e); + } + + // deserialize GetDeliveryAttempts200ResponseAllOfDataOneOf + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Integer.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Long.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Float.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Double.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Boolean.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Integer.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Float.class) || GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (GetDeliveryAttempts200ResponseAllOfDataOneOf.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(GetDeliveryAttempts200ResponseAllOfDataOneOf.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + match++; + log.log(Level.FINER, "Input data matches schema 'GetDeliveryAttempts200ResponseAllOfDataOneOf'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'GetDeliveryAttempts200ResponseAllOfDataOneOf'", e); + } + + if (match == 1) { + GetDeliveryAttempts200ResponseAllOfData ret = new GetDeliveryAttempts200ResponseAllOfData(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for GetDeliveryAttempts200ResponseAllOfData: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public GetDeliveryAttempts200ResponseAllOfData getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public GetDeliveryAttempts200ResponseAllOfData() { + super("oneOf", Boolean.FALSE); + } + + public GetDeliveryAttempts200ResponseAllOfData(DeliveryAttemptList o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public GetDeliveryAttempts200ResponseAllOfData(GetDeliveryAttempts200ResponseAllOfDataOneOf o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("DeliveryAttemptList", DeliveryAttemptList.class); + schemas.put("GetDeliveryAttempts200ResponseAllOfDataOneOf", GetDeliveryAttempts200ResponseAllOfDataOneOf.class); + JSON.registerDescendants(GetDeliveryAttempts200ResponseAllOfData.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map> getSchemas() { + return GetDeliveryAttempts200ResponseAllOfData.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * DeliveryAttemptList, GetDeliveryAttempts200ResponseAllOfDataOneOf + * + * It could be an instance of the 'oneOf' schemas. + * The oneOf child schemas may themselves be a composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(DeliveryAttemptList.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(GetDeliveryAttempts200ResponseAllOfDataOneOf.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be DeliveryAttemptList, GetDeliveryAttempts200ResponseAllOfDataOneOf"); + } + + /** + * Get the actual instance, which can be the following: + * DeliveryAttemptList, GetDeliveryAttempts200ResponseAllOfDataOneOf + * + * @return The actual instance (DeliveryAttemptList, GetDeliveryAttempts200ResponseAllOfDataOneOf) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `DeliveryAttemptList`. If the actual instance is not `DeliveryAttemptList`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DeliveryAttemptList` + * @throws ClassCastException if the instance is not `DeliveryAttemptList` + */ + public DeliveryAttemptList getDeliveryAttemptList() throws ClassCastException { + return (DeliveryAttemptList)super.getActualInstance(); + } + + /** + * Get the actual instance of `GetDeliveryAttempts200ResponseAllOfDataOneOf`. If the actual instance is not `GetDeliveryAttempts200ResponseAllOfDataOneOf`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `GetDeliveryAttempts200ResponseAllOfDataOneOf` + * @throws ClassCastException if the instance is not `GetDeliveryAttempts200ResponseAllOfDataOneOf` + */ + public GetDeliveryAttempts200ResponseAllOfDataOneOf getGetDeliveryAttempts200ResponseAllOfDataOneOf() throws ClassCastException { + return (GetDeliveryAttempts200ResponseAllOfDataOneOf)super.getActualInstance(); + } + + + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + if (getActualInstance() instanceof DeliveryAttemptList) { + if (getActualInstance() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sone_of_0%s=%s", prefix, suffix, ApiClient.urlEncode(String.valueOf(getActualInstance())))); + } + return joiner.toString(); + } + if (getActualInstance() instanceof GetDeliveryAttempts200ResponseAllOfDataOneOf) { + if (getActualInstance() != null) { + joiner.add(((GetDeliveryAttempts200ResponseAllOfDataOneOf)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix)); + } + return joiner.toString(); + } + return null; + } + +} + diff --git a/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfDataOneOf.java b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfDataOneOf.java new file mode 100644 index 0000000..da9d9fc --- /dev/null +++ b/src/main/java/com/getconvoy/models/GetDeliveryAttempts200ResponseAllOfDataOneOf.java @@ -0,0 +1,200 @@ +/* + * Convoy API Reference + * Convoy is a fast and secure webhooks proxy. This document contains datastore's API specification. + * + * The version of the OpenAPI document: 26.3.5 + * Contact: support@getconvoy.io + * + * 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.getconvoy.models; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; +import java.util.Objects; +import java.util.Map; +import java.util.HashMap; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.getconvoy.models.DatastoreDeliveryAttempt; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.getconvoy.client.ApiClient; +/** + * GetDeliveryAttempts200ResponseAllOfDataOneOf + */ +@JsonPropertyOrder({ + GetDeliveryAttempts200ResponseAllOfDataOneOf.JSON_PROPERTY_CONTENT, + GetDeliveryAttempts200ResponseAllOfDataOneOf.JSON_PROPERTY_NEXT_CURSOR +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.23.0") +public class GetDeliveryAttempts200ResponseAllOfDataOneOf { + public static final String JSON_PROPERTY_CONTENT = "content"; + @jakarta.annotation.Nonnull + private List content = new ArrayList<>(); + + public static final String JSON_PROPERTY_NEXT_CURSOR = "next_cursor"; + @jakarta.annotation.Nonnull + private String nextCursor; + + public GetDeliveryAttempts200ResponseAllOfDataOneOf() { + } + + public GetDeliveryAttempts200ResponseAllOfDataOneOf content(@jakarta.annotation.Nonnull List content) { + this.content = content; + return this; + } + + public GetDeliveryAttempts200ResponseAllOfDataOneOf addContentItem(DatastoreDeliveryAttempt contentItem) { + if (this.content == null) { + this.content = new ArrayList<>(); + } + this.content.add(contentItem); + return this; + } + + /** + * Get content + * @return content + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_CONTENT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getContent() { + return content; + } + + + @JsonProperty(value = JSON_PROPERTY_CONTENT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setContent(@jakarta.annotation.Nonnull List content) { + this.content = content; + } + + + public GetDeliveryAttempts200ResponseAllOfDataOneOf nextCursor(@jakarta.annotation.Nonnull String nextCursor) { + this.nextCursor = nextCursor; + return this; + } + + /** + * Pass as before to fetch older attempts. Empty on the last page. + * @return nextCursor + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getNextCursor() { + return nextCursor; + } + + + @JsonProperty(value = JSON_PROPERTY_NEXT_CURSOR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setNextCursor(@jakarta.annotation.Nonnull String nextCursor) { + this.nextCursor = nextCursor; + } + + + /** + * Return true if this GetDeliveryAttempts_200_response_allOf_data_oneOf object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetDeliveryAttempts200ResponseAllOfDataOneOf getDeliveryAttempts200ResponseAllOfDataOneOf = (GetDeliveryAttempts200ResponseAllOfDataOneOf) o; + return Objects.equals(this.content, getDeliveryAttempts200ResponseAllOfDataOneOf.content) && + Objects.equals(this.nextCursor, getDeliveryAttempts200ResponseAllOfDataOneOf.nextCursor); + } + + @Override + public int hashCode() { + return Objects.hash(content, nextCursor); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GetDeliveryAttempts200ResponseAllOfDataOneOf {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" nextCursor: ").append(toIndentedString(nextCursor)).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) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + /** + * Convert the instance into URL query string. + * + * @return URL query string + */ + public String toUrlQueryString() { + return toUrlQueryString(null); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + String suffix = ""; + String containerSuffix = ""; + String containerPrefix = ""; + if (prefix == null) { + // style=form, explode=true, e.g. /pet?name=cat&type=manx + prefix = ""; + } else { + // deepObject style e.g. /pet?id[name]=cat&id[type]=manx + prefix = prefix + "["; + suffix = "]"; + containerSuffix = "]"; + containerPrefix = "["; + } + + StringJoiner joiner = new StringJoiner("&"); + + // add `content` to the URL query string + if (getContent() != null) { + for (int i = 0; i < getContent().size(); i++) { + if (getContent().get(i) != null) { + joiner.add(getContent().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%scontent%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `next_cursor` to the URL query string + if (getNextCursor() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%snext_cursor%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getNextCursor())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/getconvoy/models/ModelsUpdateSource.java b/src/main/java/com/getconvoy/models/ModelsUpdateSource.java index 7297ecb..82bbee1 100644 --- a/src/main/java/com/getconvoy/models/ModelsUpdateSource.java +++ b/src/main/java/com/getconvoy/models/ModelsUpdateSource.java @@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; +import com.getconvoy.models.DatastoreSourceProvider; import com.getconvoy.models.DatastoreSourceType; import com.getconvoy.models.ModelsPubSubConfig; import com.getconvoy.models.ModelsUpdateCustomResponse; @@ -47,6 +48,7 @@ ModelsUpdateSource.JSON_PROPERTY_IDEMPOTENCY_KEYS, ModelsUpdateSource.JSON_PROPERTY_IS_DISABLED, ModelsUpdateSource.JSON_PROPERTY_NAME, + ModelsUpdateSource.JSON_PROPERTY_PROVIDER, ModelsUpdateSource.JSON_PROPERTY_PUB_SUB, ModelsUpdateSource.JSON_PROPERTY_TYPE, ModelsUpdateSource.JSON_PROPERTY_VERIFIER @@ -85,6 +87,10 @@ public class ModelsUpdateSource { @jakarta.annotation.Nullable private String name; + public static final String JSON_PROPERTY_PROVIDER = "provider"; + @jakarta.annotation.Nullable + private DatastoreSourceProvider provider; + public static final String JSON_PROPERTY_PUB_SUB = "pub_sub"; @jakarta.annotation.Nullable private ModelsPubSubConfig pubSub; @@ -308,6 +314,30 @@ public void setName(@jakarta.annotation.Nullable String name) { } + public ModelsUpdateSource provider(@jakarta.annotation.Nullable DatastoreSourceProvider provider) { + this.provider = provider; + return this; + } + + /** + * Use this to specify one of our predefined source types. + * @return provider + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PROVIDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public DatastoreSourceProvider getProvider() { + return provider; + } + + + @JsonProperty(value = JSON_PROPERTY_PROVIDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setProvider(@jakarta.annotation.Nullable DatastoreSourceProvider provider) { + this.provider = provider; + } + + public ModelsUpdateSource pubSub(@jakarta.annotation.Nullable ModelsPubSubConfig pubSub) { this.pubSub = pubSub; return this; @@ -400,6 +430,7 @@ public boolean equals(Object o) { Objects.equals(this.idempotencyKeys, modelsUpdateSource.idempotencyKeys) && Objects.equals(this.isDisabled, modelsUpdateSource.isDisabled) && Objects.equals(this.name, modelsUpdateSource.name) && + Objects.equals(this.provider, modelsUpdateSource.provider) && Objects.equals(this.pubSub, modelsUpdateSource.pubSub) && Objects.equals(this.type, modelsUpdateSource.type) && Objects.equals(this.verifier, modelsUpdateSource.verifier); @@ -407,7 +438,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(bodyFunction, customResponse, eventTypeLocation, forwardHeaders, headerFunction, idempotencyKeys, isDisabled, name, pubSub, type, verifier); + return Objects.hash(bodyFunction, customResponse, eventTypeLocation, forwardHeaders, headerFunction, idempotencyKeys, isDisabled, name, provider, pubSub, type, verifier); } @Override @@ -422,6 +453,7 @@ public String toString() { sb.append(" idempotencyKeys: ").append(toIndentedString(idempotencyKeys)).append("\n"); sb.append(" isDisabled: ").append(toIndentedString(isDisabled)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" provider: ").append(toIndentedString(provider)).append("\n"); sb.append(" pubSub: ").append(toIndentedString(pubSub)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" verifier: ").append(toIndentedString(verifier)).append("\n"); @@ -517,6 +549,11 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%sname%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getName())))); } + // add `provider` to the URL query string + if (getProvider() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sprovider%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getProvider())))); + } + // add `pub_sub` to the URL query string if (getPubSub() != null) { joiner.add(getPubSub().toUrlQueryString(prefix + "pub_sub" + suffix)); diff --git a/src/test/java/com/getconvoy/api/DeliveryAttemptsApiContractTest.java b/src/test/java/com/getconvoy/api/DeliveryAttemptsApiContractTest.java new file mode 100644 index 0000000..d8ad664 --- /dev/null +++ b/src/test/java/com/getconvoy/api/DeliveryAttemptsApiContractTest.java @@ -0,0 +1,180 @@ +package com.getconvoy.api; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.getconvoy.client.ApiClient; +import com.getconvoy.client.ApiException; +import com.getconvoy.client.JSON; +import com.getconvoy.models.DatastoreDeliveryAttempt; +import com.getconvoy.models.DeliveryAttemptList; +import com.getconvoy.models.GetDeliveryAttempts200Response; +import com.getconvoy.models.GetDeliveryAttempts200ResponseAllOfDataOneOf; +import com.sun.net.httpserver.HttpServer; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** Offline coverage of both server response shapes, including typed array items. */ +class DeliveryAttemptsApiContractTest { + private static final String PATH = "/api/v1/projects/proj-1/eventdeliveries/delivery-1/deliveryattempts"; + private static final String ATTEMPTS = "[{\"uid\":\"attempt-1\",\"http_status\":\"200\"}," + + "{\"uid\":\"attempt-2\",\"http_status\":\"500\"}]"; + + private final ObjectMapper mapper = JSON.getDefault().getMapper(); + private final AtomicReference responseData = new AtomicReference<>("[]"); + private final AtomicReference requestUri = new AtomicReference<>(); + private final AtomicReference requestMethod = new AtomicReference<>(); + private final AtomicReference requestAuth = new AtomicReference<>(); + private HttpServer server; + private DeliveryAttemptsApi api; + private EventDeliveriesApi eventDeliveries; + + @BeforeEach + void startServer() throws Exception { + server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0); + server.createContext("/", exchange -> { + requestUri.set(exchange.getRequestURI()); + requestMethod.set(exchange.getRequestMethod()); + requestAuth.set(exchange.getRequestHeaders().getFirst("Authorization")); + byte[] body = ("{\"status\":true,\"message\":\"ok\",\"data\":" + + responseData.get() + "}").getBytes(StandardCharsets.UTF_8); + exchange.getResponseHeaders().set("Content-Type", "application/json"); + exchange.sendResponseHeaders(200, body.length); + try (OutputStream out = exchange.getResponseBody()) { + out.write(body); + } + }); + server.start(); + ApiClient client = new ApiClient(); + client.updateBaseUri("http://127.0.0.1:" + server.getAddress().getPort() + "/api"); + client.setRequestInterceptor(b -> b.header("Authorization", "Bearer test-key")); + api = new DeliveryAttemptsApi(client); + eventDeliveries = new EventDeliveriesApi(client); + } + + @AfterEach + void stopServer() { + server.stop(0); + } + + @Test + void defaultResponseIsATypedArrayAndOmitsOptionalQueryParameters() throws Exception { + responseData.set(ATTEMPTS); + GetDeliveryAttempts200Response response = api.getDeliveryAttempts("proj-1", "delivery-1"); + + assertRequest(); + assertNull(requestUri.get().getRawQuery()); + DeliveryAttemptList attempts = assertInstanceOf(DeliveryAttemptList.class, response.getData()); + assertEquals(2, attempts.size()); + assertInstanceOf(DatastoreDeliveryAttempt.class, attempts.get(0)); + assertEquals("attempt-1", attempts.get(0).getUid()); + assertEquals("attempt-2", attempts.get(1).getUid()); + assertEquals("500", attempts.get(1).getHttpStatus()); + assertNull(response.getPage()); + assertRoundTrip(response, true); + } + + @Test + void emptyDefaultResponseStaysAnArrayWithExplicitFalse() throws Exception { + GetDeliveryAttempts200Response response = api.getDeliveryAttempts("proj-1", "delivery-1", false, null); + + assertRequest(); + assertEquals("paginated=false", requestUri.get().getRawQuery()); + assertTrue(response.getData().isEmpty()); + assertRoundTrip(response, true); + } + + @Test + void paginatedResponseKeepsTypedContentAndCursor() throws Exception { + responseData.set("{\"content\":" + ATTEMPTS + ",\"next_cursor\":\"older-attempt\"}"); + GetDeliveryAttempts200Response response = api.getDeliveryAttempts("proj-1", "delivery-1", true, "cursor/with+symbols="); + + assertRequest(); + assertEquals("paginated=true&before=cursor%2Fwith%2Bsymbols%3D", requestUri.get().getRawQuery()); + GetDeliveryAttempts200ResponseAllOfDataOneOf page = assertInstanceOf( + GetDeliveryAttempts200ResponseAllOfDataOneOf.class, response.getPage()); + assertEquals(2, page.getContent().size()); + assertInstanceOf(DatastoreDeliveryAttempt.class, page.getContent().get(0)); + assertEquals("attempt-1", page.getContent().get(0).getUid()); + assertEquals("older-attempt", page.getNextCursor()); + assertEquals(page.getContent(), response.getData()); + assertRoundTrip(response, false); + } + + @Test + void emptyLastPageKeepsEmptyCursorAndContent() throws Exception { + responseData.set("{\"content\":[],\"next_cursor\":\"\"}"); + GetDeliveryAttempts200Response response = api.getDeliveryAttempts("proj-1", "delivery-1", true, null); + + assertRequest(); + assertEquals("paginated=true", requestUri.get().getRawQuery()); + GetDeliveryAttempts200ResponseAllOfDataOneOf page = + response.getPage(); + assertTrue(page.getContent().isEmpty()); + assertEquals("", page.getNextCursor()); + assertRoundTrip(response, false); + } + + @Test + void singleAttemptStillUsesTheDetailRoute() throws Exception { + responseData.set("{\"uid\":\"attempt-1\"}"); + + assertEquals("attempt-1", api.getDeliveryAttempt("proj-1", "delivery-1", "attempt-1").getData().getUid()); + assertEquals(PATH + "/attempt-1", requestUri.get().getPath()); + assertNull(requestUri.get().getRawQuery()); + } + + @Test + void invalidScalarResponseIsRejected() { + responseData.set("42"); + assertThrows(ApiException.class, () -> api.getDeliveryAttempts("proj-1", "delivery-1", null, null)); + } + + @Test + void explicitNullDataRemainsNull() throws Exception { + responseData.set("null"); + GetDeliveryAttempts200Response response = api.getDeliveryAttempts("proj-1", "delivery-1"); + assertNull(response.getData()); + assertNull(response.getPage()); + } + + @Test + void legacyBatchRetrySendsPaginationAndNoNewFilters() throws Exception { + responseData.set("null"); + eventDeliveries.batchRetryEventDelivery("proj-1", null, null, null, null, null, + null, "cursor", 25, null, null, null, null, null, null); + + assertEquals("POST", requestMethod.get()); + assertEquals("/api/v1/projects/proj-1/eventdeliveries/batchretry", requestUri.get().getPath()); + assertEquals("next_page_cursor=cursor&perPage=25", requestUri.get().getRawQuery()); + } + + private void assertRequest() { + assertEquals("GET", requestMethod.get()); + assertEquals(PATH, requestUri.get().getPath()); + assertEquals("Bearer test-key", requestAuth.get()); + } + + private void assertRoundTrip(GetDeliveryAttempts200Response response, boolean isArray) throws Exception { + String serialized = mapper.writeValueAsString(response); + JsonNode data = mapper.readTree(serialized).path("data"); + assertEquals(isArray, data.isArray()); + GetDeliveryAttempts200Response reparsed = mapper.readValue(serialized, GetDeliveryAttempts200Response.class); + assertEquals(response.getData(), reparsed.getData()); + assertEquals(response.getPage(), reparsed.getPage()); + if (!isArray) { + assertEquals(mapper.readTree(responseData.get()).path("next_cursor"), data.path("next_cursor")); + } + } +} diff --git a/src/test/java/com/getconvoy/models/DeliveryAttemptListTest.java b/src/test/java/com/getconvoy/models/DeliveryAttemptListTest.java new file mode 100644 index 0000000..69780b1 --- /dev/null +++ b/src/test/java/com/getconvoy/models/DeliveryAttemptListTest.java @@ -0,0 +1,29 @@ +package com.getconvoy.models; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import org.junit.jupiter.api.Test; + +class DeliveryAttemptListTest { + @Test + void generatedArrayAliasPreservesTheListEqualityAndHashContract() { + DeliveryAttemptList alias = new DeliveryAttemptList(); + List ordinary = new ArrayList<>(); + assertEquals(ordinary, alias); + assertEquals(alias, ordinary); + assertEquals(ordinary.hashCode(), alias.hashCode()); + + DatastoreDeliveryAttempt attempt = new DatastoreDeliveryAttempt().uid("attempt-1"); + alias.add(attempt); + ordinary.add(attempt); + assertEquals(ordinary, alias); + assertEquals(alias, ordinary); + assertEquals(ordinary.hashCode(), alias.hashCode()); + assertTrue(new HashSet<>(List.of(ordinary)).contains(alias)); + assertTrue(new HashSet<>(List.of(alias)).contains(ordinary)); + } +}