From bc1e0bab0c2e58711768e7563cd44df3607a65ad Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Mon, 20 Oct 2025 22:03:53 +0200 Subject: [PATCH 01/24] v1.1 --- .gitignore | 4 +- README.md | 250 ++++------ pom.xml | 9 +- .../java/com/regexsolver/api/RegexSolver.java | 4 + .../api/RegexSolverApiWrapper.java | 185 +++++-- .../java/com/regexsolver/api/Request.java | 139 +++++- .../java/com/regexsolver/api/Response.java | 12 + .../com/regexsolver/api/ResponseContent.java | 2 + src/main/java/com/regexsolver/api/Term.java | 458 ++++++++++++++++-- .../com/regexsolver/api/dto/Cardinality.java | 6 +- .../java/com/regexsolver/api/dto/Length.java | 58 ++- .../com/regexsolver/api/IntegrationTest.java | 213 ++++++++ .../regexsolver/api/TermOperationTest.java | 162 ------- .../resources/response_generateStrings.json | 9 - src/test/resources/response_getDetails.json | 13 - src/test/resources/response_intersection.json | 4 - .../resources/response_isEquivalentTo.json | 4 - src/test/resources/response_isSubsetOf.json | 4 - src/test/resources/response_subtraction.json | 4 - src/test/resources/response_union.json | 4 - 20 files changed, 1088 insertions(+), 456 deletions(-) create mode 100644 src/test/java/com/regexsolver/api/IntegrationTest.java delete mode 100644 src/test/resources/response_generateStrings.json delete mode 100644 src/test/resources/response_getDetails.json delete mode 100644 src/test/resources/response_intersection.json delete mode 100644 src/test/resources/response_isEquivalentTo.json delete mode 100644 src/test/resources/response_isSubsetOf.json delete mode 100644 src/test/resources/response_subtraction.json delete mode 100644 src/test/resources/response_union.json diff --git a/.gitignore b/.gitignore index b425f09..2f11247 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,6 @@ build/ .vscode/ ### Mac OS ### -.DS_Store \ No newline at end of file +.DS_Store + +.env \ No newline at end of file diff --git a/README.md b/README.md index c9fb093..d73a5ae 100644 --- a/README.md +++ b/README.md @@ -2,10 +2,7 @@ [Homepage](https://regexsolver.com) | [Online Demo](https://regexsolver.com/demo) | [Documentation](https://docs.regexsolver.com) | [Developer Console](https://console.regexsolver.com) -This repository contains the source code of the Java library for [RegexSolver](https://regexsolver.com) API. - -RegexSolver is a powerful regular expression manipulation toolkit, that gives you the power to manipulate regex as if -they were sets. +**RegexSolver** is a powerful toolkit for building, combining, and analyzing regular expressions. It is designed for constraint solvers, test generators, and other systems that need advanced regex operations. ## Installation @@ -19,205 +16,154 @@ they were sets. com.regexsolver.api RegexSolver - 1.0.2 + 1.1.0 ``` ### Gradle ```groovy -implementation "com.regexsolver.api:RegexSolver:1.0.2" +implementation "com.regexsolver.api:RegexSolver:1.1.0" ``` ## Usage -In order to use the library you need to generate an API Token on -our [Developer Console](https://console.regexsolver.com/). - -```java -import com.regexsolver.api.RegexSolver; -import com.regexsolver.api.Term; -import com.regexsolver.api.exception.ApiError; - -import java.io.IOException; - -public class Main { - public static void main(String[] args) throws IOException, ApiError { - RegexSolver.initialize("YOUR TOKEN HERE"); - - Term term1 = Term.regex("(abc|de|fg){2,}"); - Term term2 = Term.regex("de.*"); - Term term3 = Term.regex(".*abc"); - - Term term4 = Term.regex(".+(abc|de).+"); - - Term result = term1.intersection(term2, term3) - .subtraction(term4); - - System.out.println(result); - } -} -``` - -## Features - -- [Intersection](#intersection) -- [Union](#union) -- [Subtraction / Difference](#subtraction--difference) -- [Equivalence](#equivalence) -- [Subset](#subset) -- [Details](#details) -- [Generate Strings](#generate-strings) - -### Intersection - -#### Request - -Compute the intersection of the provided terms and return the resulting term. - -The maximum number of terms is currently limited to 10. +1. Create an API token in the [Developer Console](https://console.regexsolver.com/). +2. Initialize the client and start working with terms: ```java -Term.Regex term1 = Term.regex("(abc|de){2}"); -Term.Regex term2 = Term.regex("de.*"); -Term.Regex term3 = Term.regex(".*abc"); +// Set REGEXSOLVER_API_TOKEN in your env and call initialize(), +// or pass the token directly: +RegexSolver.initialize(); // or RegexSolver.initialize("YOUR_API_TOKEN"); -Term result = term1.intersection(term2, term3); -System.out.println(result); -``` - -#### Response +Term term1 = Term.regex("(abc|de|fg){2,}"); +Term term2 = Term.regex("de.*"); +Term term3 = Term.regex(".*abc"); -``` -regex=deabc +Term result = term1.intersection(term2, term3) + .difference(Term.regex(".+(abc|de).+")); +System.out.println(result.getPattern()); // de(fg)*abc ``` -### Union -Compute the union of the provided terms and return the resulting term. - -The maximum number of terms is currently limited to 10. - -#### Request - -```java -Term.Regex term1 = Term.regex("abc"); -Term.Regex term2 = Term.regex("de"); -Term.Regex term3 = Term.regex("fghi"); - -Term result = term1.union(term2, term3); -System.out.println(result); -``` +## Key Concepts & Limitations -#### Response +RegexSolver supports a subset of regular expressions that adhere to the principles of regular languages. Here are the key characteristics and limitations of the regular expressions supported by RegexSolver: +- **Anchored Expressions:** All regular expressions in RegexSolver are anchored. This means that the expressions are treated as if they start and end at the boundaries of the input text. For example, the expression `abc` will match the string "abc" but not "xabc" or "abcx". +- **Lookahead/Lookbehind:** RegexSolver does not support lookahead (`(?=...)`) or lookbehind (`(?<=...)`) assertions. Using them returns an error. +- **Pure Regular Expressions:** RegexSolver focuses on pure regular expressions as defined in regular language theory. This means features that extend beyond regular languages, such as backreferences (`\1`, `\2`, etc.), are not supported. Any use of backreference would return an error. +- **Greedy/Ungreedy Quantifiers:** The concept of ungreedy (`*?`, `+?`, `??`) quantifiers is not supported. All quantifiers are treated as greedy. For example, `a*` or `a*?` will match the longest possible sequence of "a"s. +- **Line Feed and Dot:** RegexSolver handles all characters the same way. The dot `.` matches any Unicode character including line feed (`\n`). +- **Empty Regular Expressions:** The empty language (matches no string) is represented by constructs like `[]` (empty character class). This is distinct from the empty string. -``` -regex=(abc|de|fghi) -``` -### Subtraction / Difference +## Response Formats -Compute the first term minus the second and return the resulting term. +The API can handle terms in two formats: +- `regex`: a regular expression pattern +- `fair`: FAIR (Fast Automaton Internal Representation), a stable, signed format used internally by the engine -#### Request +By default, the engine returns whatever the operation produces, with no extra convertion. Override with `responseFormat`: ```java -Term.Regex term1 = Term.regex("(abc|de)"); -Term.Regex term2 = Term.regex("de"); - -Term result = term1.subtraction(term2); -System.out.println(result); -``` +import com.regexsolver.Term; +import com.regexsolver.ResponseFormat; -#### Response - -``` -regex=abc -``` +Term term = Term.regex("abcde"); -### Equivalence +OperationOptions operationOptions = OperationOptions.init() + .responseFormat(ResponseFormat.REGEX); +Term result1 = term.union(operationOptions, Term.regex("de")); -Analyze if the two provided terms are equivalent. +System.out.println(result1.toString()); // regex=(abc)?de -#### Request +operationOptions = OperationOptions.init() + .responseFormat(ResponseFormat.FAIR); +Term result2 = term.intersection(operationOptions, Term.regex("de.*")); -```java -Term.Regex term1 = Term.regex("(abc|de)"); -Term.Fair term2 = Term.regex("(abc|de)*"); - -boolean result = term1.isEquivalentTo(term2); -System.out.println(result); +System.out.println(r2.toString()); // fair=... ``` -#### Response - -``` -false -``` +If the format does not matter, omit `responseFormat` or set it to `ResponseFormat.ANY`. -### Subset +Regardless of the format, you can always call `getPattern()` to obtain the regex pattern of a term. -Analyze if the second term is a subset of the first. +## Bounding execution time -#### Request +Set a server-side compute timeout in milliseconds with `executionTimeout`: ```java -Term.Regex term1 = Term.regex("de"); -Term.Regex term2 = Term.regex("(abc|de)"); - -boolean result = term1.isSubsetOf(term2); -System.out.println(result); +import com.regexsolver.ApiError; +import com.regexsolver.Term; + +try { + Term out = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c") + .difference(Term.regex(".*abc.*")); +} catch (ApiError e) { + System.out.println(e.getMessage()); // The operation took too much time. +} ``` -#### Response +Timeout is best effort. The exact time is not guaranteed. -``` -true -``` +## API Overview -### Details +`Term` exposes the following methods. -Compute the details of the provided term. +### Build +| Method | Return | Description | +| -------- | ------- | ------- | +| `Term.fair(String fair)` | `Term` | Creates a term from a FAIR. | +| `Term.regex(String regex)` | `Term` | Creates a term from a regex pattern. | -The computed details are: +### Analyze -- **Cardinality:** the number of possible values. -- **Length:** the minimum and maximum length of possible values. -- **Empty:** true if is an empty set (does not contain any value), false otherwise. -- **Total:** true if is a total set (contains all values), false otherwise. +| Method | Return | Description | +| -------- | ------- | ------- | +| `t.equivalent(Term term)` | `boolean` | `true` if `t` and `term` accept exactly the same language. Supports `executionTimeout`. | +| `t.getCardinality()` | `Cardinality` | Returns the cardinality of the term (i.e., the number of possible matched strings). | +| `t.getDetails()` | `Details` | Returns cardinality, length bounds, and if it is empty or total. | +| `t.getDot()` | `String` | Returns a Graphviz DOT representation of the automaton for the term. | +| `t.getFair()` | `String` | Returns the FAIR of the term if defined. | +| `t.getLength()` | `Length` | Returns the minimum and maximum length of matched strings. | +| `t.getPattern()` | `String` | Returns a regular expression pattern for the term. | +| `t.isEmpty()` | `boolean` | `true` if the term matches no string. | +| `t.isEmptyString()` | `boolean` | `true` if the term matches only the empty string. | +| `t.isTotal()` | `boolean` | `true` if the term matches all possible strings. | +| `t.subset(Term term)` | `boolean` | `true` if every string matched by `t` is also matched by `term`. Supports `executionTimeout`. | -#### Request +### Compute -```java -Term.Regex term = Term.regex("(abc|de)"); +| Method | Return | Description | +| -------- | ------- | ------- | +| `t.concat(Term... terms)` | `Term` | Concatenates `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | +| `t.difference(Term term)` | `Term` | Computes the difference `t - term`. Supports `responseFormat` and `executionTimeout`. | +| `t.intersection(Term... terms)` | `Term` | Computes the intersection of `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | +| `t.repeat(int min, Integer max)` | `Term` | Computes the repetition of the term between `min` and `max` times; if `max` is `null`, the repetition is unbounded. Supports `responseFormat` and `executionTimeout`. | +| `t.union(Term... terms)` | `Term` | Computes the union of `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | -Details details = term.getDetails(); -System.out.println(details); -``` +### Generate -#### Response +| Method | Return | Description | +| -------- | ------- | ------- | +| `t.generateStrings(int count)` | `String[]` | Generates up to `count` unique example strings matched by `t`. Supports `executionTimeout`. | -``` -Details[cardinality=Integer(2), length=Length[minimum=2, maximum=3], empty=false, total=false] -``` +### Other +| Method | Return | Description | +| -------- | ------- | ------- | +| `t.serialize()` | `String` | Returns a serialized form of `t`. | +| `Term.deserialize(String string)` | `Term` | Returns a deserialized term from the given `string`. | -### Generate Strings +## Cross-Language Support -Generate the given number of strings that can be matched by the provided term. +If you want to use this library with other programming languages, we provide: +- [regexsolver-js](https://github.com/RegexSolver/regexsolver-js) +- [regexsolver-python](https://github.com/RegexSolver/regexsolver-python) -The maximum number of strings to generate is currently limited to 200. +For more information about how to use the wrappers, you can refer to our [guide](https://docs.regexsolver.com/getting-started.html). -#### Request +You can also take a look at [regexsolver](https://github.com/RegexSolver/regexsolver) which contains the source code of the engine. -```java -Term.Regex term = Term.regex("(abc|de){2}"); - -List strings = term.generateStrings(3); -System.out.println(strings); -``` +## License -#### Response - -``` -[abcde, dede, deabc] -``` +This project is licensed under the MIT License. diff --git a/pom.xml b/pom.xml index 4f04249..e284508 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.regexsolver.api RegexSolver - 1.0.2 + 1.1.0 https://regexsolver.com @@ -17,8 +17,7 @@ https://github.com/RegexSolver/regexsolver-java - RegexSolver allows you to manipulate regular expressions as sets, enabling operations such as intersection, - union, and subtraction. + RegexSolver is a powerful toolkit for building, combining, and analyzing regular expressions. @@ -44,12 +43,12 @@ com.squareup.retrofit2 retrofit - 2.11.0 + 2.12.0 com.squareup.retrofit2 converter-jackson - 2.11.0 + 2.12.0 junit diff --git a/src/main/java/com/regexsolver/api/RegexSolver.java b/src/main/java/com/regexsolver/api/RegexSolver.java index 97e2ea7..612b0de 100644 --- a/src/main/java/com/regexsolver/api/RegexSolver.java +++ b/src/main/java/com/regexsolver/api/RegexSolver.java @@ -1,6 +1,10 @@ package com.regexsolver.api; public final class RegexSolver { + public static void initialize() { + RegexSolverApiWrapper.initialize(); + } + public static void initialize(String token) { RegexSolverApiWrapper.initialize(token); } diff --git a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java b/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java index 6f1f050..1facd0a 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java +++ b/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java @@ -3,9 +3,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.regexsolver.api.Request.GenerateStringsRequest; import com.regexsolver.api.Request.MultiTermsRequest; +import com.regexsolver.api.Request.RepeatRequest; import com.regexsolver.api.Response.BooleanResponse; +import com.regexsolver.api.Response.StringResponse; import com.regexsolver.api.Response.StringsResponse; +import com.regexsolver.api.dto.Cardinality; import com.regexsolver.api.dto.Details; +import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; import com.regexsolver.api.exception.MissingAPITokenException; import okhttp3.OkHttpClient; @@ -21,13 +25,14 @@ import java.io.IOException; import java.util.List; import java.util.Objects; +import java.util.Optional; final class RegexSolverApiWrapper { private static final RegexSolverApiWrapper INSTANCE = new RegexSolverApiWrapper(); private final static String DEFAULT_BASE_URL = "https://api.regexsolver.com/"; - private final static String USER_AGENT = "RegexSolver Java / 1.0.2"; + private final static String USER_AGENT = "RegexSolver Java / 1.1.0"; private RegexApi api; @@ -39,8 +44,16 @@ private RegexSolverApiWrapper() { initializeInternal(null, DEFAULT_BASE_URL); } + private static String getConfiguredBaseUrl() { + return Optional.ofNullable(System.getenv("REGEXSOLVER_BASE_URL")).orElse(DEFAULT_BASE_URL); + } + + static void initialize() { + getInstance().initializeInternal(System.getenv("REGEXSOLVER_API_TOKEN"), getConfiguredBaseUrl()); + } + static void initialize(String token) { - getInstance().initializeInternal(token, DEFAULT_BASE_URL); + getInstance().initializeInternal(token, getConfiguredBaseUrl()); } static void initialize(String token, String baseUrl) { @@ -66,8 +79,10 @@ private void initializeInternal(String token, String baseUrl) { api = retrofit.create(RegexApi.class); } - public Term computeIntersection(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeIntersection(multiTermsRequest).execute(); + // Analyze + + public Cardinality analyzeCardinality(Term term) throws ApiError, IOException { + Response response = api.analyzeCardinality(term).execute(); if (response.isSuccessful()) { return response.body(); } else { @@ -75,8 +90,8 @@ public Term computeIntersection(MultiTermsRequest multiTermsRequest) throws ApiE } } - public Term computeUnion(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeUnion(multiTermsRequest).execute(); + public Details analyzeDetails(Term term) throws ApiError, IOException { + Response
response = api.analyzeDetails(term).execute(); if (response.isSuccessful()) { return response.body(); } else { @@ -84,17 +99,44 @@ public Term computeUnion(MultiTermsRequest multiTermsRequest) throws ApiError, I } } - public Term computeSubtraction(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeSubtraction(multiTermsRequest).execute(); + public String analyzeDot(Term term) throws ApiError, IOException { + Response response = api.analyzeDot(term).execute(); if (response.isSuccessful()) { - return response.body(); + return response.body().value(); + } else { + throw getApiError(response); + } + } + + public boolean analyzeEquivalent(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.analyzeEquivalent(multiTermsRequest).execute(); + if (response.isSuccessful()) { + return response.body().value(); + } else { + throw getApiError(response); + } + } + + public boolean analyzeEmpty(Term term) throws ApiError, IOException { + Response response = api.analyzeEmpty(term).execute(); + if (response.isSuccessful()) { + return response.body().value(); } else { throw getApiError(response); } } - public Details getDetails(Term term) throws ApiError, IOException { - Response
response = api.getDetails(term).execute(); + public boolean analyzeEmptyString(Term term) throws ApiError, IOException { + Response response = api.analyzeEmptyString(term).execute(); + if (response.isSuccessful()) { + return response.body().value(); + } else { + throw getApiError(response); + } + } + + public Length analyzeLength(Term term) throws ApiError, IOException { + Response response = api.analyzeLength(term).execute(); if (response.isSuccessful()) { return response.body(); } else { @@ -102,8 +144,8 @@ public Details getDetails(Term term) throws ApiError, IOException { } } - public boolean equivalence(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.equivalence(multiTermsRequest).execute(); + public String analyzePattern(Term term) throws ApiError, IOException { + Response response = api.analyzePattern(term).execute(); if (response.isSuccessful()) { return response.body().value(); } else { @@ -111,8 +153,8 @@ public boolean equivalence(MultiTermsRequest multiTermsRequest) throws ApiError, } } - public boolean subset(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.subset(multiTermsRequest).execute(); + public boolean analyzeSubset(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.analyzeSubset(multiTermsRequest).execute(); if (response.isSuccessful()) { return response.body().value(); } else { @@ -120,8 +162,65 @@ public boolean subset(MultiTermsRequest multiTermsRequest) throws ApiError, IOEx } } - public List generateStrings(Term term, int count) throws ApiError, IOException { - GenerateStringsRequest generateStringsRequest = new GenerateStringsRequest(term, count); + public boolean analyzeTotal(Term term) throws ApiError, IOException { + Response response = api.analyzeTotal(term).execute(); + if (response.isSuccessful()) { + return response.body().value(); + } else { + throw getApiError(response); + } + } + + // Compute + + public Term computeConcat(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.computeConcat(multiTermsRequest).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + throw getApiError(response); + } + } + + public Term computeDifference(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.computeDifference(multiTermsRequest).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + throw getApiError(response); + } + } + + public Term computeIntersection(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.computeIntersection(multiTermsRequest).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + throw getApiError(response); + } + } + + public Term computeRepeat(RepeatRequest repeatRequest) throws ApiError, IOException { + Response response = api.computeRepeat(repeatRequest).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + throw getApiError(response); + } + } + + public Term computeUnion(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { + Response response = api.computeUnion(multiTermsRequest).execute(); + if (response.isSuccessful()) { + return response.body(); + } else { + throw getApiError(response); + } + } + + // Generate + + public List generateStrings(GenerateStringsRequest generateStringsRequest) throws ApiError, IOException { Response response = api.generateStrings(generateStringsRequest).execute(); if (response.isSuccessful()) { return response.body().value(); @@ -140,24 +239,54 @@ private static ApiError getApiError(Response response) throws IOException } private interface RegexApi { - @POST("api/compute/intersection") - Call computeIntersection(@Body MultiTermsRequest multiTermsRequest); + // analyze + @POST("api/analyze/cardinality") + Call analyzeCardinality(@Body Term term); - @POST("api/compute/union") - Call computeUnion(@Body MultiTermsRequest multiTermsRequest); + @POST("api/analyze/details") + Call
analyzeDetails(@Body Term term); - @POST("api/compute/subtraction") - Call computeSubtraction(@Body MultiTermsRequest multiTermsRequest); + @POST("api/analyze/dot") + Call analyzeDot(@Body Term term); - @POST("api/analyze/details") - Call
getDetails(@Body Term term); + @POST("api/analyze/equivalent") + Call analyzeEquivalent(@Body MultiTermsRequest multiTermsRequest); + + @POST("api/analyze/empty") + Call analyzeEmpty(@Body Term term); - @POST("api/analyze/equivalence") - Call equivalence(@Body MultiTermsRequest multiTermsRequest); + @POST("api/analyze/empty_string") + Call analyzeEmptyString(@Body Term term); + + @POST("api/analyze/length") + Call analyzeLength(@Body Term term); + + @POST("api/analyze/pattern") + Call analyzePattern(@Body Term term); @POST("api/analyze/subset") - Call subset(@Body MultiTermsRequest multiTermsRequest); + Call analyzeSubset(@Body MultiTermsRequest multiTermsRequest); + + @POST("api/analyze/total") + Call analyzeTotal(@Body Term term); + + // compute + @POST("api/compute/concat") + Call computeConcat(@Body MultiTermsRequest multiTermsRequest); + + @POST("api/compute/difference") + Call computeDifference(@Body MultiTermsRequest multiTermsRequest); + + @POST("api/compute/intersection") + Call computeIntersection(@Body MultiTermsRequest multiTermsRequest); + + @POST("api/compute/repeat") + Call computeRepeat(@Body RepeatRequest repeatRequest); + + @POST("api/compute/union") + Call computeUnion(@Body MultiTermsRequest multiTermsRequest); + // generate @POST("api/generate/strings") Call generateStrings(@Body GenerateStringsRequest request); } diff --git a/src/main/java/com/regexsolver/api/Request.java b/src/main/java/com/regexsolver/api/Request.java index cdd3a71..e252b9a 100644 --- a/src/main/java/com/regexsolver/api/Request.java +++ b/src/main/java/com/regexsolver/api/Request.java @@ -1,33 +1,158 @@ package com.regexsolver.api; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; final class Request { + @JsonInclude(JsonInclude.Include.NON_NULL) + static final class RequestOptions { + private final ResponseOptions response; + private final ExecutionOptions execution; - public static final class MultiTermsRequest { + public static RequestOptions fromArgs( + ResponseFormat format, + Integer timeout) { + + ResponseOptions response = null; + if (format != null) { + response = new ResponseOptions(format); + } + + ExecutionOptions execution = null; + if (timeout != null) { + execution = new ExecutionOptions(timeout); + } + + if (response == null && execution == null) { + return null; + } else { + return new RequestOptions(response, execution); + } + } + + public RequestOptions( + @JsonProperty("response") ResponseOptions response, + @JsonProperty("execution") ExecutionOptions execution) { + this.response = response; + this.execution = execution; + } + + public int getSchemaVersion() { + return 1; + } + + public ResponseOptions getResponse() { + return response; + } + + public ExecutionOptions getExecution() { + return execution; + } + + public static final class ResponseOptions { + private final ResponseFormat format; + + public ResponseOptions(@JsonProperty("format") ResponseFormat format) { + this.format = format; + } + + public ResponseFormat getFormat() { + return format; + } + } + + public static final class ExecutionOptions { + private final Integer timeout; + + public ExecutionOptions(@JsonProperty("timeout") Integer timeout) { + this.timeout = timeout; + } + + public Integer getTimeout() { + return timeout; + } + } + + public enum ResponseFormat { + @JsonProperty("any") + ANY, + @JsonProperty("regex") + REGEX, + @JsonProperty("fair") + FAIR + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + static final class MultiTermsRequest { private final List terms; + private final RequestOptions options; - public MultiTermsRequest(@JsonProperty("terms") List terms) { + public MultiTermsRequest(@JsonProperty("terms") List terms, + @JsonProperty("options") RequestOptions options) { this.terms = terms; + this.options = options; } public List getTerms() { return terms; } + + public RequestOptions getOptions() { + return options; + } + } + + @JsonInclude(JsonInclude.Include.NON_NULL) + static final class RepeatRequest { + private final Term term; + private final int min; + private final Integer max; + private final RequestOptions options; + + public RepeatRequest( + @JsonProperty("term") Term term, + @JsonProperty("min") int min, + @JsonProperty("max") Integer max, + @JsonProperty("options") RequestOptions options) { + this.term = term; + this.min = min; + this.max = max; + this.options = options; + } + + public Term getTerm() { + return term; + } + + public int getMin() { + return min; + } + + public Integer getMax() { + return max; + } + + public RequestOptions getOptions() { + return options; + } } - public static final class GenerateStringsRequest { + @JsonInclude(JsonInclude.Include.NON_NULL) + static final class GenerateStringsRequest { private final Term term; private final int count; + private final RequestOptions options; public GenerateStringsRequest( @JsonProperty("term") Term term, - @JsonProperty("count") int count - ) { + @JsonProperty("count") int count, + @JsonProperty("options") RequestOptions options) { this.term = term; this.count = count; + this.options = options; } public Term getTerm() { @@ -37,5 +162,9 @@ public Term getTerm() { public int getCount() { return count; } + + public RequestOptions getOptions() { + return options; + } } } diff --git a/src/main/java/com/regexsolver/api/Response.java b/src/main/java/com/regexsolver/api/Response.java index 5675052..27ed766 100644 --- a/src/main/java/com/regexsolver/api/Response.java +++ b/src/main/java/com/regexsolver/api/Response.java @@ -17,6 +17,18 @@ public boolean value() { } } + public static final class StringResponse implements ResponseContent { + private final String value; + + public StringResponse(@JsonProperty("value") String value) { + this.value = value; + } + + public String value() { + return value; + } + } + public static final class StringsResponse implements ResponseContent { private final List value; diff --git a/src/main/java/com/regexsolver/api/ResponseContent.java b/src/main/java/com/regexsolver/api/ResponseContent.java index a7ff289..ea37121 100644 --- a/src/main/java/com/regexsolver/api/ResponseContent.java +++ b/src/main/java/com/regexsolver/api/ResponseContent.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.regexsolver.api.Response.BooleanResponse; +import com.regexsolver.api.Response.StringResponse; import com.regexsolver.api.Response.StringsResponse; import com.regexsolver.api.dto.Details; @@ -11,6 +12,7 @@ @JsonSubTypes.Type(value = Term.Fair.class, name = "fair"), @JsonSubTypes.Type(value = Term.Regex.class, name = "regex"), @JsonSubTypes.Type(value = Details.class, name = "details"), + @JsonSubTypes.Type(value = StringResponse.class, name = "string"), @JsonSubTypes.Type(value = StringsResponse.class, name = "strings"), @JsonSubTypes.Type(value = BooleanResponse.class, name = "boolean"), }) diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 3673670..1556d21 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -2,8 +2,14 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import com.regexsolver.api.Request.GenerateStringsRequest; import com.regexsolver.api.Request.MultiTermsRequest; +import com.regexsolver.api.Request.RepeatRequest; +import com.regexsolver.api.Request.RequestOptions; +import com.regexsolver.api.Request.RequestOptions.ResponseFormat; +import com.regexsolver.api.dto.Cardinality; import com.regexsolver.api.dto.Details; +import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; import java.io.IOException; @@ -13,7 +19,8 @@ import java.util.Optional; /** - * This abstract class represents a term on which it is possible to perform operations. + * This abstract class represents a term on which it is possible to perform + * operations. */ public abstract class Term implements ResponseContent { @JsonIgnore @@ -30,6 +37,20 @@ public abstract class Term implements ResponseContent { @JsonIgnore private transient Details details; + @JsonIgnore + private transient Cardinality cardinality; + @JsonIgnore + private transient Length length; + @JsonIgnore + private transient Boolean empty; + @JsonIgnore + private transient Boolean total; + @JsonIgnore + private transient Boolean emptyString; + @JsonIgnore + private transient String pattern; + @JsonIgnore + private transient String dot; /** * Create a new instance. @@ -60,13 +81,75 @@ public static Term.Fair fair(String fair) { return new Term.Fair(fair); } - String getValue() { + public String getValue() { return value; } + private static RequestOptions loadRequestOptions(OperationOptions opts) { + RequestOptions requestOptions = null; + if (opts != null) { + requestOptions = RequestOptions.fromArgs(opts.responseFormat, opts.executionTimeout); + } + return requestOptions; + } + + // Analyze + + /** + * Check equivalence with the given term. + * + * @param opts Execution options. + * @param term The term to check equivalence with. + * @return true if the terms are equivalent, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean equivalent(OperationOptions opts, Term term) throws IOException, ApiError { + return RegexSolverApiWrapper.getInstance() + .analyzeEquivalent(new MultiTermsRequest(getArgs(term), + loadRequestOptions(opts))); + } + + /** + * Check equivalence with the given term. + * + * @param term The term to check equivalence with. + * @return true if the terms are equivalent, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean equivalent(Term term) throws IOException, ApiError { + return equivalent(null, term); + } + + /** + * Get the cardinality of this term. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return A `Cardinality` object describing how many distinct strings are + * matched. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Cardinality getCardinality() throws IOException, ApiError { + if (cardinality != null) { + return cardinality; + } else if (details != null) { + return details.getCardinality(); + } + cardinality = RegexSolverApiWrapper.getInstance() + .analyzeCardinality(this); + return cardinality; + } + /** * Get the details of this term. - * Cache the result to avoid calling the API again if this method is called multiple times. + * Cache the result to avoid calling the API again if this method is called + * multiple times. * * @return The details of this term. * @throws IOException In case of issues requesting the API server. @@ -77,23 +160,178 @@ public Details getDetails() throws IOException, ApiError { if (details != null) { return details; } - details = RegexSolverApiWrapper.getInstance().getDetails(this); + details = RegexSolverApiWrapper.getInstance().analyzeDetails(this); return details; } /** - * Generate the given number of unique strings matched by this term. + * Get the GraphViz DOT representation of this term. + * Cache the result to avoid calling the API again if this method is called + * multiple times. * - * @param count The number of unique strings to generate. - * @return A list of unique strings matched by this term. + * @return A DOT language string describing the automaton for this term. * @throws IOException In case of issues requesting the API server. * @throws ApiError In case of error returned by the API. */ @JsonIgnore - public List generateStrings(int count) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance().generateStrings(this, count); + public String getDot() throws IOException, ApiError { + if (dot != null) { + return dot; + } + dot = RegexSolverApiWrapper.getInstance() + .analyzeDot(this); + return dot; + } + + /** + * Return the Fast Automaton Internal Representation (FAIR). + * + * @return The FAIR. + */ + @JsonIgnore + public String getFair() throws IOException, ApiError { + return null; + } + + /** + * Get the length bounds of this term. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return A `Length` object with the minimum and maximum string length matched + * by this term. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Length getLength() throws IOException, ApiError { + if (length != null) { + return length; + } else if (details != null) { + return details.getLength(); + } + + length = RegexSolverApiWrapper.getInstance() + .analyzeLength(this); + return length; + } + + /** + * Return the regular expression pattern. + * + * If the term is not a regex the pattern will be resolved. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return The regular expression pattern. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public String getPattern() throws IOException, ApiError { + if (pattern != null) { + return pattern; + } + + pattern = RegexSolverApiWrapper.getInstance() + .analyzePattern(this); + return pattern; + } + + /** + * Check whether this term matches no string. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return true if the term is empty, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean isEmpty() throws IOException, ApiError { + if (empty != null) { + return empty; + } else if (details != null) { + return details.isEmpty(); + } + + empty = RegexSolverApiWrapper.getInstance() + .analyzeEmpty(this); + return empty; + } + + /** + * Check whether this term matches only the empty string. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return true if the term only matches the empty string, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean isEmptyString() throws IOException, ApiError { + if (emptyString != null) { + return emptyString; + } + + emptyString = RegexSolverApiWrapper.getInstance() + .analyzeEmptyString(this); + return emptyString; + } + + /** + * Check whether this term matches all possible strings. + * Cache the result to avoid calling the API again if this method is called + * multiple times. + * + * @return true if the term matches all possible strings, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean isTotal() throws IOException, ApiError { + if (total != null) { + return total; + } else if (details != null) { + return details.isTotal(); + } + + total = RegexSolverApiWrapper.getInstance() + .analyzeTotal(this); + return total; + } + + /** + * Check if is a subset of the given term. + * + * @param opts Execution options. + * @param term The term to check if is the superset of this. + * @return true if this is a subset, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean subset(OperationOptions opts, Term term) throws IOException, ApiError { + return RegexSolverApiWrapper.getInstance() + .analyzeSubset(new MultiTermsRequest(getArgs(term), loadRequestOptions(opts))); + } + + /** + * Check if is a subset of the given term. + * + * @param term The term to check if is the superset of this. + * @return true if this is a subset, false otherwise. + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public boolean subset(Term term) throws IOException, ApiError { + return subset(null, term); } + // Compute + @JsonIgnore private List getArgs(Term... terms) { ArrayList args = new ArrayList<>(); @@ -102,6 +340,77 @@ private List getArgs(Term... terms) { return args; } + /** + * Compute the concat with the given terms and return the resulting term. + * + * @param opts Execution options. + * @param terms The terms to compute an concat with. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term concat(OperationOptions opts, Term... terms) throws IOException, ApiError { + return RegexSolverApiWrapper.getInstance() + .computeConcat(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); + } + + /** + * Compute the concat with the given terms and return the resulting term. + * + * @param terms The terms to compute an concat with. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term concat(Term... terms) throws IOException, ApiError { + return concat(null, terms); + } + + /** + * Compute the difference with the given term and return the resulting term. + * + * @param opts Execution options. + * @param term The term to subtract. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term difference(OperationOptions opts, Term term) throws IOException, ApiError { + return RegexSolverApiWrapper.getInstance() + .computeDifference(new MultiTermsRequest(getArgs(term), loadRequestOptions(opts))); + } + + /** + * Compute the difference with the given term and return the resulting term. + * + * @param term The term to subtract. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term difference(Term term) throws IOException, ApiError { + return difference(null, term); + } + + /** + * Compute the intersection with the given terms and return the resulting term. + * + * @param opts Execution options. + * @param terms The terms to compute an intersection with. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term intersection(OperationOptions opts, Term... terms) throws IOException, ApiError { + return RegexSolverApiWrapper.getInstance() + .computeIntersection(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); + } + /** * Compute the intersection with the given terms and return the resulting term. * @@ -112,68 +421,104 @@ private List getArgs(Term... terms) { */ @JsonIgnore public Term intersection(Term... terms) throws IOException, ApiError { + return intersection(null, terms); + } + + /** + * Computes the repetition of the term between `min` and `max` times; if `max` + * is `null`, the repetition is unbounded. + * + * @param opts Execution options. + * @param min The lower bound of the repetition. + * @param max The upper bound of the repetition, if `null` the repetition is + * unbounded. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term repeat(OperationOptions opts, int min, Integer max) throws IOException, ApiError { return RegexSolverApiWrapper.getInstance() - .computeIntersection(new MultiTermsRequest(getArgs(terms))); + .computeRepeat(new RepeatRequest(this, min, max, loadRequestOptions(opts))); + } + + /** + * Computes the repetition of the term between `min` and `max` times; if `max` + * is `null`, the repetition is unbounded. + * + * @param min The lower bound of the repetition. + * @param max The upper bound of the repetition, if `null` the repetition is + * unbounded. + * @return The resulting term + * @throws IOException In case of issues requesting the API server. + * @throws ApiError In case of error returned by the API. + */ + @JsonIgnore + public Term repeat(int min, Integer max) throws IOException, ApiError { + return repeat(null, min, max); } /** * Compute the union with the given terms and return the resulting term. * + * @param opts Execution options. * @param terms The terms to compute a union with. * @return The resulting term * @throws IOException In case of issues requesting the API server. * @throws ApiError In case of error returned by the API. */ @JsonIgnore - public Term union(Term... terms) throws IOException, ApiError { + public Term union(OperationOptions opts, Term... terms) throws IOException, ApiError { return RegexSolverApiWrapper.getInstance() - .computeUnion(new MultiTermsRequest(getArgs(terms))); + .computeUnion(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); } /** - * Compute the subtraction with the given term and return the resulting term. + * Compute the union with the given terms and return the resulting term. * - * @param term The term to subtract. + * @param terms The terms to compute a union with. * @return The resulting term * @throws IOException In case of issues requesting the API server. * @throws ApiError In case of error returned by the API. */ @JsonIgnore - public Term subtraction(Term term) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeSubtraction(new MultiTermsRequest(getArgs(term))); + public Term union(Term... terms) throws IOException, ApiError { + return union(null, terms); } + // Generate + /** - * Check equivalence with the given term. + * Generate the given number of unique strings matched by this term. * - * @param term The term to check equivalence with. - * @return true if the terms are equivalent, false otherwise. + * @param opts Execution options. + * @param count The number of unique strings to generate. + * @return A list of unique strings matched by this term. * @throws IOException In case of issues requesting the API server. * @throws ApiError In case of error returned by the API. */ @JsonIgnore - public boolean isEquivalentTo(Term term) throws IOException, ApiError { + public List generateStrings(OperationOptions opts, int count) throws IOException, ApiError { return RegexSolverApiWrapper.getInstance() - .equivalence(new MultiTermsRequest(getArgs(term))); + .generateStrings(new GenerateStringsRequest(this, count, loadRequestOptions(opts))); } /** - * Check if is a subset of the given term. + * Generate the given number of unique strings matched by this term. * - * @param term The term to check if is the superset of this. - * @return true if this is a subset, false otherwise. + * @param count The number of unique strings to generate. + * @return A list of unique strings matched by this term. * @throws IOException In case of issues requesting the API server. * @throws ApiError In case of error returned by the API. */ @JsonIgnore - public boolean isSubsetOf(Term term) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .subset(new MultiTermsRequest(getArgs(term))); + public List generateStrings(int count) throws IOException, ApiError { + return generateStrings(null, count); } /** - * Generate a string representation that can be parsed by {@link #deserialize(String)}. + * Generate a string representation that can be parsed by + * {@link #deserialize(String)}. * * @return A string representation of this term. */ @@ -194,7 +539,8 @@ public String serialize() { } /** - * Parse a string representation of a {@link Term} produced by {@link #serialize()}. + * Parse a string representation of a {@link Term} produced by + * {@link #serialize()}. * * @param string A string representation produced by {@link #serialize()}. * @return The parsed term, or empty if the method was not able to parse. @@ -216,8 +562,10 @@ public static Optional deserialize(String string) { @Override public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; Term term = (Term) o; return Objects.equals(term.serialize(), serialize()); } @@ -235,7 +583,8 @@ public String toString() { /** * This term represents a Fast Automaton Internal Representation (FAIR). *

- * You can learn more about FAIR in our documentation. + * You can learn more about FAIR in our + * documentation. *

*/ public static final class Fair extends Term { @@ -248,22 +597,18 @@ public Fair(@JsonProperty("value") String fair) { super(fair); } - /** - * Return the Fast Automaton Internal Representation (FAIR). - * - * @return The FAIR. - */ @JsonProperty("value") + @Override public String getFair() { return getValue(); } } - /** * This term represents a regular expression. *

- * You can learn more about regular expression in our documentation + * You can learn more about regular expression in our + * documentation *

*/ public static final class Regex extends Term { @@ -276,14 +621,37 @@ public Regex(@JsonProperty("value") String regex) { super(regex); } - /** - * Return the regular expression pattern. - * - * @return The regular expression pattern. - */ @JsonProperty("value") + @Override public String getPattern() { return getValue(); } } + + public static final class OperationOptions { + private ResponseFormat responseFormat; + private Integer executionTimeout; + + public static OperationOptions init() { + return new OperationOptions(); + } + + public OperationOptions responseFormat(ResponseFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + public ResponseFormat responseFormat() { + return responseFormat; + } + + public OperationOptions executionTimeout(Integer executionTimeout) { + this.executionTimeout = executionTimeout; + return this; + } + + public Integer executionTimeout() { + return executionTimeout; + } + } } diff --git a/src/main/java/com/regexsolver/api/dto/Cardinality.java b/src/main/java/com/regexsolver/api/dto/Cardinality.java index f62261b..d4689be 100644 --- a/src/main/java/com/regexsolver/api/dto/Cardinality.java +++ b/src/main/java/com/regexsolver/api/dto/Cardinality.java @@ -9,9 +9,9 @@ */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes({ - @JsonSubTypes.Type(value = Cardinality.BigInteger.class, name = "BigInteger"), - @JsonSubTypes.Type(value = Cardinality.Infinite.class, name = "Infinite"), - @JsonSubTypes.Type(value = Cardinality.Integer.class, name = "Integer") + @JsonSubTypes.Type(value = Cardinality.BigInteger.class, name = "bigInteger"), + @JsonSubTypes.Type(value = Cardinality.Infinite.class, name = "infinite"), + @JsonSubTypes.Type(value = Cardinality.Integer.class, name = "integer") }) public abstract class Cardinality { /** diff --git a/src/main/java/com/regexsolver/api/dto/Length.java b/src/main/java/com/regexsolver/api/dto/Length.java index 3e1200f..785870e 100644 --- a/src/main/java/com/regexsolver/api/dto/Length.java +++ b/src/main/java/com/regexsolver/api/dto/Length.java @@ -1,6 +1,7 @@ package com.regexsolver.api.dto; import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -18,8 +19,10 @@ public final class Length { private final Long maximum; /** - * @param minimum the minimum length of possible values, empty if is an empty set. - * @param maximum the maximum length of possible values, empty if the maximum length is infinite or if is an empty set. + * @param minimum the minimum length of possible values, empty if is an empty + * set. + * @param maximum the maximum length of possible values, empty if the maximum + * length is infinite or if is an empty set. */ Length(Long minimum, Long maximum) { this.minimum = minimum; @@ -37,7 +40,8 @@ public OptionalLong getMinimum() { } /** - * @return The maximum length of possible values, empty if the maximum length is infinite or if is an empty set. + * @return The maximum length of possible values, empty if the maximum length is + * infinite or if is an empty set. */ public OptionalLong getMaximum() { if (maximum == null) { @@ -48,8 +52,10 @@ public OptionalLong getMaximum() { @Override public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; + if (obj == this) + return true; + if (obj == null || obj.getClass() != this.getClass()) + return false; var that = (Length) obj; return Objects.equals(this.minimum, that.minimum) && Objects.equals(this.maximum, that.maximum); @@ -71,15 +77,41 @@ static class LengthDeserializer extends JsonDeserializer { @Override public Length deserialize(JsonParser jp, DeserializationContext ctx) throws IOException { - Long[] lengthArray = jp.readValueAs(Long[].class); - if (lengthArray != null && lengthArray.length == 2) { - return new Length( - lengthArray[0], - lengthArray[1] - ); - } else { - throw new IOException("Invalid length array."); + JsonToken t = jp.currentToken(); + if (t == null) + t = jp.nextToken(); + + if (t == JsonToken.START_ARRAY) { + Long[] arr = jp.readValueAs(Long[].class); + if (arr == null || arr.length != 2) { + throw new IOException("Expected [minimum,maximum] array."); + } + return new Length(arr[0], arr[1]); + } + + if (t == JsonToken.START_OBJECT) { + Long min = null; + Long max = null; + + while (jp.nextToken() != JsonToken.END_OBJECT) { + String field = jp.currentName(); + jp.nextToken(); // move to value + if ("min".equals(field)) { + min = jp.currentToken() == JsonToken.VALUE_NULL ? null : jp.getLongValue(); + } else if ("max".equals(field)) { + max = jp.currentToken() == JsonToken.VALUE_NULL ? null : jp.getLongValue(); + } else { + jp.skipChildren(); // ignore unknown fields + } + } + return new Length(min, max); } + + if (t == JsonToken.VALUE_NULL) { + return null; + } + + throw new IOException("Expected [minimum,maximum] array, or {minimum,maximum} object."); } } } \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/IntegrationTest.java b/src/test/java/com/regexsolver/api/IntegrationTest.java new file mode 100644 index 0000000..fbac55c --- /dev/null +++ b/src/test/java/com/regexsolver/api/IntegrationTest.java @@ -0,0 +1,213 @@ +package com.regexsolver.api; + +import com.regexsolver.api.Request.RequestOptions.ResponseFormat; +import com.regexsolver.api.Term.OperationOptions; +import com.regexsolver.api.dto.Cardinality; +import com.regexsolver.api.dto.Details; +import com.regexsolver.api.dto.Length; + +import org.junit.Before; +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.*; + +public class IntegrationTest { + @Before + public void setUp() throws Exception { + RegexSolver.initialize(); + } + + // Analyze + + @Test + public void test_analyze_cardinality() throws Exception { + Term term = Term.regex("[0-4]"); + + Cardinality cardinality = term.getCardinality(); + assertEquals("Integer(5)", cardinality.toString()); + } + + @Test + public void test_analyze_details() throws Exception { + Term term = Term.regex("(abc|de)"); + Details details = term.getDetails(); + assertEquals( + "Details[cardinality=Integer(2), length=Length[minimum=2, maximum=3], empty=false, total=false]", + details.toString()); + } + + @Test + public void test_analyze_details_infinite() throws Exception { + Term term = Term.regex(".*"); + Details details = term.getDetails(); + assertEquals( + "Details[cardinality=Infinite, length=Length[minimum=0, maximum=null], empty=false, total=true]", + details.toString()); + } + + @Test + public void test_analyze_details_empty() throws Exception { + Term term = Term.regex("[]"); + Details details = term.getDetails(); + assertEquals( + "Details[cardinality=Integer(0), length=Length[minimum=null, maximum=null], empty=true, total=false]", + details.toString()); + } + + @Test + public void test_analyze_dot() throws Exception { + Term term = Term.regex("(abc|de)"); + String dot = term.getDot(); + assertTrue(dot.startsWith("digraph ")); + } + + @Test + public void test_analyze_empty_string() throws Exception { + Term term = Term.regex(""); + boolean result = term.isEmptyString(); + assertTrue(result); + } + + @Test + public void test_analyze_empty() throws Exception { + Term term = Term.regex("[]"); + boolean result = term.isEmpty(); + assertTrue(result); + } + + @Test + public void test_analyze_total() throws Exception { + Term term = Term.regex(".*"); + boolean result = term.isTotal(); + assertTrue(result); + } + + @Test + public void test_analyze_equivalent() throws Exception { + Term term1 = Term.regex("(abc|de)"); + Term term2 = Term.fair( + " strings = term.generateStrings(10); + assertEquals(4, strings.size()); + } + + // README + + @Test + public void test_readme_quickstart() throws Exception { + Term term1 = Term.regex("(abc|de|fg){2,}"); + Term term2 = Term.regex("de.*"); + Term term3 = Term.regex(".*abc"); + + Term result = term1.intersection(term2, term3) + .difference(Term.regex(".+(abc|de).+")); + assertEquals("de(fg)*abc", result.getPattern()); + } + + @Test + public void test_readme_response_format() throws Exception { + Term term = Term.regex("abcde"); + OperationOptions operationOptions = OperationOptions.init() + .responseFormat(ResponseFormat.REGEX); + Term result1 = term.union(operationOptions, Term.regex("de")); + assertEquals("regex=(abc)?de", result1.toString()); + + operationOptions = OperationOptions.init() + .responseFormat(ResponseFormat.FAIR); + Term result2 = term.intersection(operationOptions, Term.regex("de.*")); + assertTrue(result2.toString().startsWith("fair=")); + } +} \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/TermOperationTest.java b/src/test/java/com/regexsolver/api/TermOperationTest.java index c7b7549..44d4e77 100644 --- a/src/test/java/com/regexsolver/api/TermOperationTest.java +++ b/src/test/java/com/regexsolver/api/TermOperationTest.java @@ -1,18 +1,13 @@ package com.regexsolver.api; -import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Details; -import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; -import okhttp3.mockwebserver.RecordedRequest; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; -import java.util.List; import static org.junit.Assert.*; @@ -32,163 +27,6 @@ public void tearDown() throws IOException { server.shutdown(); } - @Test - public void test_getDetails() throws IOException, ApiError, InterruptedException { - int requestCount = server.getRequestCount(); - - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_getDetails.json")); - server.enqueue(response); - - Term.Regex regex = Term.regex("(abc|de)"); - - Details details = regex.getDetails(); - - Cardinality cardinality = details.getCardinality(); - assertTrue(cardinality instanceof Cardinality.Integer); - assertEquals(2, ((Cardinality.Integer) cardinality).getCount()); - - Length length = details.getLength(); - assertEquals(2L, length.getMinimum().getAsLong()); - assertEquals(3L, length.getMaximum().getAsLong()); - - assertFalse(details.isEmpty()); - assertFalse(details.isTotal()); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/analyze/details", request.getPath()); - assertEquals(regex, TestUtils.readBuffer(request.getBody(), Term.class)); - - Details detailsInCache = regex.getDetails(); - assertEquals(details, detailsInCache); - - assertEquals(1, server.getRequestCount() - requestCount); - } - - @Test - public void test_generateStrings() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_generateStrings.json")); - server.enqueue(response); - - Term.Regex regex = Term.regex("(abc|de){2}"); - - List strings = regex.generateStrings(10); - assertEquals(4, strings.size()); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/generate/strings", request.getPath()); - - Request.GenerateStringsRequest generateStringsRequest = TestUtils.readBuffer(request.getBody(), Request.GenerateStringsRequest.class); - assertEquals(10, generateStringsRequest.getCount()); - assertEquals(regex, generateStringsRequest.getTerm()); - } - - @Test - public void test_intersection() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_intersection.json")); - server.enqueue(response); - - Term.Regex term1 = Term.regex("(abc|de){2}"); - Term.Regex term2 = Term.regex("de.*"); - Term.Regex term3 = Term.regex(".*abc"); - - Term result = term1.intersection(term2, term3); - assertTrue(result instanceof Term.Regex); - assertEquals("deabc", ((Term.Regex) result).getPattern()); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/compute/intersection", request.getPath()); - - Request.MultiTermsRequest multiTermsRequest = TestUtils.readBuffer(request.getBody(), Request.MultiTermsRequest.class); - List terms = multiTermsRequest.getTerms(); - assertEquals(term1, terms.get(0)); - assertEquals(term2, terms.get(1)); - assertEquals(term3, terms.get(2)); - } - - @Test - public void test_union() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_union.json")); - server.enqueue(response); - - Term.Regex term1 = Term.regex("abc"); - Term.Regex term2 = Term.regex("de"); - Term.Regex term3 = Term.regex("fghi"); - - Term result = term1.union(term2, term3); - assertTrue(result instanceof Term.Regex); - assertEquals("(abc|de|fghi)", ((Term.Regex) result).getPattern()); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/compute/union", request.getPath()); - - Request.MultiTermsRequest multiTermsRequest = TestUtils.readBuffer(request.getBody(), Request.MultiTermsRequest.class); - List terms = multiTermsRequest.getTerms(); - assertEquals(term1, terms.get(0)); - assertEquals(term2, terms.get(1)); - assertEquals(term3, terms.get(2)); - } - - @Test - public void test_subtraction() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_subtraction.json")); - server.enqueue(response); - - Term.Regex term1 = Term.regex("(abc|de)"); - Term.Regex term2 = Term.regex("de"); - - Term result = term1.subtraction(term2); - assertTrue(result instanceof Term.Regex); - assertEquals("abc", ((Term.Regex) result).getPattern()); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/compute/subtraction", request.getPath()); - - Request.MultiTermsRequest multiTermsRequest = TestUtils.readBuffer(request.getBody(), Request.MultiTermsRequest.class); - List terms = multiTermsRequest.getTerms(); - assertEquals(term1, terms.get(0)); - assertEquals(term2, terms.get(1)); - } - - @Test - public void test_isEquivalentTo() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_isEquivalentTo.json")); - server.enqueue(response); - - Term.Regex term1 = Term.regex("(abc|de)"); - Term.Fair term2 = Term.fair("rgmsW[1g2LvP=Gr&V>sLc#w-!No&(oq@Sf>X).?lI3{uh{80qWEH[#0.pHq@B-9o[LpP-a#fYI+"); - - boolean result = term1.isEquivalentTo(term2); - assertFalse(result); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/analyze/equivalence", request.getPath()); - - Request.MultiTermsRequest multiTermsRequest = TestUtils.readBuffer(request.getBody(), Request.MultiTermsRequest.class); - List terms = multiTermsRequest.getTerms(); - assertEquals(term1, terms.get(0)); - assertEquals(term2, terms.get(1)); - } - - @Test - public void test_isSubsetOf() throws IOException, ApiError, InterruptedException { - MockResponse response = TestUtils.generateMockResponse(TestUtils.getResourceFileContent("response_isSubsetOf.json")); - server.enqueue(response); - - Term.Regex term1 = Term.regex("de"); - Term.Regex term2 = Term.regex("(abc|de)"); - - boolean result = term1.isSubsetOf(term2); - assertTrue(result); - - RecordedRequest request = server.takeRequest(); - assertEquals("/api/analyze/subset", request.getPath()); - - Request.MultiTermsRequest multiTermsRequest = TestUtils.readBuffer(request.getBody(), Request.MultiTermsRequest.class); - List terms = multiTermsRequest.getTerms(); - assertEquals(term1, terms.get(0)); - assertEquals(term2, terms.get(1)); - } - @Test public void test_errorResponse() throws IOException { MockResponse response = TestUtils.generateErrorMockResponse(TestUtils.getResourceFileContent("response_error.json"), 400); diff --git a/src/test/resources/response_generateStrings.json b/src/test/resources/response_generateStrings.json deleted file mode 100644 index 9ee8883..0000000 --- a/src/test/resources/response_generateStrings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "type": "strings", - "value": [ - "abcde", - "dede", - "deabc", - "abcabc" - ] -} \ No newline at end of file diff --git a/src/test/resources/response_getDetails.json b/src/test/resources/response_getDetails.json deleted file mode 100644 index 65e0539..0000000 --- a/src/test/resources/response_getDetails.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "type": "details", - "cardinality": { - "type": "Integer", - "value": 2 - }, - "length": [ - 2, - 3 - ], - "empty": false, - "total": false -} \ No newline at end of file diff --git a/src/test/resources/response_intersection.json b/src/test/resources/response_intersection.json deleted file mode 100644 index e6b1a7a..0000000 --- a/src/test/resources/response_intersection.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "regex", - "value": "deabc" -} \ No newline at end of file diff --git a/src/test/resources/response_isEquivalentTo.json b/src/test/resources/response_isEquivalentTo.json deleted file mode 100644 index 25147f3..0000000 --- a/src/test/resources/response_isEquivalentTo.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "boolean", - "value": false -} \ No newline at end of file diff --git a/src/test/resources/response_isSubsetOf.json b/src/test/resources/response_isSubsetOf.json deleted file mode 100644 index 84ed493..0000000 --- a/src/test/resources/response_isSubsetOf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "boolean", - "value": true -} \ No newline at end of file diff --git a/src/test/resources/response_subtraction.json b/src/test/resources/response_subtraction.json deleted file mode 100644 index 478ac72..0000000 --- a/src/test/resources/response_subtraction.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "regex", - "value": "abc" -} \ No newline at end of file diff --git a/src/test/resources/response_union.json b/src/test/resources/response_union.json deleted file mode 100644 index 27dae5e..0000000 --- a/src/test/resources/response_union.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "regex", - "value": "(abc|de|fghi)" -} \ No newline at end of file From 985bc1b9b611faecea193275ea00daa148b5ea6d Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Mon, 20 Oct 2025 22:09:41 +0200 Subject: [PATCH 02/24] some fixes --- README.md | 11 +++++++---- src/main/java/com/regexsolver/api/Request.java | 9 --------- .../java/com/regexsolver/api/ResponseFormat.java | 12 ++++++++++++ src/main/java/com/regexsolver/api/Term.java | 1 - .../java/com/regexsolver/api/IntegrationTest.java | 1 - 5 files changed, 19 insertions(+), 15 deletions(-) create mode 100644 src/main/java/com/regexsolver/api/ResponseFormat.java diff --git a/README.md b/README.md index d73a5ae..e4fe10a 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,9 @@ implementation "com.regexsolver.api:RegexSolver:1.1.0" 2. Initialize the client and start working with terms: ```java +import com.regexsolver.api.RegexSolver; +import com.regexsolver.api.Term; + // Set REGEXSOLVER_API_TOKEN in your env and call initialize(), // or pass the token directly: RegexSolver.initialize(); // or RegexSolver.initialize("YOUR_API_TOKEN"); @@ -66,8 +69,8 @@ The API can handle terms in two formats: By default, the engine returns whatever the operation produces, with no extra convertion. Override with `responseFormat`: ```java -import com.regexsolver.Term; -import com.regexsolver.ResponseFormat; +import com.regexsolver.api.Term; +import com.regexsolver.api.ResponseFormat; Term term = Term.regex("abcde"); @@ -93,8 +96,8 @@ Regardless of the format, you can always call `getPattern()` to obtain the regex Set a server-side compute timeout in milliseconds with `executionTimeout`: ```java -import com.regexsolver.ApiError; -import com.regexsolver.Term; +import com.regexsolver.api.exception.ApiError; +import com.regexsolver.api.Term; try { Term out = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c") diff --git a/src/main/java/com/regexsolver/api/Request.java b/src/main/java/com/regexsolver/api/Request.java index e252b9a..1aedbf4 100644 --- a/src/main/java/com/regexsolver/api/Request.java +++ b/src/main/java/com/regexsolver/api/Request.java @@ -74,15 +74,6 @@ public Integer getTimeout() { return timeout; } } - - public enum ResponseFormat { - @JsonProperty("any") - ANY, - @JsonProperty("regex") - REGEX, - @JsonProperty("fair") - FAIR - } } @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/src/main/java/com/regexsolver/api/ResponseFormat.java b/src/main/java/com/regexsolver/api/ResponseFormat.java new file mode 100644 index 0000000..a1aeee5 --- /dev/null +++ b/src/main/java/com/regexsolver/api/ResponseFormat.java @@ -0,0 +1,12 @@ +package com.regexsolver.api; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public enum ResponseFormat { + @JsonProperty("any") + ANY, + @JsonProperty("regex") + REGEX, + @JsonProperty("fair") + FAIR +} diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 1556d21..444dcba 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -6,7 +6,6 @@ import com.regexsolver.api.Request.MultiTermsRequest; import com.regexsolver.api.Request.RepeatRequest; import com.regexsolver.api.Request.RequestOptions; -import com.regexsolver.api.Request.RequestOptions.ResponseFormat; import com.regexsolver.api.dto.Cardinality; import com.regexsolver.api.dto.Details; import com.regexsolver.api.dto.Length; diff --git a/src/test/java/com/regexsolver/api/IntegrationTest.java b/src/test/java/com/regexsolver/api/IntegrationTest.java index fbac55c..652d5b3 100644 --- a/src/test/java/com/regexsolver/api/IntegrationTest.java +++ b/src/test/java/com/regexsolver/api/IntegrationTest.java @@ -1,6 +1,5 @@ package com.regexsolver.api; -import com.regexsolver.api.Request.RequestOptions.ResponseFormat; import com.regexsolver.api.Term.OperationOptions; import com.regexsolver.api.dto.Cardinality; import com.regexsolver.api.dto.Details; From d85592ea541cf10d88cc5105010de9a9bf640736 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Tue, 21 Oct 2025 16:46:31 +0200 Subject: [PATCH 03/24] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4fe10a..e22d87d 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ System.out.println(result1.toString()); // regex=(abc)?de operationOptions = OperationOptions.init() .responseFormat(ResponseFormat.FAIR); -Term result2 = term.intersection(operationOptions, Term.regex("de.*")); +Term result2 = term.union(operationOptions, Term.regex("de")); System.out.println(r2.toString()); // fair=... ``` From 190fd083169208add089df7507788fdbb7353aa6 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Tue, 21 Oct 2025 16:47:58 +0200 Subject: [PATCH 04/24] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e22d87d..532d2ee 100644 --- a/README.md +++ b/README.md @@ -78,13 +78,13 @@ OperationOptions operationOptions = OperationOptions.init() .responseFormat(ResponseFormat.REGEX); Term result1 = term.union(operationOptions, Term.regex("de")); -System.out.println(result1.toString()); // regex=(abc)?de +System.out.println(result1); // regex=(abc)?de operationOptions = OperationOptions.init() .responseFormat(ResponseFormat.FAIR); Term result2 = term.union(operationOptions, Term.regex("de")); -System.out.println(r2.toString()); // fair=... +System.out.println(result2); // fair=... ``` If the format does not matter, omit `responseFormat` or set it to `ResponseFormat.ANY`. From 179ad19af16188f35c4a60a41f2305c36b7a5783 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Tue, 21 Oct 2025 17:00:32 +0200 Subject: [PATCH 05/24] Update README.md --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 532d2ee..8d89786 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ By default, the engine returns whatever the operation produces, with no extra co ```java import com.regexsolver.api.Term; +import com.regexsolver.api.OperationOptions; import com.regexsolver.api.ResponseFormat; Term term = Term.regex("abcde"); @@ -97,11 +98,17 @@ Set a server-side compute timeout in milliseconds with `executionTimeout`: ```java import com.regexsolver.api.exception.ApiError; +import com.regexsolver.api.OperationOptions; import com.regexsolver.api.Term; +// Limit the server-side compute time to 5 ms try { - Term out = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c") - .difference(Term.regex(".*abc.*")); + Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); + Term term2 = Term.regex(".*abc.*"); + + OperationOptions operationOptions = OperationOptions.init() + .executionTimeout(5); + Term out = term1.difference(operationOptions, term2); } catch (ApiError e) { System.out.println(e.getMessage()); // The operation took too much time. } From 7168fd70640c7438487adb1491ce456e109f9ad5 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Tue, 21 Oct 2025 20:41:42 +0200 Subject: [PATCH 06/24] Reorganize classes --- .github/workflows/maven.yml | 2 ++ README.md | 6 ++-- .../com/regexsolver/api/OperationOptions.java | 28 +++++++++++++++ src/main/java/com/regexsolver/api/Term.java | 29 +-------------- .../com/regexsolver/api/package-info.java | 2 +- .../com/regexsolver/api/IntegrationTest.java | 35 ++++++++++++++----- 6 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 src/main/java/com/regexsolver/api/OperationOptions.java diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 159c41c..968404f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -18,4 +18,6 @@ jobs: distribution: 'temurin' cache: maven - name: Test + env: + REGEXSOLVER_API_TOKEN: ${{ secrets.REGEXSOLVER_API_TOKEN }} run: mvn test diff --git a/README.md b/README.md index 8d89786..614c101 100644 --- a/README.md +++ b/README.md @@ -75,13 +75,13 @@ import com.regexsolver.api.ResponseFormat; Term term = Term.regex("abcde"); -OperationOptions operationOptions = OperationOptions.init() +OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result1 = term.union(operationOptions, Term.regex("de")); System.out.println(result1); // regex=(abc)?de -operationOptions = OperationOptions.init() +operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.FAIR); Term result2 = term.union(operationOptions, Term.regex("de")); @@ -106,7 +106,7 @@ try { Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); Term term2 = Term.regex(".*abc.*"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .executionTimeout(5); Term out = term1.difference(operationOptions, term2); } catch (ApiError e) { diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java new file mode 100644 index 0000000..836e039 --- /dev/null +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -0,0 +1,28 @@ +package com.regexsolver.api; + +public class OperationOptions { + protected ResponseFormat responseFormat; + protected Integer executionTimeout; + + public static OperationOptions newDefault() { + return new OperationOptions(); + } + + public OperationOptions responseFormat(ResponseFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + public ResponseFormat responseFormat() { + return responseFormat; + } + + public OperationOptions executionTimeout(Integer executionTimeout) { + this.executionTimeout = executionTimeout; + return this; + } + + public Integer executionTimeout() { + return executionTimeout; + } +} diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 444dcba..fff3657 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -87,7 +87,7 @@ public String getValue() { private static RequestOptions loadRequestOptions(OperationOptions opts) { RequestOptions requestOptions = null; if (opts != null) { - requestOptions = RequestOptions.fromArgs(opts.responseFormat, opts.executionTimeout); + requestOptions = RequestOptions.fromArgs(opts.responseFormat(), opts.executionTimeout()); } return requestOptions; } @@ -626,31 +626,4 @@ public String getPattern() { return getValue(); } } - - public static final class OperationOptions { - private ResponseFormat responseFormat; - private Integer executionTimeout; - - public static OperationOptions init() { - return new OperationOptions(); - } - - public OperationOptions responseFormat(ResponseFormat responseFormat) { - this.responseFormat = responseFormat; - return this; - } - - public ResponseFormat responseFormat() { - return responseFormat; - } - - public OperationOptions executionTimeout(Integer executionTimeout) { - this.executionTimeout = executionTimeout; - return this; - } - - public Integer executionTimeout() { - return executionTimeout; - } - } } diff --git a/src/main/java/com/regexsolver/api/package-info.java b/src/main/java/com/regexsolver/api/package-info.java index 1870e39..62b3b26 100644 --- a/src/main/java/com/regexsolver/api/package-info.java +++ b/src/main/java/com/regexsolver/api/package-info.java @@ -2,7 +2,7 @@ * Contains all the classes you need to start using the library. *

* To start using this library you need to first request an API token at RegexSolver Console, - * then call RegexSolverApiWrapper.initialize("YOUR_TOKEN") to set it. + * set it as environment variable in REGEXSOLVER_API_TOKEN then call RegexSolverApiWrapper.initialize(). *

*

* You can find some examples in our documentation. diff --git a/src/test/java/com/regexsolver/api/IntegrationTest.java b/src/test/java/com/regexsolver/api/IntegrationTest.java index 652d5b3..9536909 100644 --- a/src/test/java/com/regexsolver/api/IntegrationTest.java +++ b/src/test/java/com/regexsolver/api/IntegrationTest.java @@ -1,9 +1,9 @@ package com.regexsolver.api; -import com.regexsolver.api.Term.OperationOptions; import com.regexsolver.api.dto.Cardinality; import com.regexsolver.api.dto.Details; import com.regexsolver.api.dto.Length; +import com.regexsolver.api.exception.ApiError; import org.junit.Before; import org.junit.Test; @@ -127,7 +127,7 @@ public void test_analyze_subset() throws Exception { public void test_compute_concat() throws Exception { Term term1 = Term.regex("abc"); Term term2 = Term.regex("de"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result = term1.concat(operationOptions, term2); assertEquals("regex=abcde", result.toString()); @@ -137,7 +137,7 @@ public void test_compute_concat() throws Exception { public void test_compute_difference() throws Exception { Term term1 = Term.regex("(abc|de)"); Term term2 = Term.regex("de"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result = term1.difference(operationOptions, term2); assertEquals("regex=abc", result.toString()); @@ -148,7 +148,7 @@ public void test_compute_intersection() throws Exception { Term term1 = Term.regex("(abc|de){2}"); Term term2 = Term.regex("de.*"); Term term3 = Term.regex(".*abc"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result = term1.intersection(operationOptions, term2, term3); assertEquals("regex=deabc", result.toString()); @@ -157,7 +157,7 @@ public void test_compute_intersection() throws Exception { @Test public void test_compute_repeat() throws Exception { Term term = Term.regex("abc"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result = term.repeat(operationOptions, 3, 5); assertEquals("regex=(abc){3,5}", result.toString()); @@ -168,7 +168,7 @@ public void test_compute_union() throws Exception { Term term1 = Term.regex("abc"); Term term2 = Term.regex("de"); Term term3 = Term.regex("fghi"); - OperationOptions operationOptions = OperationOptions.init() + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result = term1.union(operationOptions, term2, term3); assertEquals("regex=(abc|de|fghi)", result.toString()); @@ -199,14 +199,31 @@ public void test_readme_quickstart() throws Exception { @Test public void test_readme_response_format() throws Exception { Term term = Term.regex("abcde"); - OperationOptions operationOptions = OperationOptions.init() + + OperationOptions operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.REGEX); Term result1 = term.union(operationOptions, Term.regex("de")); + assertEquals("regex=(abc)?de", result1.toString()); - operationOptions = OperationOptions.init() + operationOptions = OperationOptions.newDefault() .responseFormat(ResponseFormat.FAIR); - Term result2 = term.intersection(operationOptions, Term.regex("de.*")); + Term result2 = term.union(operationOptions, Term.regex("de")); + assertTrue(result2.toString().startsWith("fair=")); } + + @Test + public void test_readme_execution_timeout() throws Exception { + try { + Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); + Term term2 = Term.regex(".*abc.*"); + + OperationOptions operationOptions = OperationOptions.newDefault() + .executionTimeout(5); + term1.difference(operationOptions, term2); + } catch (ApiError e) { + System.out.println(e.getMessage()); + } + } } \ No newline at end of file From f4f2c30f933e361fed48ba5eaeff2c3cdbd76ef4 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 26 Oct 2025 14:59:09 +0100 Subject: [PATCH 07/24] Remove getDetails --- .../api/RegexSolverApiWrapper.java | 45 ++++------ .../com/regexsolver/api/ResponseContent.java | 2 - src/main/java/com/regexsolver/api/Term.java | 29 ------ .../java/com/regexsolver/api/dto/Details.java | 88 ------------------- .../exception/MissingAPITokenException.java | 4 +- .../com/regexsolver/api/IntegrationTest.java | 28 ------ 6 files changed, 18 insertions(+), 178 deletions(-) delete mode 100644 src/main/java/com/regexsolver/api/dto/Details.java diff --git a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java b/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java index 1facd0a..f2332af 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java +++ b/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java @@ -8,7 +8,6 @@ import com.regexsolver.api.Response.StringResponse; import com.regexsolver.api.Response.StringsResponse; import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Details; import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; import com.regexsolver.api.exception.MissingAPITokenException; @@ -30,7 +29,7 @@ final class RegexSolverApiWrapper { private static final RegexSolverApiWrapper INSTANCE = new RegexSolverApiWrapper(); - private final static String DEFAULT_BASE_URL = "https://api.regexsolver.com/"; + private final static String DEFAULT_BASE_URL = "https://api.regexsolver.com/v1/"; private final static String USER_AGENT = "RegexSolver Java / 1.1.0"; @@ -90,15 +89,6 @@ public Cardinality analyzeCardinality(Term term) throws ApiError, IOException { } } - public Details analyzeDetails(Term term) throws ApiError, IOException { - Response

response = api.analyzeDetails(term).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - public String analyzeDot(Term term) throws ApiError, IOException { Response response = api.analyzeDot(term).execute(); if (response.isSuccessful()) { @@ -240,54 +230,51 @@ private static ApiError getApiError(Response response) throws IOException private interface RegexApi { // analyze - @POST("api/analyze/cardinality") + @POST("analyze/cardinality") Call analyzeCardinality(@Body Term term); - @POST("api/analyze/details") - Call
analyzeDetails(@Body Term term); - - @POST("api/analyze/dot") + @POST("analyze/dot") Call analyzeDot(@Body Term term); - @POST("api/analyze/equivalent") + @POST("analyze/equivalent") Call analyzeEquivalent(@Body MultiTermsRequest multiTermsRequest); - @POST("api/analyze/empty") + @POST("analyze/empty") Call analyzeEmpty(@Body Term term); - @POST("api/analyze/empty_string") + @POST("analyze/empty_string") Call analyzeEmptyString(@Body Term term); - @POST("api/analyze/length") + @POST("analyze/length") Call analyzeLength(@Body Term term); - @POST("api/analyze/pattern") + @POST("analyze/pattern") Call analyzePattern(@Body Term term); - @POST("api/analyze/subset") + @POST("analyze/subset") Call analyzeSubset(@Body MultiTermsRequest multiTermsRequest); - @POST("api/analyze/total") + @POST("analyze/total") Call analyzeTotal(@Body Term term); // compute - @POST("api/compute/concat") + @POST("compute/concat") Call computeConcat(@Body MultiTermsRequest multiTermsRequest); - @POST("api/compute/difference") + @POST("compute/difference") Call computeDifference(@Body MultiTermsRequest multiTermsRequest); - @POST("api/compute/intersection") + @POST("compute/intersection") Call computeIntersection(@Body MultiTermsRequest multiTermsRequest); - @POST("api/compute/repeat") + @POST("compute/repeat") Call computeRepeat(@Body RepeatRequest repeatRequest); - @POST("api/compute/union") + @POST("compute/union") Call computeUnion(@Body MultiTermsRequest multiTermsRequest); // generate - @POST("api/generate/strings") + @POST("generate/strings") Call generateStrings(@Body GenerateStringsRequest request); } } diff --git a/src/main/java/com/regexsolver/api/ResponseContent.java b/src/main/java/com/regexsolver/api/ResponseContent.java index ea37121..5b4f260 100644 --- a/src/main/java/com/regexsolver/api/ResponseContent.java +++ b/src/main/java/com/regexsolver/api/ResponseContent.java @@ -5,13 +5,11 @@ import com.regexsolver.api.Response.BooleanResponse; import com.regexsolver.api.Response.StringResponse; import com.regexsolver.api.Response.StringsResponse; -import com.regexsolver.api.dto.Details; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = Term.Fair.class, name = "fair"), @JsonSubTypes.Type(value = Term.Regex.class, name = "regex"), - @JsonSubTypes.Type(value = Details.class, name = "details"), @JsonSubTypes.Type(value = StringResponse.class, name = "string"), @JsonSubTypes.Type(value = StringsResponse.class, name = "strings"), @JsonSubTypes.Type(value = BooleanResponse.class, name = "boolean"), diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index fff3657..433f471 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -7,7 +7,6 @@ import com.regexsolver.api.Request.RepeatRequest; import com.regexsolver.api.Request.RequestOptions; import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Details; import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; @@ -34,8 +33,6 @@ public abstract class Term implements ResponseContent { @JsonIgnore private transient String serialized = null; - @JsonIgnore - private transient Details details; @JsonIgnore private transient Cardinality cardinality; @JsonIgnore @@ -137,32 +134,12 @@ public boolean equivalent(Term term) throws IOException, ApiError { public Cardinality getCardinality() throws IOException, ApiError { if (cardinality != null) { return cardinality; - } else if (details != null) { - return details.getCardinality(); } cardinality = RegexSolverApiWrapper.getInstance() .analyzeCardinality(this); return cardinality; } - /** - * Get the details of this term. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return The details of this term. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Details getDetails() throws IOException, ApiError { - if (details != null) { - return details; - } - details = RegexSolverApiWrapper.getInstance().analyzeDetails(this); - return details; - } - /** * Get the GraphViz DOT representation of this term. * Cache the result to avoid calling the API again if this method is called @@ -206,8 +183,6 @@ public String getFair() throws IOException, ApiError { public Length getLength() throws IOException, ApiError { if (length != null) { return length; - } else if (details != null) { - return details.getLength(); } length = RegexSolverApiWrapper.getInstance() @@ -250,8 +225,6 @@ public String getPattern() throws IOException, ApiError { public boolean isEmpty() throws IOException, ApiError { if (empty != null) { return empty; - } else if (details != null) { - return details.isEmpty(); } empty = RegexSolverApiWrapper.getInstance() @@ -292,8 +265,6 @@ public boolean isEmptyString() throws IOException, ApiError { public boolean isTotal() throws IOException, ApiError { if (total != null) { return total; - } else if (details != null) { - return details.isTotal(); } total = RegexSolverApiWrapper.getInstance() diff --git a/src/main/java/com/regexsolver/api/dto/Details.java b/src/main/java/com/regexsolver/api/dto/Details.java deleted file mode 100644 index 0d78d67..0000000 --- a/src/main/java/com/regexsolver/api/dto/Details.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.regexsolver.api.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.regexsolver.api.ResponseContent; -import com.regexsolver.api.Term; - -import java.util.Objects; - -/** - * Contains details about the requested {@link Term}. - */ -public final class Details implements ResponseContent { - private final Cardinality cardinality; - private final Length length; - private final boolean empty; - private final boolean total; - - /** - * @param cardinality the number of possible values. - * @param length the minimum and maximum length of possible values. - * @param empty true if is an empty set (does not contain any value), false otherwise. - * @param total true if is a total set (contains all values), false otherwise. - */ - public Details( - @JsonProperty("cardinality") Cardinality cardinality, - @JsonProperty("length") Length length, - @JsonProperty("empty") boolean empty, - @JsonProperty("total") boolean total - ) { - this.cardinality = cardinality; - this.length = length; - this.empty = empty; - this.total = total; - } - - /** - * @return The number of possible values. - */ - public Cardinality getCardinality() { - return cardinality; - } - - /** - * @return The minimum and maximum length of possible values. - */ - public Length getLength() { - return length; - } - - /** - * @return true if is an empty set (does not contain any value), false otherwise. - */ - public boolean isEmpty() { - return empty; - } - - /** - * @return true if is a total set (contains all values), false otherwise. - */ - public boolean isTotal() { - return total; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (Details) obj; - return Objects.equals(this.cardinality, that.cardinality) && - Objects.equals(this.length, that.length) && - this.empty == that.empty && - this.total == that.total; - } - - @Override - public int hashCode() { - return Objects.hash(cardinality, length, empty, total); - } - - @Override - public String toString() { - return "Details[" + - "cardinality=" + cardinality + ", " + - "length=" + length + ", " + - "empty=" + empty + ", " + - "total=" + total + ']'; - } -} diff --git a/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java b/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java index ddac5ec..4240691 100644 --- a/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java +++ b/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java @@ -5,11 +5,11 @@ */ public class MissingAPITokenException extends RuntimeException { /** - * The API token has not been set, call RegexSolverApiWrapper.initialize(\"YOUR_TOKEN\"); to set it. + * The API token has not been set, set the environment variable REGEXSOLVER_API_TOKEN and call RegexSolverApiWrapper.initialize() to set it. * To generate a token go to RegexSolver Console. */ public MissingAPITokenException() { - super("The API token has not been set, call RegexSolverApiWrapper.initialize(\"YOUR_TOKEN\") to set it.\n" + + super("The API token has not been set, set the environment variable REGEXSOLVER_API_TOKEN and call RegexSolverApiWrapper.initialize() to set it.\n" + "To generate a token go to https://console.regexsolver.com/."); } } diff --git a/src/test/java/com/regexsolver/api/IntegrationTest.java b/src/test/java/com/regexsolver/api/IntegrationTest.java index 9536909..beba50d 100644 --- a/src/test/java/com/regexsolver/api/IntegrationTest.java +++ b/src/test/java/com/regexsolver/api/IntegrationTest.java @@ -1,7 +1,6 @@ package com.regexsolver.api; import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Details; import com.regexsolver.api.dto.Length; import com.regexsolver.api.exception.ApiError; @@ -28,33 +27,6 @@ public void test_analyze_cardinality() throws Exception { assertEquals("Integer(5)", cardinality.toString()); } - @Test - public void test_analyze_details() throws Exception { - Term term = Term.regex("(abc|de)"); - Details details = term.getDetails(); - assertEquals( - "Details[cardinality=Integer(2), length=Length[minimum=2, maximum=3], empty=false, total=false]", - details.toString()); - } - - @Test - public void test_analyze_details_infinite() throws Exception { - Term term = Term.regex(".*"); - Details details = term.getDetails(); - assertEquals( - "Details[cardinality=Infinite, length=Length[minimum=0, maximum=null], empty=false, total=true]", - details.toString()); - } - - @Test - public void test_analyze_details_empty() throws Exception { - Term term = Term.regex("[]"); - Details details = term.getDetails(); - assertEquals( - "Details[cardinality=Integer(0), length=Length[minimum=null, maximum=null], empty=true, total=false]", - details.toString()); - } - @Test public void test_analyze_dot() throws Exception { Term term = Term.regex("(abc|de)"); From cd5a2e7275064bbe24d939b2ab891e9057860181 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 26 Oct 2025 14:59:58 +0100 Subject: [PATCH 08/24] Remove getDetails --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 614c101..363ea28 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,6 @@ Timeout is best effort. The exact time is not guaranteed. | -------- | ------- | ------- | | `t.equivalent(Term term)` | `boolean` | `true` if `t` and `term` accept exactly the same language. Supports `executionTimeout`. | | `t.getCardinality()` | `Cardinality` | Returns the cardinality of the term (i.e., the number of possible matched strings). | -| `t.getDetails()` | `Details` | Returns cardinality, length bounds, and if it is empty or total. | | `t.getDot()` | `String` | Returns a Graphviz DOT representation of the automaton for the term. | | `t.getFair()` | `String` | Returns the FAIR of the term if defined. | | `t.getLength()` | `Length` | Returns the minimum and maximum length of matched strings. | From 5e48f47a82d64ba35e1f783cceb0eeeee0a570c1 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Wed, 29 Oct 2025 19:44:49 +0100 Subject: [PATCH 09/24] update readme --- README.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 363ea28..caf0f9e 100644 --- a/README.md +++ b/README.md @@ -34,18 +34,27 @@ implementation "com.regexsolver.api:RegexSolver:1.1.0" ```java import com.regexsolver.api.RegexSolver; import com.regexsolver.api.Term; +import com.regexsolver.api.exception.ApiError; + +import java.io.IOException; -// Set REGEXSOLVER_API_TOKEN in your env and call initialize(), -// or pass the token directly: -RegexSolver.initialize(); // or RegexSolver.initialize("YOUR_API_TOKEN"); +public class Main { + public static void main(String[] args) throws IOException, ApiError { + // Set REGEXSOLVER_API_TOKEN in your env and call initialize(), + // or pass the token directly: + RegexSolver.initialize(); // or RegexSolver.initialize("YOUR_API_TOKEN"); -Term term1 = Term.regex("(abc|de|fg){2,}"); -Term term2 = Term.regex("de.*"); -Term term3 = Term.regex(".*abc"); + // Create terms + Term term1 = Term.regex("(abc|de|fg){2,}"); + Term term2 = Term.regex("de.*"); + Term term3 = Term.regex(".*abc"); -Term result = term1.intersection(term2, term3) - .difference(Term.regex(".+(abc|de).+")); -System.out.println(result.getPattern()); // de(fg)*abc + // Compute intersection and difference + Term result = term1.intersection(term2, term3) + .difference(Term.regex(".+(abc|de).+")); + System.out.println(result.getPattern()); // de(fg)*abc + } +} ``` @@ -69,10 +78,6 @@ The API can handle terms in two formats: By default, the engine returns whatever the operation produces, with no extra convertion. Override with `responseFormat`: ```java -import com.regexsolver.api.Term; -import com.regexsolver.api.OperationOptions; -import com.regexsolver.api.ResponseFormat; - Term term = Term.regex("abcde"); OperationOptions operationOptions = OperationOptions.newDefault() @@ -97,10 +102,6 @@ Regardless of the format, you can always call `getPattern()` to obtain the regex Set a server-side compute timeout in milliseconds with `executionTimeout`: ```java -import com.regexsolver.api.exception.ApiError; -import com.regexsolver.api.OperationOptions; -import com.regexsolver.api.Term; - // Limit the server-side compute time to 5 ms try { Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); From fe4244231adc322e54b6492aa14322a052fc1f2a Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 29 Mar 2026 16:51:21 +0200 Subject: [PATCH 10/24] Update library --- .github/workflows/maven.yml | 25 +- .openapi-generator-ignore | 20 + .openapi-generator/FILES | 45 + .openapi-generator/VERSION | 1 + generate-api.sh | 20 + openapitools.json | 7 + pom.xml | 102 +- .../api/AsyncRegexSolverClient.java | 836 ++++++++++ .../java/com/regexsolver/api/Cardinality.java | 146 ++ src/main/java/com/regexsolver/api/Length.java | 76 + .../com/regexsolver/api/OperationOptions.java | 28 - .../java/com/regexsolver/api/RateLimiter.java | 54 + .../java/com/regexsolver/api/RegexSolver.java | 15 - .../api/RegexSolverApiWrapper.java | 280 ---- .../regexsolver/api/RegexSolverClient.java | 431 ++++++ .../java/com/regexsolver/api/Request.java | 161 -- .../java/com/regexsolver/api/Response.java | 43 - .../com/regexsolver/api/ResponseContent.java | 18 - .../com/regexsolver/api/ResponseFormat.java | 25 +- src/main/java/com/regexsolver/api/Term.java | 642 ++------ .../regexsolver/api/TermPropertiesMixin.java | 41 + .../com/regexsolver/api/dto/Cardinality.java | 86 -- .../java/com/regexsolver/api/dto/Length.java | 117 -- .../com/regexsolver/api/dto/package-info.java | 4 - .../regexsolver/api/exception/ApiError.java | 19 - .../exception/MissingAPITokenException.java | 15 - .../api/exception/package-info.java | 4 - .../api/exceptions/ApiException.java | 33 + .../api/exceptions/BadRequestException.java | 14 + .../api/exceptions/ForbiddenException.java | 14 + .../exceptions/InternalServerException.java | 17 + .../api/exceptions/InvalidJsonException.java | 14 + ...lidNumberOfStringsToGenerateException.java | 16 + .../api/exceptions/InvalidTokenException.java | 14 + .../MissingOrMalformedTokenException.java | 14 + .../api/exceptions/NotFoundException.java | 16 + .../exceptions/QuotaExceededException.java | 14 + .../api/exceptions/RegexSolverException.java | 11 + .../exceptions/TimeoutExceededException.java | 14 + .../exceptions/TimeoutTooLargeException.java | 14 + .../exceptions/TooManyRequestsException.java | 17 + .../api/exceptions/TooManyTermsException.java | 14 + .../api/exceptions/UnauthorizedException.java | 14 + .../regexsolver/api/generated/ApiClient.java | 486 ++++++ .../api/generated/ApiException.java | 92 ++ .../api/generated/ApiResponse.java | 60 + .../api/generated/Configuration.java | 63 + .../com/regexsolver/api/generated/JSON.java | 261 ++++ .../com/regexsolver/api/generated/Pair.java | 37 + .../api/generated/RFC3339DateFormat.java | 57 + .../generated/RFC3339InstantDeserializer.java | 100 ++ .../api/generated/RFC3339JavaTimeModule.java | 39 + .../api/generated/ServerConfiguration.java | 72 + .../api/generated/ServerVariable.java | 37 + .../api/generated/api/AnalyzeApi.java | 1362 +++++++++++++++++ .../api/generated/api/ComputeApi.java | 965 ++++++++++++ .../api/generated/api/GenerateApi.java | 302 ++++ .../model/AbstractOpenApiSchema.java | 144 ++ .../api/generated/model/BooleanDto.java | 217 +++ .../model/Cardinality200ResponseDto.java | 185 +++ .../model/CardinalityBigIntegerDto.java | 181 +++ .../api/generated/model/CardinalityDto.java | 362 +++++ .../model/CardinalityInfiniteDto.java | 181 +++ .../model/CardinalityIntegerDto.java | 218 +++ .../generated/model/Concat200ResponseDto.java | 185 +++ .../generated/model/Dot200ResponseDto.java | 185 +++ .../generated/model/Empty200ResponseDto.java | 185 +++ .../api/generated/model/ErrorResponseDto.java | 220 +++ .../generated/model/ExecutionOptionsDto.java | 149 ++ .../model/GenerateStringsRequestDto.java | 297 ++++ .../model/GenerateStringsResponseDto.java | 255 +++ .../generated/model/Length200ResponseDto.java | 185 +++ .../api/generated/model/LengthDto.java | 253 +++ .../generated/model/MultiTermsRequestDto.java | 201 +++ .../api/generated/model/RepeatRequestDto.java | 258 ++++ .../generated/model/RequestOptionsDto.java | 222 +++ .../generated/model/ResponseOptionsDto.java | 185 +++ .../api/generated/model/StringDto.java | 217 +++ .../model/Strings200ResponseDto.java | 185 +++ .../api/generated/model/StringsDto.java | 231 +++ .../api/generated/model/TermDto.java | 306 ++++ .../api/generated/model/TermFairDto.java | 217 +++ .../api/generated/model/TermRegexDto.java | 217 +++ .../api/generated/model/TermRequestDto.java | 186 +++ .../generated/model/TwoTermsRequestDto.java | 201 +++ .../com/regexsolver/api/package-info.java | 11 - .../api/AsyncRegexSolverClientTest.java | 540 +++++++ .../com/regexsolver/api/IntegrationTest.java | 201 --- .../java/com/regexsolver/api/ModelsTest.java | 220 +++ .../com/regexsolver/api/RateLimiterTest.java | 74 + .../api/RegexSolverClientTest.java | 152 ++ .../regexsolver/api/TermOperationTest.java | 45 - .../regexsolver/api/TermSerializeTest.java | 33 - .../java/com/regexsolver/api/TestUtils.java | 47 - src/test/resources/response_error.json | 4 - 95 files changed, 13133 insertions(+), 1666 deletions(-) create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100755 generate-api.sh create mode 100644 openapitools.json create mode 100644 src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java create mode 100644 src/main/java/com/regexsolver/api/Cardinality.java create mode 100644 src/main/java/com/regexsolver/api/Length.java delete mode 100644 src/main/java/com/regexsolver/api/OperationOptions.java create mode 100644 src/main/java/com/regexsolver/api/RateLimiter.java delete mode 100644 src/main/java/com/regexsolver/api/RegexSolver.java delete mode 100644 src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java create mode 100644 src/main/java/com/regexsolver/api/RegexSolverClient.java delete mode 100644 src/main/java/com/regexsolver/api/Request.java delete mode 100644 src/main/java/com/regexsolver/api/Response.java delete mode 100644 src/main/java/com/regexsolver/api/ResponseContent.java create mode 100644 src/main/java/com/regexsolver/api/TermPropertiesMixin.java delete mode 100644 src/main/java/com/regexsolver/api/dto/Cardinality.java delete mode 100644 src/main/java/com/regexsolver/api/dto/Length.java delete mode 100644 src/main/java/com/regexsolver/api/dto/package-info.java delete mode 100644 src/main/java/com/regexsolver/api/exception/ApiError.java delete mode 100644 src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java delete mode 100644 src/main/java/com/regexsolver/api/exception/package-info.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/ApiException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/BadRequestException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/ForbiddenException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/InternalServerException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/InvalidJsonException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/InvalidNumberOfStringsToGenerateException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/InvalidTokenException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/MissingOrMalformedTokenException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/NotFoundException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/QuotaExceededException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/RegexSolverException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/TimeoutExceededException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/TimeoutTooLargeException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/TooManyRequestsException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/TooManyTermsException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/UnauthorizedException.java create mode 100644 src/main/java/com/regexsolver/api/generated/ApiClient.java create mode 100644 src/main/java/com/regexsolver/api/generated/ApiException.java create mode 100644 src/main/java/com/regexsolver/api/generated/ApiResponse.java create mode 100644 src/main/java/com/regexsolver/api/generated/Configuration.java create mode 100644 src/main/java/com/regexsolver/api/generated/JSON.java create mode 100644 src/main/java/com/regexsolver/api/generated/Pair.java create mode 100644 src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java create mode 100644 src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java create mode 100644 src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java create mode 100644 src/main/java/com/regexsolver/api/generated/ServerConfiguration.java create mode 100644 src/main/java/com/regexsolver/api/generated/ServerVariable.java create mode 100644 src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java create mode 100644 src/main/java/com/regexsolver/api/generated/api/ComputeApi.java create mode 100644 src/main/java/com/regexsolver/api/generated/api/GenerateApi.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/BooleanDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/LengthDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/StringDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/StringsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TermDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TermFairDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java delete mode 100644 src/main/java/com/regexsolver/api/package-info.java create mode 100644 src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java delete mode 100644 src/test/java/com/regexsolver/api/IntegrationTest.java create mode 100644 src/test/java/com/regexsolver/api/ModelsTest.java create mode 100644 src/test/java/com/regexsolver/api/RateLimiterTest.java create mode 100644 src/test/java/com/regexsolver/api/RegexSolverClientTest.java delete mode 100644 src/test/java/com/regexsolver/api/TermOperationTest.java delete mode 100644 src/test/java/com/regexsolver/api/TermSerializeTest.java delete mode 100644 src/test/java/com/regexsolver/api/TestUtils.java delete mode 100644 src/test/resources/response_error.json diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 968404f..abff5a2 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,23 +1,30 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# +# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) + name: Java CI with Maven on: push: - branches: [ "main" ] + branches: [ main, master ] pull_request: - branches: [ "main" ] + branches: [ main, master ] jobs: build: + name: Build RegexSolver runs-on: ubuntu-latest + strategy: + matrix: + java: [ 17, 21 ] steps: - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK + uses: actions/setup-java@v4 with: - java-version: '11' + java-version: ${{ matrix.java }} distribution: 'temurin' cache: maven - - name: Test - env: - REGEXSOLVER_API_TOKEN: ${{ secrets.REGEXSOLVER_API_TOKEN }} - run: mvn test + - name: Build with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..51baa4b --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,20 @@ +src/main/java/com/regexsolver/api/exceptions/** +test/ +pom.xml +.gitignore +git_push.sh +.travis.yml +.gitlab-ci.yml +pyproject.toml +.github/ +docs/ +test/ +README.md +build.gradle +settings.gradle +gradlew +gradlew.bat +gradle/ +gradle.properties +build.sbt +*.xml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..77bda1d --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,45 @@ +api/openapi.yaml +gradle.properties +src/main/AndroidManifest.xml +src/main/java/com/regexsolver/api/generated/ApiClient.java +src/main/java/com/regexsolver/api/generated/ApiException.java +src/main/java/com/regexsolver/api/generated/ApiResponse.java +src/main/java/com/regexsolver/api/generated/Configuration.java +src/main/java/com/regexsolver/api/generated/JSON.java +src/main/java/com/regexsolver/api/generated/Pair.java +src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +src/main/java/com/regexsolver/api/generated/ServerVariable.java +src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/LengthDto.java +src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +src/main/java/com/regexsolver/api/generated/model/StringDto.java +src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/StringsDto.java +src/main/java/com/regexsolver/api/generated/model/TermDto.java +src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..a29ba3d --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.21.0 diff --git a/generate-api.sh b/generate-api.sh new file mode 100755 index 0000000..632f814 --- /dev/null +++ b/generate-api.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +SPEC_FILE="../m-lab/shared/openapi.yaml" +OUT_DIR="./" + +echo "Running openapi-generator-cli..." +openapi-generator-cli generate \ + -i "$SPEC_FILE" \ + -g java \ + -o "$OUT_DIR" \ + --model-name-suffix Dto \ + --additional-properties=library=native \ + --additional-properties=invokerPackage=com.regexsolver.api.generated \ + --additional-properties=apiPackage=com.regexsolver.api.generated.api \ + --additional-properties=modelPackage=com.regexsolver.api.generated.model \ + --additional-properties=asyncNative=true \ + --additional-properties=useRuntimeException=true \ + --additional-properties=openApiNullable=false + +echo "API Generation Complete." diff --git a/openapitools.json b/openapitools.json new file mode 100644 index 0000000..91d9c43 --- /dev/null +++ b/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "7.21.0" + } +} diff --git a/pom.xml b/pom.xml index e284508..8aaa69b 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,9 @@ - - + + 4.0.0 com.regexsolver.api @@ -37,32 +39,93 @@ 11 11 UTF-8 + + 2.21.1 + 2.21 + 1.3.5 + 5.10.2 + 5.11.0 + 3.25.3 - com.squareup.retrofit2 - retrofit - 2.12.0 + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + + - com.squareup.retrofit2 - converter-jackson - 2.12.0 + com.fasterxml.jackson.core + jackson-annotations + ${jackson.annotations.version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + + - junit - junit - 4.13.2 + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + + org.openapitools + jackson-databind-nullable + 0.2.9 + + + + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation.version} + + + + org.junit.jupiter + junit-jupiter-api + ${junit.version} + test + + + + org.junit.jupiter + junit-jupiter-engine + ${junit.version} + test + + + + org.mockito + mockito-core + ${mockito.version} + test + + + org.mockito + mockito-junit-jupiter + ${mockito.version} test + - com.squareup.okhttp3 - mockwebserver - 3.14.9 + org.assertj + assertj-core + ${assertj.version} test + @@ -82,11 +145,6 @@ org.apache.maven.plugins maven-javadoc-plugin 3.7.0 - - - **/ResponseContent.java - - attach-javadocs @@ -127,4 +185,4 @@ - \ No newline at end of file + diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java new file mode 100644 index 0000000..ab47830 --- /dev/null +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -0,0 +1,836 @@ +package com.regexsolver.api; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.regexsolver.api.exceptions.*; +import com.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.api.AnalyzeApi; +import com.regexsolver.api.generated.api.ComputeApi; +import com.regexsolver.api.generated.api.GenerateApi; +import com.regexsolver.api.generated.model.*; +import java.net.http.HttpHeaders; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +/** + * The Asynchronous Client for RegexSolver. + * + * Provides non-blocking access to all RegexSolver API endpoints. + */ +public final class AsyncRegexSolverClient { + + private static final String VERSION = "1.1.0"; + private final String apiToken; + private final String baseUrl; + private final RateLimiter rateLimiter; + private final AnalyzeApi analyzeApi; + private final ComputeApi computeApi; + private final GenerateApi generateApi; + private final ObjectMapper objectMapper; + + private AsyncRegexSolverClient(Builder builder) { + this.apiToken = builder.apiToken; + this.baseUrl = builder.baseUrl; + this.rateLimiter = RateLimiter.getInstance(this.apiToken); + + ApiClient apiClient = new ApiClient(); + apiClient.setBasePath(this.baseUrl); + apiClient.setRequestInterceptor(requestBuilder -> { + requestBuilder.header( + "User-Agent", + "RegexSolver Java / " + VERSION + ); + requestBuilder.header("Authorization", "Bearer " + this.apiToken); + }); + + this.analyzeApi = new AnalyzeApi(apiClient); + this.computeApi = new ComputeApi(apiClient); + this.generateApi = new GenerateApi(apiClient); + this.objectMapper = apiClient.getObjectMapper(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + + private String apiToken; + private String baseUrl = "https://api.regexsolver.com/v1"; + + public Builder apiToken(String apiToken) { + this.apiToken = apiToken; + return this; + } + + public Builder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; + return this; + } + + public AsyncRegexSolverClient build() { + if (apiToken == null || apiToken.isEmpty()) { + throw new IllegalArgumentException("apiToken is required"); + } + return new AsyncRegexSolverClient(this); + } + } + + // --- INTERNAL HELPERS --- + + private RequestOptionsDto buildOptions( + Integer timeout, + ResponseFormat format + ) { + RequestOptionsDto options = new RequestOptionsDto().schemaVersion(1); + if (timeout != null) { + options.execution(new ExecutionOptionsDto().timeout(timeout)); + } + if (format != null) { + options.response(new ResponseOptionsDto().format(format.toDto())); + } + return options; + } + + private CompletableFuture executeWithRetry( + Supplier> apiCall + ) { + return executeWithRetry(apiCall, 0); + } + + private CompletableFuture executeWithRetry( + Supplier> apiCall, + int attempt + ) { + return rateLimiter + .waitIfNecessary() + .thenCompose(v -> apiCall.get()) + .exceptionallyCompose(ex -> { + Throwable cause = ex.getCause() != null ? ex.getCause() : ex; + if (cause instanceof ApiException) { + ApiException apiEx = (ApiException) cause; + if (apiEx.getCode() == 429 && attempt < 5) { + double retryAfter = 1.0; + HttpHeaders headers = apiEx.getResponseHeaders(); + if (headers != null) { + retryAfter = headers + .firstValue("Retry-After") + .map(Double::parseDouble) + .orElse(1.0); + } + rateLimiter.trigger(retryAfter); + return executeWithRetry(apiCall, attempt + 1); + } + throw mapException(apiEx); + } + if ( + cause instanceof RuntimeException + ) throw (RuntimeException) cause; + throw new RuntimeException(cause); + }); + } + + private RegexSolverException mapException(ApiException ex) { + int code = ex.getCode(); + String body = ex.getResponseBody(); + String message = ex.getMessage(); + String errorCode = "UnknownError"; + + try { + ErrorResponseDto errorResponse = objectMapper.readValue( + body, + ErrorResponseDto.class + ); + if (errorResponse.getError() != null) message = + errorResponse.getError(); + if (errorResponse.getErrorCode() != null) errorCode = + errorResponse.getErrorCode(); + } catch (Exception ignored) {} + + switch (code) { + case 400: + if ( + "InvalidJson".equals(errorCode) + ) return new InvalidJsonException( + message, + code, + errorCode, + body + ); + if ( + "TooManyTerms".equals(errorCode) + ) return new TooManyTermsException( + message, + code, + errorCode, + body + ); + if ( + "TimeoutTooLarge".equals(errorCode) + ) return new TimeoutTooLargeException( + message, + code, + errorCode, + body + ); + if ( + "TimeoutExceeded".equals(errorCode) + ) return new TimeoutExceededException( + message, + code, + errorCode, + body + ); + if ( + "InvalidNumberOfStringsToGenerate".equals(errorCode) + ) return new InvalidNumberOfStringsToGenerateException( + message, + code, + errorCode, + body + ); + return new BadRequestException(message, code, errorCode, body); + case 401: + if ( + "MissingOrMalformedToken".equals(errorCode) + ) return new MissingOrMalformedTokenException( + message, + code, + errorCode, + body + ); + if ( + "InvalidToken".equals(errorCode) + ) return new InvalidTokenException( + message, + code, + errorCode, + body + ); + return new UnauthorizedException( + message, + code, + errorCode, + body + ); + case 403: + if ( + "QuotaExceeded".equals(errorCode) + ) return new QuotaExceededException( + message, + code, + errorCode, + body + ); + return new ForbiddenException(message, code, errorCode, body); + case 404: + return new NotFoundException(message, code, errorCode, body); + case 429: + return new TooManyRequestsException( + "Max retries exceeded for 429 Too Many Requests.", + code, + errorCode, + body + ); + case 500: + return new InternalServerException( + message, + code, + errorCode, + body + ); + default: + return new com.regexsolver.api.exceptions.ApiException( + message, + code, + errorCode, + body + ); + } + } + + // --- ANALYZE OPERATIONS --- + + /** + * Computes how many unique strings the term matches asynchronously. + * + * @param term The term to analyze. + * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + */ + public CompletableFuture getCardinality(Term term) { + return getCardinality(term, null); + } + + /** + * Computes how many unique strings the term matches asynchronously. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + */ + public CompletableFuture getCardinality( + Term term, + Integer timeout + ) { + if (term.getCachedCardinality() != null) { + return CompletableFuture.completedFuture( + term.getCachedCardinality() + ); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> + analyzeApi.cardinality(request) + ).thenApply(resp -> { + Cardinality card = Cardinality.fromDto(resp.getData()); + term.setCachedCardinality(card); + return card; + }); + } + + /** + * Computes the minimum and maximum length of strings matched by the term asynchronously. + * + * @param term The term to analyze. + * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. + */ + public CompletableFuture getLength(Term term) { + return getLength(term, null); + } + + /** + * Computes the minimum and maximum length of strings matched by the term asynchronously. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. + */ + public CompletableFuture getLength(Term term, Integer timeout) { + if (term.getCachedLength() != null) { + return CompletableFuture.completedFuture(term.getCachedLength()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.length(request)).thenApply( + resp -> { + Length len = Length.fromDto(resp.getData()); + term.setCachedLength(len); + return len; + } + ); + } + + /** + * Checks if the term matches no strings at all asynchronously. + * + * @param term The term to analyze. + * @return A CompletableFuture containing true if the language is completely empty, false otherwise. + */ + public CompletableFuture isEmpty(Term term) { + return isEmpty(term, null); + } + + /** + * Checks if the term matches no strings at all asynchronously. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing true if the language is completely empty, false otherwise. + */ + public CompletableFuture isEmpty(Term term, Integer timeout) { + if (term.getCachedEmpty() != null) { + return CompletableFuture.completedFuture(term.getCachedEmpty()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.empty(request)).thenApply( + resp -> { + boolean val = resp.getData().getValue(); + term.setCachedEmpty(val); + if (val) { + term.setCachedCardinality(new Cardinality.Integer(0)); + term.setCachedLength(new Length(null, null)); + } + return val; + } + ); + } + + /** + * Checks if the term matches only the empty string asynchronously. + * + * @param term The term to analyze. + * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. + */ + public CompletableFuture isEmptyString(Term term) { + return isEmptyString(term, null); + } + + /** + * Checks if the term matches only the empty string asynchronously. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. + */ + public CompletableFuture isEmptyString( + Term term, + Integer timeout + ) { + if (term.getCachedEmptyString() != null) { + return CompletableFuture.completedFuture( + term.getCachedEmptyString() + ); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> + analyzeApi.emptyString(request) + ).thenApply(resp -> { + boolean val = resp.getData().getValue(); + term.setCachedEmptyString(val); + + if (val) { + term.setCachedCardinality(new Cardinality.Integer(1)); + term.setCachedLength(new Length(0, 0)); + } + return val; + }); + } + + /** + * Checks if the term matches all possible strings asynchronously. + * + * @param term The term to analyze. + * @return A CompletableFuture containing true if the term matches every possible string. + */ + public CompletableFuture isTotal(Term term) { + return isTotal(term, null); + } + + /** + * Checks if the term matches all possible strings asynchronously. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing true if the term matches every possible string. + */ + public CompletableFuture isTotal(Term term, Integer timeout) { + if (term.getCachedTotal() != null) { + return CompletableFuture.completedFuture(term.getCachedTotal()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.total(request)).thenApply( + resp -> { + boolean val = resp.getData().getValue(); + term.setCachedTotal(val); + + if (val) { + term.setCachedCardinality(new Cardinality.Infinite()); + term.setCachedLength(new Length(0, null)); + } + return val; + } + ); + } + + /** + * Returns a regular expression pattern that represents the term asynchronously. + * + * @param term The term to extract the pattern from. + * @return A CompletableFuture containing a valid regular expression string representing the language. + */ + public CompletableFuture getPattern(Term term) { + return getPattern(term, null); + } + + /** + * Returns a regular expression pattern that represents the term asynchronously. + * + * @param term The term to extract the pattern from. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a valid regular expression string representing the language. + */ + public CompletableFuture getPattern(Term term, Integer timeout) { + Optional patternOpt = term.getPattern(); + if (patternOpt.isPresent()) { + return CompletableFuture.completedFuture(patternOpt.get()); + } + + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.pattern(request)).thenApply( + resp -> { + String val = resp.getData().getValue(); + term.setCachedPattern(val); + return val; + } + ); + } + + /** + * Builds a Graphviz DOT representation of the term's automaton asynchronously. + * + * @param term The term to visualize. + * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. + */ + public CompletableFuture getDot(Term term) { + return getDot(term, null); + } + + /** + * Builds a Graphviz DOT representation of the term's automaton asynchronously. + * + * @param term The term to visualize. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. + */ + public CompletableFuture getDot(Term term, Integer timeout) { + if (term.getCachedDot() != null) { + return CompletableFuture.completedFuture(term.getCachedDot()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.dot(request)).thenApply( + resp -> { + String val = resp.getData().getValue(); + term.setCachedDot(val); + return val; + } + ); + } + + /** + * Checks if the two terms accept exactly the same language asynchronously. + * + * @param term1 The first term. + * @param term2 The second term to compare against. + * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. + */ + public CompletableFuture equivalent(Term term1, Term term2) { + return equivalent(term1, term2, null); + } + + /** + * Checks if the two terms accept exactly the same language asynchronously. + * + * @param term1 The first term. + * @param term2 The second term to compare against. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. + */ + public CompletableFuture equivalent( + Term term1, + Term term2, + Integer timeout + ) { + TwoTermsRequestDto request = new TwoTermsRequestDto() + .addTermsItem(term1.toDto()) + .addTermsItem(term2.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.equivalent(request)).thenApply( + resp -> resp.getData().getValue() + ); + } + + /** + * Checks if the first term's language is a subset of the second term's language asynchronously. + * + * @param subset The term to test as the subset. + * @param superset The term representing the entire set space. + * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. + */ + public CompletableFuture subset(Term subset, Term superset) { + return subset(subset, superset, null); + } + + /** + * Checks if the first term's language is a subset of the second term's language asynchronously. + * + * @param subset The term to test as the subset. + * @param superset The term representing the entire set space. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. + */ + public CompletableFuture subset( + Term subset, + Term superset, + Integer timeout + ) { + TwoTermsRequestDto request = new TwoTermsRequestDto() + .addTermsItem(subset.toDto()) + .addTermsItem(superset.toDto()) + .options(buildOptions(timeout, null)); + return executeWithRetry(() -> analyzeApi.subset(request)).thenApply( + resp -> resp.getData().getValue() + ); + } + + // --- COMPUTE OPERATIONS --- + + /** + * Concatenates the given terms sequentially asynchronously. + * + * @param terms A dynamic list of terms to concatenate in order. + * @return A CompletableFuture containing a newly computed concatenated term. + */ + public CompletableFuture concat(List terms) { + return concat(terms, ResponseFormat.ANY, null); + } + + /** + * Concatenates the given terms sequentially asynchronously. + * + * @param terms A dynamic list of terms to concatenate in order. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a newly computed concatenated term. + */ + public CompletableFuture concat( + List terms, + ResponseFormat format, + Integer timeout + ) { + MultiTermsRequestDto request = new MultiTermsRequestDto() + .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> computeApi.concat(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + + /** + * Computes the intersection of the given terms asynchronously. + * + * @param terms A dynamic list of terms to intersect. + * @return A CompletableFuture containing a term representing only strings matched by ALL provided terms. + */ + public CompletableFuture intersection(List terms) { + return intersection(terms, ResponseFormat.ANY, null); + } + + /** + * Computes the intersection of the given terms asynchronously. + * + * @param terms A dynamic list of terms to intersect. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a term representing only strings matched by ALL provided terms. + */ + public CompletableFuture intersection( + List terms, + ResponseFormat format, + Integer timeout + ) { + MultiTermsRequestDto request = new MultiTermsRequestDto() + .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> + computeApi.intersection(request) + ).thenApply(resp -> Term.fromDto(resp.getData())); + } + + /** + * Computes the union of the given terms asynchronously. + * + * @param terms A dynamic list of terms to combine. + * @return A CompletableFuture containing a term representing strings matched by ANY of the provided terms. + */ + public CompletableFuture union(List terms) { + return union(terms, ResponseFormat.ANY, null); + } + + /** + * Computes the union of the given terms asynchronously. + * + * @param terms A dynamic list of terms to combine. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a term representing strings matched by ANY of the provided terms. + */ + public CompletableFuture union( + List terms, + ResponseFormat format, + Integer timeout + ) { + MultiTermsRequestDto request = new MultiTermsRequestDto() + .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> computeApi.union(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + + /** + * Computes the difference between the two provided terms asynchronously. + * + * @param base The base language term to subtract from. + * @param excluded The term whose language should be removed from the base. + * @return A CompletableFuture containing a computed difference term. + */ + public CompletableFuture difference(Term base, Term excluded) { + return difference(base, excluded, ResponseFormat.ANY, null); + } + + /** + * Computes the difference between the two provided terms asynchronously. + * + * @param base The base language term to subtract from. + * @param excluded The term whose language should be removed from the base. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a computed difference term. + */ + public CompletableFuture difference( + Term base, + Term excluded, + ResponseFormat format, + Integer timeout + ) { + TwoTermsRequestDto request = new TwoTermsRequestDto() + .addTermsItem(base.toDto()) + .addTermsItem(excluded.toDto()) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> computeApi.difference(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + + /** + * Computes the complement of the given term asynchronously. + * + * @param term The term to complement. + * @return A CompletableFuture containing the complemented term. + */ + public CompletableFuture complement(Term term) { + return complement(term, ResponseFormat.ANY, null); + } + + /** + * Computes the complement of the given term asynchronously. + * + * @param term The term to complement. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing the complemented term. + */ + public CompletableFuture complement( + Term term, + ResponseFormat format, + Integer timeout + ) { + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> computeApi.complement(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + + /** + * Repeats a term between a minimum and maximum number of times asynchronously. + * + * @param term The term to repeat. + * @param min The inclusive lower bound of repetitions. + * @param max The inclusive upper bound. If null, repetitions are unbounded. + * @return A CompletableFuture containing a computed repeated term. + */ + public CompletableFuture repeat(Term term, int min, Integer max) { + return repeat(term, min, max, ResponseFormat.ANY, null); + } + + /** + * Repeats a term between a minimum and maximum number of times asynchronously. + * + * @param term The term to repeat. + * @param min The inclusive lower bound of repetitions. + * @param max The inclusive upper bound. If null, repetitions are unbounded. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a computed repeated term. + */ + public CompletableFuture repeat( + Term term, + int min, + Integer max, + ResponseFormat format, + Integer timeout + ) { + RepeatRequestDto request = new RepeatRequestDto() + .term(term.toDto()) + .min(min) + .max(max) + .options(buildOptions(timeout, format)); + return executeWithRetry(() -> computeApi.repeat(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + + // --- GENERATE OPERATIONS --- + + /** + * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings asynchronously. + * + * @param term The term to sample generated strings from. + * @param limit The maximum number of unique strings to return. + * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. + * @return A CompletableFuture containing a list of strings that match the term. + */ + public CompletableFuture> generateStrings( + Term term, + int limit, + int offset + ) { + return generateStrings(term, limit, offset, null); + } + + /** + * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings asynchronously. + * + * @param term The term to sample generated strings from. + * @param limit The maximum number of unique strings to return. + * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. + * @param timeout Timeout in milliseconds for the operation. + * @return A CompletableFuture containing a list of strings that match the term. + */ + public CompletableFuture> generateStrings( + Term term, + int limit, + int offset, + Integer timeout + ) { + Term termToUse = + term.getCachedStableTerm() != null + ? term.getCachedStableTerm() + : term; + boolean returnStableTerm = term.getCachedStableTerm() == null; + + GenerateStringsRequestDto request = new GenerateStringsRequestDto() + .term(termToUse.toDto()) + .limit(limit) + .offset(offset) + .returnStableTerm(returnStableTerm) + .options(buildOptions(timeout, null)); + + return executeWithRetry(() -> generateApi.strings(request)).thenApply( + resp -> { + GenerateStringsResponseDto data = resp.getData(); + if (data.getTerm() != null) { + term.setCachedStableTerm(Term.fromDto(data.getTerm())); + } + return data.getStrings().getValue(); + } + ); + } +} diff --git a/src/main/java/com/regexsolver/api/Cardinality.java b/src/main/java/com/regexsolver/api/Cardinality.java new file mode 100644 index 0000000..3718012 --- /dev/null +++ b/src/main/java/com/regexsolver/api/Cardinality.java @@ -0,0 +1,146 @@ +package com.regexsolver.api; + +import com.regexsolver.api.generated.model.CardinalityBigIntegerDto; +import com.regexsolver.api.generated.model.CardinalityDto; +import com.regexsolver.api.generated.model.CardinalityIntegerDto; +import java.util.Objects; +import java.util.Optional; + +/** Base class representing the number of unique strings matched by a term. */ +public abstract class Cardinality extends TermPropertiesMixin { + + private Cardinality() {} + + static Cardinality fromDto(CardinalityDto card) { + Object inst = card.getActualInstance(); + if (inst instanceof CardinalityIntegerDto) { + return new Cardinality.Integer( + ((CardinalityIntegerDto) inst).getValue() + ); + } else if (inst instanceof CardinalityBigIntegerDto) { + return new Cardinality.BigInteger(); + } else { + return new Cardinality.Infinite(); + } + } + + /** Indicates that the set of matched strings is finite and exactly calculable. + * @param value The exact count of uniquely matched strings. + */ + public static final class Integer extends Cardinality { + + private final long value; + + public Integer(long value) { + this.value = value; + } + + public long getValue() { + return value; + } + + @Override + public Optional isEmpty() { + return Optional.of(value == 0); + } + + @Override + public Optional isEmptyString() { + if (this.value == 1) { + return Optional.empty(); + } + return Optional.of(false); + } + + @Override + public Optional isTotal() { + return Optional.of(false); + } + + @Override + public String toString() { + return String.format("", this.value); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Integer integer = (Integer) o; + return value == integer.value; + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + } + + /** Indicates that the set of matched strings is finite but too large to be returned as a standard integer. */ + public static final class BigInteger extends Cardinality { + + @Override + public Optional isEmpty() { + return Optional.of(false); + } + + @Override + public Optional isEmptyString() { + return Optional.of(false); + } + + @Override + public Optional isTotal() { + return Optional.of(false); + } + + @Override + public String toString() { + return ""; + } + + @Override + public boolean equals(Object o) { + return o instanceof BigInteger; + } + + @Override + public int hashCode() { + return 0; + } + } + + /** Indicates that the set of matched strings is infinite. */ + public static final class Infinite extends Cardinality { + + @Override + public Optional isEmpty() { + return Optional.of(false); + } + + @Override + public Optional isEmptyString() { + return Optional.of(false); + } + + @Override + public Optional isTotal() { + return Optional.empty(); + } + + @Override + public String toString() { + return ""; + } + + @Override + public boolean equals(Object o) { + return o instanceof Infinite; + } + + @Override + public int hashCode() { + return 0; + } + } +} diff --git a/src/main/java/com/regexsolver/api/Length.java b/src/main/java/com/regexsolver/api/Length.java new file mode 100644 index 0000000..ba1d97a --- /dev/null +++ b/src/main/java/com/regexsolver/api/Length.java @@ -0,0 +1,76 @@ +package com.regexsolver.api; + +import com.regexsolver.api.generated.model.LengthDto; +import java.util.Objects; +import java.util.Optional; + +/** + * Represents the minimum and maximum lengths of any string matched by the term. + */ +public final class Length extends TermPropertiesMixin { + + private final Integer min; + private final Integer max; + + public Length(Integer min, Integer max) { + this.min = min; + this.max = max; + } + + static Length fromDto(LengthDto len) { + return new Length(len.getMin(), len.getMax()); + } + + /** The shortest possible matched string length, or {@link Optional::empty} if the language is empty. */ + public Optional getMin() { + return Optional.ofNullable(min); + } + + /** The longest possible matched string length, or {@link Optional::empty} if the length is unbounded. */ + public Optional getMax() { + return Optional.ofNullable(max); + } + + @Override + public Optional isEmpty() { + return Optional.of(this.min == null && this.max == null); + } + + @Override + public Optional isEmptyString() { + return Optional.of(this.min == 0 && this.max == 0); + } + + @Override + public Optional isTotal() { + if (this.min != 0 || this.max != null) { + return Optional.of(false); + } else { + return Optional.empty(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Length length = (Length) o; + return ( + Objects.equals(min, length.min) && Objects.equals(max, length.max) + ); + } + + @Override + public int hashCode() { + return Objects.hash(min, max); + } + + @Override + public String toString() { + return String.format( + "", + min == null ? "null" : min, + max == null ? "null" : max + ); + } +} diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java deleted file mode 100644 index 836e039..0000000 --- a/src/main/java/com/regexsolver/api/OperationOptions.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.regexsolver.api; - -public class OperationOptions { - protected ResponseFormat responseFormat; - protected Integer executionTimeout; - - public static OperationOptions newDefault() { - return new OperationOptions(); - } - - public OperationOptions responseFormat(ResponseFormat responseFormat) { - this.responseFormat = responseFormat; - return this; - } - - public ResponseFormat responseFormat() { - return responseFormat; - } - - public OperationOptions executionTimeout(Integer executionTimeout) { - this.executionTimeout = executionTimeout; - return this; - } - - public Integer executionTimeout() { - return executionTimeout; - } -} diff --git a/src/main/java/com/regexsolver/api/RateLimiter.java b/src/main/java/com/regexsolver/api/RateLimiter.java new file mode 100644 index 0000000..6ad1f24 --- /dev/null +++ b/src/main/java/com/regexsolver/api/RateLimiter.java @@ -0,0 +1,54 @@ +package com.regexsolver.api; + +import java.time.Duration; +import java.time.Instant; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; + +/** + * Global rate limiter shared by apiToken. + */ +class RateLimiter { + + private static final ConcurrentHashMap INSTANCES = + new ConcurrentHashMap<>(); + + private final AtomicReference retryAfter = new AtomicReference<>( + Instant.MIN + ); + + private RateLimiter() {} + + public static RateLimiter getInstance(String apiToken) { + return INSTANCES.computeIfAbsent(apiToken, k -> new RateLimiter()); + } + + public CompletableFuture waitIfNecessary() { + Instant now = Instant.now(); + Instant retryAt = retryAfter.get(); + + if (retryAt.isAfter(now)) { + long delay = Duration.between(now, retryAt).toMillis(); + if (delay > 0) { + return CompletableFuture.runAsync(() -> { + try { + Thread.sleep(delay); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + }); + } + } + return CompletableFuture.completedFuture(null); + } + + public void trigger(double seconds) { + Instant nextRetry = Instant.now().plus( + Duration.ofMillis((long) (seconds * 1000)) + ); + retryAfter.updateAndGet(current -> + nextRetry.isAfter(current) ? nextRetry : current + ); + } +} diff --git a/src/main/java/com/regexsolver/api/RegexSolver.java b/src/main/java/com/regexsolver/api/RegexSolver.java deleted file mode 100644 index 612b0de..0000000 --- a/src/main/java/com/regexsolver/api/RegexSolver.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.regexsolver.api; - -public final class RegexSolver { - public static void initialize() { - RegexSolverApiWrapper.initialize(); - } - - public static void initialize(String token) { - RegexSolverApiWrapper.initialize(token); - } - - public static void initialize(String token, String baseUrl) { - RegexSolverApiWrapper.initialize(token, baseUrl); - } -} diff --git a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java b/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java deleted file mode 100644 index f2332af..0000000 --- a/src/main/java/com/regexsolver/api/RegexSolverApiWrapper.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.regexsolver.api; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.regexsolver.api.Request.GenerateStringsRequest; -import com.regexsolver.api.Request.MultiTermsRequest; -import com.regexsolver.api.Request.RepeatRequest; -import com.regexsolver.api.Response.BooleanResponse; -import com.regexsolver.api.Response.StringResponse; -import com.regexsolver.api.Response.StringsResponse; -import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Length; -import com.regexsolver.api.exception.ApiError; -import com.regexsolver.api.exception.MissingAPITokenException; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.ResponseBody; -import retrofit2.Call; -import retrofit2.Response; -import retrofit2.Retrofit; -import retrofit2.converter.jackson.JacksonConverterFactory; -import retrofit2.http.Body; -import retrofit2.http.POST; - -import java.io.IOException; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -final class RegexSolverApiWrapper { - private static final RegexSolverApiWrapper INSTANCE = new RegexSolverApiWrapper(); - - private final static String DEFAULT_BASE_URL = "https://api.regexsolver.com/v1/"; - - private final static String USER_AGENT = "RegexSolver Java / 1.1.0"; - - private RegexApi api; - - public static RegexSolverApiWrapper getInstance() { - return INSTANCE; - } - - private RegexSolverApiWrapper() { - initializeInternal(null, DEFAULT_BASE_URL); - } - - private static String getConfiguredBaseUrl() { - return Optional.ofNullable(System.getenv("REGEXSOLVER_BASE_URL")).orElse(DEFAULT_BASE_URL); - } - - static void initialize() { - getInstance().initializeInternal(System.getenv("REGEXSOLVER_API_TOKEN"), getConfiguredBaseUrl()); - } - - static void initialize(String token) { - getInstance().initializeInternal(token, getConfiguredBaseUrl()); - } - - static void initialize(String token, String baseUrl) { - getInstance().initializeInternal(token, baseUrl); - } - - private void initializeInternal(String token, String baseUrl) { - Retrofit retrofit = new Retrofit.Builder() - .client(new OkHttpClient.Builder().addInterceptor(chain -> { - if (token == null) { - throw new MissingAPITokenException(); - } - Request newRequest = chain.request().newBuilder() - .addHeader("User-Agent", USER_AGENT) - .addHeader("Authorization", "Bearer " + token) - .build(); - return chain.proceed(newRequest); - }).build()) - .baseUrl(baseUrl) - .addConverterFactory(JacksonConverterFactory.create()) - .build(); - - api = retrofit.create(RegexApi.class); - } - - // Analyze - - public Cardinality analyzeCardinality(Term term) throws ApiError, IOException { - Response response = api.analyzeCardinality(term).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public String analyzeDot(Term term) throws ApiError, IOException { - Response response = api.analyzeDot(term).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public boolean analyzeEquivalent(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.analyzeEquivalent(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public boolean analyzeEmpty(Term term) throws ApiError, IOException { - Response response = api.analyzeEmpty(term).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public boolean analyzeEmptyString(Term term) throws ApiError, IOException { - Response response = api.analyzeEmptyString(term).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public Length analyzeLength(Term term) throws ApiError, IOException { - Response response = api.analyzeLength(term).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public String analyzePattern(Term term) throws ApiError, IOException { - Response response = api.analyzePattern(term).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public boolean analyzeSubset(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.analyzeSubset(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - public boolean analyzeTotal(Term term) throws ApiError, IOException { - Response response = api.analyzeTotal(term).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - // Compute - - public Term computeConcat(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeConcat(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public Term computeDifference(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeDifference(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public Term computeIntersection(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeIntersection(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public Term computeRepeat(RepeatRequest repeatRequest) throws ApiError, IOException { - Response response = api.computeRepeat(repeatRequest).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - public Term computeUnion(MultiTermsRequest multiTermsRequest) throws ApiError, IOException { - Response response = api.computeUnion(multiTermsRequest).execute(); - if (response.isSuccessful()) { - return response.body(); - } else { - throw getApiError(response); - } - } - - // Generate - - public List generateStrings(GenerateStringsRequest generateStringsRequest) throws ApiError, IOException { - Response response = api.generateStrings(generateStringsRequest).execute(); - if (response.isSuccessful()) { - return response.body().value(); - } else { - throw getApiError(response); - } - } - - private static ApiError getApiError(Response response) throws IOException { - assert !response.isSuccessful(); - try (ResponseBody errorBody = response.errorBody()) { - String json = Objects.requireNonNull(errorBody).string(); - ObjectMapper mapper = new ObjectMapper(); - return mapper.readValue(json, ApiError.class); - } - } - - private interface RegexApi { - // analyze - @POST("analyze/cardinality") - Call analyzeCardinality(@Body Term term); - - @POST("analyze/dot") - Call analyzeDot(@Body Term term); - - @POST("analyze/equivalent") - Call analyzeEquivalent(@Body MultiTermsRequest multiTermsRequest); - - @POST("analyze/empty") - Call analyzeEmpty(@Body Term term); - - @POST("analyze/empty_string") - Call analyzeEmptyString(@Body Term term); - - @POST("analyze/length") - Call analyzeLength(@Body Term term); - - @POST("analyze/pattern") - Call analyzePattern(@Body Term term); - - @POST("analyze/subset") - Call analyzeSubset(@Body MultiTermsRequest multiTermsRequest); - - @POST("analyze/total") - Call analyzeTotal(@Body Term term); - - // compute - @POST("compute/concat") - Call computeConcat(@Body MultiTermsRequest multiTermsRequest); - - @POST("compute/difference") - Call computeDifference(@Body MultiTermsRequest multiTermsRequest); - - @POST("compute/intersection") - Call computeIntersection(@Body MultiTermsRequest multiTermsRequest); - - @POST("compute/repeat") - Call computeRepeat(@Body RepeatRequest repeatRequest); - - @POST("compute/union") - Call computeUnion(@Body MultiTermsRequest multiTermsRequest); - - // generate - @POST("generate/strings") - Call generateStrings(@Body GenerateStringsRequest request); - } -} diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java new file mode 100644 index 0000000..9191f3e --- /dev/null +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -0,0 +1,431 @@ +package com.regexsolver.api; + +import java.util.List; + +/** + * The Synchronous Client for RegexSolver. + * + * Provides blocking access to all RegexSolver API endpoints. + */ +public final class RegexSolverClient { + + private final AsyncRegexSolverClient asyncClient; + + private RegexSolverClient(AsyncRegexSolverClient asyncClient) { + this.asyncClient = asyncClient; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + + private final AsyncRegexSolverClient.Builder asyncBuilder = + AsyncRegexSolverClient.builder(); + + public Builder apiToken(String apiToken) { + asyncBuilder.apiToken(apiToken); + return this; + } + + public Builder baseUrl(String baseUrl) { + asyncBuilder.baseUrl(baseUrl); + return this; + } + + public RegexSolverClient build() { + return new RegexSolverClient(asyncBuilder.build()); + } + } + + // --- ANALYZE OPERATIONS --- + + /** + * Computes how many unique strings the term matches. + * + * @param term The term to analyze. + * @return A Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + */ + public Cardinality getCardinality(Term term) { + return asyncClient.getCardinality(term).join(); + } + + /** + * Computes how many unique strings the term matches, with a timeout. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + */ + public Cardinality getCardinality(Term term, Integer timeout) { + return asyncClient.getCardinality(term, timeout).join(); + } + + /** + * Computes the minimum and maximum length of strings matched by the term. + * + * @param term The term to analyze. + * @return A Length object containing min and max integers. Limits are null if unbounded or undefined. + */ + public Length getLength(Term term) { + return asyncClient.getLength(term).join(); + } + + /** + * Computes the minimum and maximum length of strings matched by the term, with a timeout. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return A Length object containing min and max integers. Limits are null if unbounded or undefined. + */ + public Length getLength(Term term, Integer timeout) { + return asyncClient.getLength(term, timeout).join(); + } + + /** + * Checks if the term matches no strings at all. + * + * @param term The term to analyze. + * @return True if the language is completely empty, false otherwise. + */ + public boolean isEmpty(Term term) { + return asyncClient.isEmpty(term).join(); + } + + /** + * Checks if the term matches no strings at all, with a timeout. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return True if the language is completely empty, false otherwise. + */ + public boolean isEmpty(Term term, Integer timeout) { + return asyncClient.isEmpty(term, timeout).join(); + } + + /** + * Checks if the term matches only the empty string. + * + * @param term The term to analyze. + * @return True if the term strictly matches the empty string ("") and nothing else. + */ + public boolean isEmptyString(Term term) { + return asyncClient.isEmptyString(term).join(); + } + + /** + * Checks if the term matches only the empty string, with a timeout. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return True if the term strictly matches the empty string ("") and nothing else. + */ + public boolean isEmptyString(Term term, Integer timeout) { + return asyncClient.isEmptyString(term, timeout).join(); + } + + /** + * Checks if the term matches all possible strings. + * + * @param term The term to analyze. + * @return True if the term matches every possible string. + */ + public boolean isTotal(Term term) { + return asyncClient.isTotal(term).join(); + } + + /** + * Checks if the term matches all possible strings, with a timeout. + * + * @param term The term to analyze. + * @param timeout Timeout in milliseconds for the operation. + * @return True if the term matches every possible string. + */ + public boolean isTotal(Term term, Integer timeout) { + return asyncClient.isTotal(term, timeout).join(); + } + + /** + * Returns a regular expression pattern that represents the term. + * + * @param term The term to extract the pattern from. + * @return A valid regular expression string representing the language. + */ + public String getPattern(Term term) { + return asyncClient.getPattern(term).join(); + } + + /** + * Returns a regular expression pattern that represents the term, with a timeout. + * + * @param term The term to extract the pattern from. + * @param timeout Timeout in milliseconds for the operation. + * @return A valid regular expression string representing the language. + */ + public String getPattern(Term term, Integer timeout) { + return asyncClient.getPattern(term, timeout).join(); + } + + /** + * Builds a Graphviz DOT representation of the term's automaton. + * + * @param term The term to visualize. + * @return The raw DOT syntax for Graphviz compilation. + */ + public String getDot(Term term) { + return asyncClient.getDot(term).join(); + } + + /** + * Builds a Graphviz DOT representation of the term's automaton, with a timeout. + * + * @param term The term to visualize. + * @param timeout Timeout in milliseconds for the operation. + * @return The raw DOT syntax for Graphviz compilation. + */ + public String getDot(Term term, Integer timeout) { + return asyncClient.getDot(term, timeout).join(); + } + + /** + * Checks if the two terms accept exactly the same language. + * + * @param term1 The first term. + * @param term2 The second term to compare against. + * @return True if they are entirely equivalent, false otherwise. + */ + public boolean equivalent(Term term1, Term term2) { + return asyncClient.equivalent(term1, term2).join(); + } + + /** + * Checks if the two terms accept exactly the same language, with a timeout. + * + * @param term1 The first term. + * @param term2 The second term to compare against. + * @param timeout Timeout in milliseconds for the operation. + * @return True if they are entirely equivalent, false otherwise. + */ + public boolean equivalent(Term term1, Term term2, Integer timeout) { + return asyncClient.equivalent(term1, term2, timeout).join(); + } + + /** + * Checks if the first term's language is a subset of the second term's language. + * + * @param subset The term to test as the subset. + * @param superset The term representing the entire set space. + * @return True if every string matched by subset is also matched by superset. + */ + public boolean subset(Term subset, Term superset) { + return asyncClient.subset(subset, superset).join(); + } + + /** + * Checks if the first term's language is a subset of the second term's language, with a timeout. + * + * @param subset The term to test as the subset. + * @param superset The term representing the entire set space. + * @param timeout Timeout in milliseconds for the operation. + * @return True if every string matched by subset is also matched by superset. + */ + public boolean subset(Term subset, Term superset, Integer timeout) { + return asyncClient.subset(subset, superset, timeout).join(); + } + + // --- COMPUTE OPERATIONS --- + + /** + * Concatenates the given terms sequentially. + * + * @param terms A list of terms to concatenate in order. + * @return A newly computed concatenated term. + */ + public Term concat(List terms) { + return asyncClient.concat(terms).join(); + } + + /** + * Concatenates the given terms sequentially, allowing for format and timeout specification. + * + * @param terms A list of terms to concatenate in order. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A newly computed concatenated term. + */ + public Term concat( + List terms, + ResponseFormat format, + Integer timeout + ) { + return asyncClient.concat(terms, format, timeout).join(); + } + + /** + * Computes the intersection of the given terms. + * + * @param terms A list of terms to intersect. + * @return A term representing only strings matched by ALL provided terms. + */ + public Term intersection(List terms) { + return asyncClient.intersection(terms).join(); + } + + /** + * Computes the intersection of the given terms, allowing for format and timeout specification. + * + * @param terms A list of terms to intersect. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A term representing only strings matched by ALL provided terms. + */ + public Term intersection( + List terms, + ResponseFormat format, + Integer timeout + ) { + return asyncClient.intersection(terms, format, timeout).join(); + } + + /** + * Computes the union of the given terms. + * + * @param terms A list of terms to combine. + * @return A term representing strings matched by ANY of the provided terms. + */ + public Term union(List terms) { + return asyncClient.union(terms).join(); + } + + /** + * Computes the union of the given terms, allowing for format and timeout specification. + * + * @param terms A list of terms to combine. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A term representing strings matched by ANY of the provided terms. + */ + public Term union( + List terms, + ResponseFormat format, + Integer timeout + ) { + return asyncClient.union(terms, format, timeout).join(); + } + + /** + * Computes the difference between the two provided terms. + * + * @param base The base language term to subtract from. + * @param excluded The term whose language should be removed from the base. + * @return A computed difference term. + */ + public Term difference(Term base, Term excluded) { + return asyncClient.difference(base, excluded).join(); + } + + /** + * Computes the difference between the two provided terms, allowing for format and timeout specification. + * + * @param base The base language term to subtract from. + * @param excluded The term whose language should be removed from the base. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A computed difference term. + */ + public Term difference( + Term base, + Term excluded, + ResponseFormat format, + Integer timeout + ) { + return asyncClient.difference(base, excluded, format, timeout).join(); + } + + /** + * Computes the complement of the given term. + * + * @param term The term to complement. + * @return The complemented term. + */ + public Term complement(Term term) { + return asyncClient.complement(term).join(); + } + + /** + * Computes the complement of the given term, allowing for format and timeout specification. + * + * @param term The term to complement. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return The complemented term. + */ + public Term complement(Term term, ResponseFormat format, Integer timeout) { + return asyncClient.complement(term, format, timeout).join(); + } + + /** + * Repeats a term between a minimum and maximum number of times. + * + * @param term The term to repeat. + * @param min The inclusive lower bound of repetitions. + * @param max The inclusive upper bound. If null, repetitions are unbounded. + * @return A computed repeated term. + */ + public Term repeat(Term term, int min, Integer max) { + return asyncClient.repeat(term, min, max).join(); + } + + /** + * Repeats a term between a minimum and maximum number of times, allowing for format and timeout specification. + * + * @param term The term to repeat. + * @param min The inclusive lower bound of repetitions. + * @param max The inclusive upper bound. If null, repetitions are unbounded. + * @param format The return format of the term (any, regex or fair). + * @param timeout Timeout in milliseconds for the operation. + * @return A computed repeated term. + */ + public Term repeat( + Term term, + int min, + Integer max, + ResponseFormat format, + Integer timeout + ) { + return asyncClient.repeat(term, min, max, format, timeout).join(); + } + + // --- GENERATE OPERATIONS --- + + /** + * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings. + * + * @param term The term to sample generated strings from. + * @param limit The maximum number of unique strings to return. + * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. + * @return A list of strings that match the term. + */ + public List generateStrings(Term term, int limit, int offset) { + return asyncClient.generateStrings(term, limit, offset).join(); + } + + /** + * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings, with a timeout. + * + * @param term The term to sample generated strings from. + * @param limit The maximum number of unique strings to return. + * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. + * @param timeout Timeout in milliseconds for the operation. + * @return A list of strings that match the term. + */ + public List generateStrings( + Term term, + int limit, + int offset, + Integer timeout + ) { + return asyncClient.generateStrings(term, limit, offset, timeout).join(); + } +} diff --git a/src/main/java/com/regexsolver/api/Request.java b/src/main/java/com/regexsolver/api/Request.java deleted file mode 100644 index 1aedbf4..0000000 --- a/src/main/java/com/regexsolver/api/Request.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.regexsolver.api; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -final class Request { - @JsonInclude(JsonInclude.Include.NON_NULL) - static final class RequestOptions { - private final ResponseOptions response; - private final ExecutionOptions execution; - - public static RequestOptions fromArgs( - ResponseFormat format, - Integer timeout) { - - ResponseOptions response = null; - if (format != null) { - response = new ResponseOptions(format); - } - - ExecutionOptions execution = null; - if (timeout != null) { - execution = new ExecutionOptions(timeout); - } - - if (response == null && execution == null) { - return null; - } else { - return new RequestOptions(response, execution); - } - } - - public RequestOptions( - @JsonProperty("response") ResponseOptions response, - @JsonProperty("execution") ExecutionOptions execution) { - this.response = response; - this.execution = execution; - } - - public int getSchemaVersion() { - return 1; - } - - public ResponseOptions getResponse() { - return response; - } - - public ExecutionOptions getExecution() { - return execution; - } - - public static final class ResponseOptions { - private final ResponseFormat format; - - public ResponseOptions(@JsonProperty("format") ResponseFormat format) { - this.format = format; - } - - public ResponseFormat getFormat() { - return format; - } - } - - public static final class ExecutionOptions { - private final Integer timeout; - - public ExecutionOptions(@JsonProperty("timeout") Integer timeout) { - this.timeout = timeout; - } - - public Integer getTimeout() { - return timeout; - } - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - static final class MultiTermsRequest { - private final List terms; - private final RequestOptions options; - - public MultiTermsRequest(@JsonProperty("terms") List terms, - @JsonProperty("options") RequestOptions options) { - this.terms = terms; - this.options = options; - } - - public List getTerms() { - return terms; - } - - public RequestOptions getOptions() { - return options; - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - static final class RepeatRequest { - private final Term term; - private final int min; - private final Integer max; - private final RequestOptions options; - - public RepeatRequest( - @JsonProperty("term") Term term, - @JsonProperty("min") int min, - @JsonProperty("max") Integer max, - @JsonProperty("options") RequestOptions options) { - this.term = term; - this.min = min; - this.max = max; - this.options = options; - } - - public Term getTerm() { - return term; - } - - public int getMin() { - return min; - } - - public Integer getMax() { - return max; - } - - public RequestOptions getOptions() { - return options; - } - } - - @JsonInclude(JsonInclude.Include.NON_NULL) - static final class GenerateStringsRequest { - private final Term term; - private final int count; - private final RequestOptions options; - - public GenerateStringsRequest( - @JsonProperty("term") Term term, - @JsonProperty("count") int count, - @JsonProperty("options") RequestOptions options) { - this.term = term; - this.count = count; - this.options = options; - } - - public Term getTerm() { - return term; - } - - public int getCount() { - return count; - } - - public RequestOptions getOptions() { - return options; - } - } -} diff --git a/src/main/java/com/regexsolver/api/Response.java b/src/main/java/com/regexsolver/api/Response.java deleted file mode 100644 index 27ed766..0000000 --- a/src/main/java/com/regexsolver/api/Response.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.regexsolver.api; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -final class Response { - public static final class BooleanResponse implements ResponseContent { - private final boolean value; - - public BooleanResponse(@JsonProperty("value") boolean value) { - this.value = value; - } - - public boolean value() { - return value; - } - } - - public static final class StringResponse implements ResponseContent { - private final String value; - - public StringResponse(@JsonProperty("value") String value) { - this.value = value; - } - - public String value() { - return value; - } - } - - public static final class StringsResponse implements ResponseContent { - private final List value; - - public StringsResponse(@JsonProperty("value") List value) { - this.value = value; - } - - public List value() { - return value; - } - } -} diff --git a/src/main/java/com/regexsolver/api/ResponseContent.java b/src/main/java/com/regexsolver/api/ResponseContent.java deleted file mode 100644 index 5b4f260..0000000 --- a/src/main/java/com/regexsolver/api/ResponseContent.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.regexsolver.api; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.regexsolver.api.Response.BooleanResponse; -import com.regexsolver.api.Response.StringResponse; -import com.regexsolver.api.Response.StringsResponse; - -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") -@JsonSubTypes({ - @JsonSubTypes.Type(value = Term.Fair.class, name = "fair"), - @JsonSubTypes.Type(value = Term.Regex.class, name = "regex"), - @JsonSubTypes.Type(value = StringResponse.class, name = "string"), - @JsonSubTypes.Type(value = StringsResponse.class, name = "strings"), - @JsonSubTypes.Type(value = BooleanResponse.class, name = "boolean"), -}) -public interface ResponseContent { -} diff --git a/src/main/java/com/regexsolver/api/ResponseFormat.java b/src/main/java/com/regexsolver/api/ResponseFormat.java index a1aeee5..6398689 100644 --- a/src/main/java/com/regexsolver/api/ResponseFormat.java +++ b/src/main/java/com/regexsolver/api/ResponseFormat.java @@ -1,12 +1,27 @@ package com.regexsolver.api; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.regexsolver.api.generated.model.ResponseOptionsDto.FormatEnum; +/** + * Used in compute operations to specify the format of the result. + */ public enum ResponseFormat { - @JsonProperty("any") ANY, - @JsonProperty("regex") REGEX, - @JsonProperty("fair") - FAIR + FAIR; + + public FormatEnum toDto() { + switch (this) { + case ANY: + return FormatEnum.ANY; + case REGEX: + return FormatEnum.REGEX; + case FAIR: + return FormatEnum.FAIR; + default: + throw new IllegalArgumentException( + String.format("Unsupported ResponseFormat %s.", this) + ); + } + } } diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 433f471..665540d 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -1,548 +1,184 @@ package com.regexsolver.api; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.regexsolver.api.Request.GenerateStringsRequest; -import com.regexsolver.api.Request.MultiTermsRequest; -import com.regexsolver.api.Request.RepeatRequest; -import com.regexsolver.api.Request.RequestOptions; -import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Length; -import com.regexsolver.api.exception.ApiError; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import com.regexsolver.api.generated.model.TermDto; +import com.regexsolver.api.generated.model.TermFairDto; +import com.regexsolver.api.generated.model.TermRegexDto; import java.util.Objects; import java.util.Optional; +import java.util.regex.Pattern; /** - * This abstract class represents a term on which it is possible to perform - * operations. + * Represents a mathematical term (Regex or FAIR) on which operations can be performed. */ -public abstract class Term implements ResponseContent { - @JsonIgnore - private final static String REGEX_PREFIX = "regex"; - @JsonIgnore - private final static String FAIR_PREFIX = "fair"; - @JsonIgnore - private final static String UNKNOWN_PREFIX = "unknown"; +public abstract class Term { private final String value; - @JsonIgnore - private transient String serialized = null; - - @JsonIgnore - private transient Cardinality cardinality; - @JsonIgnore - private transient Length length; - @JsonIgnore - private transient Boolean empty; - @JsonIgnore - private transient Boolean total; - @JsonIgnore - private transient Boolean emptyString; - @JsonIgnore - private transient String pattern; - @JsonIgnore - private transient String dot; + // Shared Cache (Internal) + private Cardinality cardinality; + private Length length; + private Boolean empty; + private Boolean emptyString; + private Boolean total; + protected String pattern; + private String dot; + private Term stableTerm; + + private Pattern compiledRegex; - /** - * Create a new instance. - * - * @param value The value of the term. - */ protected Term(String value) { this.value = value; } - /** - * Create a new instance of {@link Term.Regex}. - * - * @param regex The regular expression pattern. - * @return The created instance. - */ - public static Term.Regex regex(String regex) { - return new Term.Regex(regex); - } + public abstract Optional getPattern(); - /** - * Create a new instance of {@link Term.Fair}. - * - * @param fair The FAIR. - * @return The created instance. - */ - public static Term.Fair fair(String fair) { - return new Term.Fair(fair); - } + public abstract Optional getFair(); - public String getValue() { - return value; - } + abstract TermDto toDto(); - private static RequestOptions loadRequestOptions(OperationOptions opts) { - RequestOptions requestOptions = null; - if (opts != null) { - requestOptions = RequestOptions.fromArgs(opts.responseFormat(), opts.executionTimeout()); - } - return requestOptions; + public static Term regex(String pattern) { + return new RegexTerm(pattern); } - // Analyze - - /** - * Check equivalence with the given term. - * - * @param opts Execution options. - * @param term The term to check equivalence with. - * @return true if the terms are equivalent, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean equivalent(OperationOptions opts, Term term) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .analyzeEquivalent(new MultiTermsRequest(getArgs(term), - loadRequestOptions(opts))); + public static Term fair(String payload) { + return new FairTerm(payload); } - /** - * Check equivalence with the given term. - * - * @param term The term to check equivalence with. - * @return true if the terms are equivalent, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean equivalent(Term term) throws IOException, ApiError { - return equivalent(null, term); - } - - /** - * Get the cardinality of this term. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return A `Cardinality` object describing how many distinct strings are - * matched. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Cardinality getCardinality() throws IOException, ApiError { - if (cardinality != null) { - return cardinality; - } - cardinality = RegexSolverApiWrapper.getInstance() - .analyzeCardinality(this); - return cardinality; - } + // --- Shared Behavior --- - /** - * Get the GraphViz DOT representation of this term. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return A DOT language string describing the automaton for this term. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public String getDot() throws IOException, ApiError { - if (dot != null) { - return dot; - } - dot = RegexSolverApiWrapper.getInstance() - .analyzeDot(this); - return dot; + public String getValue() { + return value; } - /** - * Return the Fast Automaton Internal Representation (FAIR). - * - * @return The FAIR. - */ - @JsonIgnore - public String getFair() throws IOException, ApiError { - return null; + void setPropertiesMixin(TermPropertiesMixin propertiesMixin) { + propertiesMixin.isEmpty().ifPresent(this::setCachedEmpty); + propertiesMixin.isEmptyString().ifPresent(this::setCachedEmptyString); + propertiesMixin.isTotal().ifPresent(this::setCachedTotal); } /** - * Get the length bounds of this term. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return A `Length` object with the minimum and maximum string length matched - * by this term. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. + * Client-side matching implementation. + * @param str The string to test against the term. + * @return True if matches, false if not. Throws if pattern is not set. */ - @JsonIgnore - public Length getLength() throws IOException, ApiError { - if (length != null) { - return length; + public boolean isMatch(String str) { + Optional patternOpt = getPattern(); + if (patternOpt.isEmpty()) { + throw new IllegalStateException( + "The regex pattern of this term is not defined yet, call getPattern() on the client to set it." + ); } - length = RegexSolverApiWrapper.getInstance() - .analyzeLength(this); - return length; - } - - /** - * Return the regular expression pattern. - * - * If the term is not a regex the pattern will be resolved. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return The regular expression pattern. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public String getPattern() throws IOException, ApiError { - if (pattern != null) { - return pattern; + if (compiledRegex == null) { + compiledRegex = Pattern.compile(patternOpt.get(), Pattern.DOTALL); } - pattern = RegexSolverApiWrapper.getInstance() - .analyzePattern(this); - return pattern; + return compiledRegex.matcher(str).matches(); } - /** - * Check whether this term matches no string. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return true if the term is empty, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean isEmpty() throws IOException, ApiError { - if (empty != null) { - return empty; - } - - empty = RegexSolverApiWrapper.getInstance() - .analyzeEmpty(this); - return empty; - } + public abstract String serialize(); - /** - * Check whether this term matches only the empty string. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return true if the term only matches the empty string, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean isEmptyString() throws IOException, ApiError { - if (emptyString != null) { - return emptyString; + public static Optional deserialize(String serialized) { + if (serialized == null || !serialized.contains("=")) { + return Optional.empty(); } - emptyString = RegexSolverApiWrapper.getInstance() - .analyzeEmptyString(this); - return emptyString; - } + int index = serialized.indexOf("="); + String typeStr = serialized.substring(0, index); + String val = serialized.substring(index + 1); - /** - * Check whether this term matches all possible strings. - * Cache the result to avoid calling the API again if this method is called - * multiple times. - * - * @return true if the term matches all possible strings, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean isTotal() throws IOException, ApiError { - if (total != null) { - return total; + if ("regex".equalsIgnoreCase(typeStr)) { + return Optional.of(regex(val)); + } else if ("fair".equalsIgnoreCase(typeStr)) { + return Optional.of(fair(val)); } - - total = RegexSolverApiWrapper.getInstance() - .analyzeTotal(this); - return total; - } - - /** - * Check if is a subset of the given term. - * - * @param opts Execution options. - * @param term The term to check if is the superset of this. - * @return true if this is a subset, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean subset(OperationOptions opts, Term term) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .analyzeSubset(new MultiTermsRequest(getArgs(term), loadRequestOptions(opts))); + return Optional.empty(); } - /** - * Check if is a subset of the given term. - * - * @param term The term to check if is the superset of this. - * @return true if this is a subset, false otherwise. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public boolean subset(Term term) throws IOException, ApiError { - return subset(null, term); + static Term fromDto(TermDto dto) { + Object instance = dto.getActualInstance(); + if (instance instanceof TermRegexDto) { + return Term.regex(((TermRegexDto) instance).getValue()); + } else { + return Term.fair(((TermFairDto) instance).getValue()); + } } - // Compute + // --- Shared Getters/Setters --- - @JsonIgnore - private List getArgs(Term... terms) { - ArrayList args = new ArrayList<>(); - args.add(this); - args.addAll(List.of(terms)); - return args; + Cardinality getCachedCardinality() { + return cardinality; } - /** - * Compute the concat with the given terms and return the resulting term. - * - * @param opts Execution options. - * @param terms The terms to compute an concat with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term concat(OperationOptions opts, Term... terms) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeConcat(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); + void setCachedCardinality(Cardinality cardinality) { + setPropertiesMixin(cardinality); + this.cardinality = cardinality; } - /** - * Compute the concat with the given terms and return the resulting term. - * - * @param terms The terms to compute an concat with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term concat(Term... terms) throws IOException, ApiError { - return concat(null, terms); + Length getCachedLength() { + return length; } - /** - * Compute the difference with the given term and return the resulting term. - * - * @param opts Execution options. - * @param term The term to subtract. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term difference(OperationOptions opts, Term term) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeDifference(new MultiTermsRequest(getArgs(term), loadRequestOptions(opts))); + void setCachedLength(Length length) { + setPropertiesMixin(length); + this.length = length; } - /** - * Compute the difference with the given term and return the resulting term. - * - * @param term The term to subtract. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term difference(Term term) throws IOException, ApiError { - return difference(null, term); + Boolean getCachedEmpty() { + return empty; } - /** - * Compute the intersection with the given terms and return the resulting term. - * - * @param opts Execution options. - * @param terms The terms to compute an intersection with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term intersection(OperationOptions opts, Term... terms) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeIntersection(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); + void setCachedEmpty(Boolean empty) { + this.empty = empty; } - /** - * Compute the intersection with the given terms and return the resulting term. - * - * @param terms The terms to compute an intersection with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term intersection(Term... terms) throws IOException, ApiError { - return intersection(null, terms); + Boolean getCachedEmptyString() { + return emptyString; } - /** - * Computes the repetition of the term between `min` and `max` times; if `max` - * is `null`, the repetition is unbounded. - * - * @param opts Execution options. - * @param min The lower bound of the repetition. - * @param max The upper bound of the repetition, if `null` the repetition is - * unbounded. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term repeat(OperationOptions opts, int min, Integer max) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeRepeat(new RepeatRequest(this, min, max, loadRequestOptions(opts))); + void setCachedEmptyString(Boolean emptyString) { + this.emptyString = emptyString; } - /** - * Computes the repetition of the term between `min` and `max` times; if `max` - * is `null`, the repetition is unbounded. - * - * @param min The lower bound of the repetition. - * @param max The upper bound of the repetition, if `null` the repetition is - * unbounded. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term repeat(int min, Integer max) throws IOException, ApiError { - return repeat(null, min, max); + Boolean getCachedTotal() { + return total; } - /** - * Compute the union with the given terms and return the resulting term. - * - * @param opts Execution options. - * @param terms The terms to compute a union with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term union(OperationOptions opts, Term... terms) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .computeUnion(new MultiTermsRequest(getArgs(terms), loadRequestOptions(opts))); + void setCachedTotal(Boolean total) { + this.total = total; } - /** - * Compute the union with the given terms and return the resulting term. - * - * @param terms The terms to compute a union with. - * @return The resulting term - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public Term union(Term... terms) throws IOException, ApiError { - return union(null, terms); + void setCachedPattern(String pattern) { + this.pattern = pattern; } - // Generate - - /** - * Generate the given number of unique strings matched by this term. - * - * @param opts Execution options. - * @param count The number of unique strings to generate. - * @return A list of unique strings matched by this term. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public List generateStrings(OperationOptions opts, int count) throws IOException, ApiError { - return RegexSolverApiWrapper.getInstance() - .generateStrings(new GenerateStringsRequest(this, count, loadRequestOptions(opts))); + String getCachedDot() { + return dot; } - /** - * Generate the given number of unique strings matched by this term. - * - * @param count The number of unique strings to generate. - * @return A list of unique strings matched by this term. - * @throws IOException In case of issues requesting the API server. - * @throws ApiError In case of error returned by the API. - */ - @JsonIgnore - public List generateStrings(int count) throws IOException, ApiError { - return generateStrings(null, count); + void setCachedDot(String dot) { + this.dot = dot; } - /** - * Generate a string representation that can be parsed by - * {@link #deserialize(String)}. - * - * @return A string representation of this term. - */ - public String serialize() { - if (serialized != null) { - return serialized; - } - String prefix; - if (this instanceof Regex) { - prefix = REGEX_PREFIX; - } else if (this instanceof Fair) { - prefix = FAIR_PREFIX; - } else { - prefix = UNKNOWN_PREFIX; - } - serialized = String.format("%s=%s", prefix, value); - return serialized; + Term getCachedStableTerm() { + return stableTerm; } - /** - * Parse a string representation of a {@link Term} produced by - * {@link #serialize()}. - * - * @param string A string representation produced by {@link #serialize()}. - * @return The parsed term, or empty if the method was not able to parse. - */ - @JsonIgnore - public static Optional deserialize(String string) { - if (string == null) { - return Optional.empty(); - } - - if (string.startsWith(REGEX_PREFIX)) { - return Optional.of(regex(string.substring(REGEX_PREFIX.length() + 1))); - } else if (string.startsWith(FAIR_PREFIX)) { - return Optional.of(fair(string.substring(FAIR_PREFIX.length() + 1))); - } else { - return Optional.empty(); - } + void setCachedStableTerm(Term stableTerm) { + this.stableTerm = stableTerm; } @Override public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; Term term = (Term) o; - return Objects.equals(term.serialize(), serialize()); + return Objects.equals(serialize(), term.serialize()); } @Override public int hashCode() { - return Objects.hash(serialize()); + return serialize().hashCode(); } @Override @@ -550,51 +186,59 @@ public String toString() { return serialize(); } - /** - * This term represents a Fast Automaton Internal Representation (FAIR). - *

- * You can learn more about FAIR in our - * documentation. - *

- */ - public static final class Fair extends Term { - /** - * Create a new instance. - * - * @param fair The FAIR. - */ - public Fair(@JsonProperty("value") String fair) { - super(fair); + public static final class RegexTerm extends Term { + + RegexTerm(String value) { + super(value); + } + + @Override + public Optional getPattern() { + return Optional.of(getValue()); + } + + @Override + public Optional getFair() { + return Optional.ofNullable(getCachedStableTerm()).map(t -> + t.getFair().orElse(null) + ); + } + + @Override + TermDto toDto() { + return new TermDto(new TermRegexDto().value(getValue())); } - @JsonProperty("value") @Override - public String getFair() { - return getValue(); + public String serialize() { + return "regex=" + getValue(); } } - /** - * This term represents a regular expression. - *

- * You can learn more about regular expression in our - * documentation - *

- */ - public static final class Regex extends Term { - /** - * Create a new instance. - * - * @param regex The regular expression pattern. - */ - public Regex(@JsonProperty("value") String regex) { - super(regex); + public static final class FairTerm extends Term { + + FairTerm(String value) { + super(value); + } + + @Override + public Optional getPattern() { + return Optional.ofNullable(this.pattern); + } + + @Override + public Optional getFair() { + return Optional.of(getValue()); + } + + @Override + TermDto toDto() { + return new TermDto(new TermFairDto().value(getValue())); } - @JsonProperty("value") @Override - public String getPattern() { - return getValue(); + public String serialize() { + return "fair=" + getValue(); } } } diff --git a/src/main/java/com/regexsolver/api/TermPropertiesMixin.java b/src/main/java/com/regexsolver/api/TermPropertiesMixin.java new file mode 100644 index 0000000..a3db3cd --- /dev/null +++ b/src/main/java/com/regexsolver/api/TermPropertiesMixin.java @@ -0,0 +1,41 @@ +package com.regexsolver.api; + +import java.util.Optional; + +/** + * A mixin providing default property inference for Term analytics. + * + * Returns {@code Optional.empty()} when a property cannot be strictly inferred from the current data alone. + */ +abstract class TermPropertiesMixin { + + /** + * Infers whether the term matches no strings at all. + * + * @return An {@code Optional} containing {@code true} if it definitely matches no strings, + * {@code false} if it matches at least one, or {@code Optional.empty()} if it cannot be inferred. + */ + public Optional isEmpty() { + return Optional.empty(); + } + + /** + * Infers whether the term matches strictly the empty string (""). + * + * @return An {@code Optional} containing {@code true} if it definitely matches only the empty string, + * {@code false} if it matches other strings, or {@code Optional.empty()} if it cannot be inferred. + */ + public Optional isEmptyString() { + return Optional.empty(); + } + + /** + * Infers whether the term matches all possible strings. + * + * @return An {@code Optional} containing {@code true} if it definitely matches all strings, + * {@code false} if it misses at least one string, or {@code Optional.empty()} if it cannot be inferred. + */ + public Optional isTotal() { + return Optional.empty(); + } +} diff --git a/src/main/java/com/regexsolver/api/dto/Cardinality.java b/src/main/java/com/regexsolver/api/dto/Cardinality.java deleted file mode 100644 index d4689be..0000000 --- a/src/main/java/com/regexsolver/api/dto/Cardinality.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.regexsolver.api.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -/** - * Abstract class that represent the number of possible values. - */ -@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") -@JsonSubTypes({ - @JsonSubTypes.Type(value = Cardinality.BigInteger.class, name = "bigInteger"), - @JsonSubTypes.Type(value = Cardinality.Infinite.class, name = "infinite"), - @JsonSubTypes.Type(value = Cardinality.Integer.class, name = "integer") -}) -public abstract class Cardinality { - /** - * @return true if it has a finite number of values, false otherwise. - */ - public abstract boolean isFinite(); - - public abstract String toString(); - - /** - * An infinite number of possible values. - */ - public static final class Infinite extends Cardinality { - @Override - public boolean isFinite() { - return false; - } - - @Override - public String toString() { - return "Infinite"; - } - } - - /** - * A finite number of possible values, but the number is too big to be computed. - */ - public static final class BigInteger extends Cardinality { - @Override - public boolean isFinite() { - return true; - } - - @Override - public String toString() { - return "BigInteger"; - } - } - - /** - * A finite number of possible values, available in {@link #getCount()}. - */ - public static final class Integer extends Cardinality { - private final long count; - - /** - * Create a new instance. - * - * @param count The number of possible values. - */ - public Integer(@JsonProperty("value") long count) { - this.count = count; - } - - @Override - public boolean isFinite() { - return false; - } - - /** - * @return The number of possible values. - */ - public long getCount() { - return count; - } - - @Override - public String toString() { - return String.format("Integer(%s)", count); - } - } -} diff --git a/src/main/java/com/regexsolver/api/dto/Length.java b/src/main/java/com/regexsolver/api/dto/Length.java deleted file mode 100644 index 785870e..0000000 --- a/src/main/java/com/regexsolver/api/dto/Length.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.regexsolver.api.dto; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - -import java.io.IOException; -import java.util.Objects; -import java.util.OptionalLong; - -/** - * Contains the minimum and maximum length of possible values. - */ -@JsonDeserialize(using = Length.LengthDeserializer.class) -public final class Length { - private final Long minimum; - private final Long maximum; - - /** - * @param minimum the minimum length of possible values, empty if is an empty - * set. - * @param maximum the maximum length of possible values, empty if the maximum - * length is infinite or if is an empty set. - */ - Length(Long minimum, Long maximum) { - this.minimum = minimum; - this.maximum = maximum; - } - - /** - * @return The minimum length of possible values, empty if is an empty set. - */ - public OptionalLong getMinimum() { - if (minimum == null) { - return OptionalLong.empty(); - } - return OptionalLong.of(minimum); - } - - /** - * @return The maximum length of possible values, empty if the maximum length is - * infinite or if is an empty set. - */ - public OptionalLong getMaximum() { - if (maximum == null) { - return OptionalLong.empty(); - } - return OptionalLong.of(maximum); - } - - @Override - public boolean equals(Object obj) { - if (obj == this) - return true; - if (obj == null || obj.getClass() != this.getClass()) - return false; - var that = (Length) obj; - return Objects.equals(this.minimum, that.minimum) && - Objects.equals(this.maximum, that.maximum); - } - - @Override - public int hashCode() { - return Objects.hash(minimum, maximum); - } - - @Override - public String toString() { - return "Length[" + - "minimum=" + minimum + ", " + - "maximum=" + maximum + ']'; - } - - static class LengthDeserializer extends JsonDeserializer { - @Override - public Length deserialize(JsonParser jp, DeserializationContext ctx) - throws IOException { - JsonToken t = jp.currentToken(); - if (t == null) - t = jp.nextToken(); - - if (t == JsonToken.START_ARRAY) { - Long[] arr = jp.readValueAs(Long[].class); - if (arr == null || arr.length != 2) { - throw new IOException("Expected [minimum,maximum] array."); - } - return new Length(arr[0], arr[1]); - } - - if (t == JsonToken.START_OBJECT) { - Long min = null; - Long max = null; - - while (jp.nextToken() != JsonToken.END_OBJECT) { - String field = jp.currentName(); - jp.nextToken(); // move to value - if ("min".equals(field)) { - min = jp.currentToken() == JsonToken.VALUE_NULL ? null : jp.getLongValue(); - } else if ("max".equals(field)) { - max = jp.currentToken() == JsonToken.VALUE_NULL ? null : jp.getLongValue(); - } else { - jp.skipChildren(); // ignore unknown fields - } - } - return new Length(min, max); - } - - if (t == JsonToken.VALUE_NULL) { - return null; - } - - throw new IOException("Expected [minimum,maximum] array, or {minimum,maximum} object."); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/regexsolver/api/dto/package-info.java b/src/main/java/com/regexsolver/api/dto/package-info.java deleted file mode 100644 index e518844..0000000 --- a/src/main/java/com/regexsolver/api/dto/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains simple objects. - */ -package com.regexsolver.api.dto; \ No newline at end of file diff --git a/src/main/java/com/regexsolver/api/exception/ApiError.java b/src/main/java/com/regexsolver/api/exception/ApiError.java deleted file mode 100644 index b18d74c..0000000 --- a/src/main/java/com/regexsolver/api/exception/ApiError.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.regexsolver.api.exception; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Thrown when the API returns an error. - */ -@JsonIgnoreProperties(ignoreUnknown = true) -public class ApiError extends Exception { - /** - * Create a new instance. - * - * @param message The error message returned by the API. - */ - public ApiError(@JsonProperty("message") String message) { - super(String.format("The API returned the following error: %s", message)); - } -} diff --git a/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java b/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java deleted file mode 100644 index 4240691..0000000 --- a/src/main/java/com/regexsolver/api/exception/MissingAPITokenException.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.regexsolver.api.exception; - -/** - * Thrown if the API token has not been set as environment variable. - */ -public class MissingAPITokenException extends RuntimeException { - /** - * The API token has not been set, set the environment variable REGEXSOLVER_API_TOKEN and call RegexSolverApiWrapper.initialize() to set it. - * To generate a token go to RegexSolver Console. - */ - public MissingAPITokenException() { - super("The API token has not been set, set the environment variable REGEXSOLVER_API_TOKEN and call RegexSolverApiWrapper.initialize() to set it.\n" + - "To generate a token go to https://console.regexsolver.com/."); - } -} diff --git a/src/main/java/com/regexsolver/api/exception/package-info.java b/src/main/java/com/regexsolver/api/exception/package-info.java deleted file mode 100644 index bc21fdf..0000000 --- a/src/main/java/com/regexsolver/api/exception/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Contains exceptions that can be thrown while using the library. - */ -package com.regexsolver.api.exception; \ No newline at end of file diff --git a/src/main/java/com/regexsolver/api/exceptions/ApiException.java b/src/main/java/com/regexsolver/api/exceptions/ApiException.java new file mode 100644 index 0000000..1bc2f8b --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/ApiException.java @@ -0,0 +1,33 @@ +package com.regexsolver.api.exceptions; + +/** Base exception raised when the RegexSolver API returns an error response. */ +public class ApiException extends RegexSolverException { + + private final int statusCode; + private final String errorCode; + private final String body; + + public ApiException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message); + this.statusCode = statusCode; + this.errorCode = errorCode; + this.body = body; + } + + public int getStatusCode() { + return statusCode; + } + + public String getErrorCode() { + return errorCode; + } + + public String getBody() { + return body; + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/BadRequestException.java b/src/main/java/com/regexsolver/api/exceptions/BadRequestException.java new file mode 100644 index 0000000..969c03c --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/BadRequestException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the API returns a 400 Bad Request error. */ +public class BadRequestException extends ApiException { + + public BadRequestException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/ForbiddenException.java b/src/main/java/com/regexsolver/api/exceptions/ForbiddenException.java new file mode 100644 index 0000000..f4bee72 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/ForbiddenException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the API returns a 403 Forbidden error. */ +public class ForbiddenException extends ApiException { + + public ForbiddenException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/InternalServerException.java b/src/main/java/com/regexsolver/api/exceptions/InternalServerException.java new file mode 100644 index 0000000..0f292f7 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/InternalServerException.java @@ -0,0 +1,17 @@ +package com.regexsolver.api.exceptions; + +/** + * Raised when the API returns a 500 Internal Server Error. + * Indicates an unexpected failure or panic on the RegexSolver compute servers. + */ +public class InternalServerException extends ApiException { + + public InternalServerException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/InvalidJsonException.java b/src/main/java/com/regexsolver/api/exceptions/InvalidJsonException.java new file mode 100644 index 0000000..e86994e --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/InvalidJsonException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the provided JSON is invalid or cannot be parsed. */ +public class InvalidJsonException extends BadRequestException { + + public InvalidJsonException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/InvalidNumberOfStringsToGenerateException.java b/src/main/java/com/regexsolver/api/exceptions/InvalidNumberOfStringsToGenerateException.java new file mode 100644 index 0000000..e138a63 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/InvalidNumberOfStringsToGenerateException.java @@ -0,0 +1,16 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the requested number of strings to generate is below the minimum or exceeds the maximum allowed. */ +public class InvalidNumberOfStringsToGenerateException + extends BadRequestException +{ + + public InvalidNumberOfStringsToGenerateException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/InvalidTokenException.java b/src/main/java/com/regexsolver/api/exceptions/InvalidTokenException.java new file mode 100644 index 0000000..eb5d31b --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/InvalidTokenException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the provided authentication token is invalid. */ +public class InvalidTokenException extends UnauthorizedException { + + public InvalidTokenException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/MissingOrMalformedTokenException.java b/src/main/java/com/regexsolver/api/exceptions/MissingOrMalformedTokenException.java new file mode 100644 index 0000000..cff1b35 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/MissingOrMalformedTokenException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the provided authentication token is missing or malformed. */ +public class MissingOrMalformedTokenException extends UnauthorizedException { + + public MissingOrMalformedTokenException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/NotFoundException.java b/src/main/java/com/regexsolver/api/exceptions/NotFoundException.java new file mode 100644 index 0000000..1fd8d4e --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/NotFoundException.java @@ -0,0 +1,16 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the API returns a 404 Not Found error. + * Indicates that the requested API endpoint or resource does not exist. + */ +public class NotFoundException extends ApiException { + + public NotFoundException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/QuotaExceededException.java b/src/main/java/com/regexsolver/api/exceptions/QuotaExceededException.java new file mode 100644 index 0000000..cdb8157 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/QuotaExceededException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when your account's monthly compute quota has been exceeded. */ +public class QuotaExceededException extends ForbiddenException { + + public QuotaExceededException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/RegexSolverException.java b/src/main/java/com/regexsolver/api/exceptions/RegexSolverException.java new file mode 100644 index 0000000..531fa0c --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/RegexSolverException.java @@ -0,0 +1,11 @@ +package com.regexsolver.api.exceptions; + +/** + * Base exception for all RegexSolver errors. + */ +public class RegexSolverException extends RuntimeException { + + public RegexSolverException(String message) { + super(message); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/TimeoutExceededException.java b/src/main/java/com/regexsolver/api/exceptions/TimeoutExceededException.java new file mode 100644 index 0000000..2fed7de --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/TimeoutExceededException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the execution of the request exceeds the provided `execution_timeout` or the maximum allowed for your current plan. */ +public class TimeoutExceededException extends BadRequestException { + + public TimeoutExceededException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/TimeoutTooLargeException.java b/src/main/java/com/regexsolver/api/exceptions/TimeoutTooLargeException.java new file mode 100644 index 0000000..dff3d3d --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/TimeoutTooLargeException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the requested `execution_timeout` exceeds the maximum allowed for your current plan. */ +public class TimeoutTooLargeException extends BadRequestException { + + public TimeoutTooLargeException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/TooManyRequestsException.java b/src/main/java/com/regexsolver/api/exceptions/TooManyRequestsException.java new file mode 100644 index 0000000..47b1904 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/TooManyRequestsException.java @@ -0,0 +1,17 @@ +package com.regexsolver.api.exceptions; + +/** + * Raised when the API returns a 429 Too Many Requests error and max retries are exceeded. + * Indicates that your requests-per-second (req/s) rate limit has been exceeded. + */ +public class TooManyRequestsException extends ApiException { + + public TooManyRequestsException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/TooManyTermsException.java b/src/main/java/com/regexsolver/api/exceptions/TooManyTermsException.java new file mode 100644 index 0000000..21ac3f6 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/TooManyTermsException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the number of terms provided exceeds the maximum allowed. */ +public class TooManyTermsException extends BadRequestException { + + public TooManyTermsException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/exceptions/UnauthorizedException.java b/src/main/java/com/regexsolver/api/exceptions/UnauthorizedException.java new file mode 100644 index 0000000..73e5d9d --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/UnauthorizedException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when the API returns a 401 Unauthorized error. */ +public class UnauthorizedException extends ApiException { + + public UnauthorizedException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/generated/ApiClient.java b/src/main/java/com/regexsolver/api/generated/ApiClient.java new file mode 100644 index 0000000..aa4356d --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/ApiClient.java @@ -0,0 +1,486 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +import java.io.InputStream; +import java.io.IOException; +import java.net.URI; +import java.net.URLEncoder; +import java.net.http.HttpClient; +import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.StringJoiner; +import java.util.function.Consumer; +import java.util.Optional; +import java.util.zip.GZIPInputStream; +import java.util.stream.Collectors; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Configuration and utility class for API clients. + * + *

This class can be constructed and modified, then used to instantiate the + * various API classes. The API classes use the settings in this class to + * configure themselves, but otherwise do not store a link to this class.

+ * + *

This class is mutable and not synchronized, so it is not thread-safe. + * The API classes generated from this are immutable and thread-safe.

+ * + *

The setter methods of this class return the current object to facilitate + * a fluent style of configuration.

+ */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ApiClient { + + protected HttpClient.Builder builder; + protected ObjectMapper mapper; + protected String scheme; + protected String host; + protected int port; + protected String basePath; + protected Consumer interceptor; + protected Consumer> responseInterceptor; + protected Consumer> asyncResponseInterceptor; + protected Duration readTimeout; + protected Duration connectTimeout; + + public static String valueToString(Object value) { + if (value == null) { + return ""; + } + if (value instanceof OffsetDateTime) { + return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + return value.toString(); + } + + /** + * URL encode a string in the UTF-8 encoding. + * + * @param s String to encode. + * @return URL-encoded representation of the input string. + */ + public static String urlEncode(String s) { + return URLEncoder.encode(s, UTF_8).replaceAll("\\+", "%20"); + } + + /** + * Convert a URL query name/value parameter to a list of encoded {@link Pair} + * objects. + * + *

The value can be null, in which case an empty list is returned.

+ * + * @param name The query name parameter. + * @param value The query value, which may not be a collection but may be + * null. + * @return A singleton list of the {@link Pair} objects representing the input + * parameters, which is encoded for use in a URL. If the value is null, an + * empty list is returned. + */ + public static List parameterToPairs(String name, Object value) { + if (name == null || name.isEmpty() || value == null) { + return Collections.emptyList(); + } + return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); + } + + /** + * Convert a URL query name/collection parameter to a list of encoded + * {@link Pair} objects. + * + * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). + * @param name The query name parameter. + * @param values A collection of values for the given query name, which may be + * null. + * @return A list of {@link Pair} objects representing the input parameters, + * which is encoded for use in a URL. If the values collection is null, an + * empty list is returned. + */ + public static List parameterToPairs( + String collectionFormat, String name, Collection values) { + if (name == null || name.isEmpty() || values == null || values.isEmpty()) { + return Collections.emptyList(); + } + + // get the collection format (default: csv) + String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; + + // create the params based on the collection format + if ("multi".equals(format)) { + return values.stream() + .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) + .collect(Collectors.toList()); + } + + String delimiter; + switch(format) { + case "csv": + delimiter = urlEncode(","); + break; + case "ssv": + delimiter = urlEncode(" "); + break; + case "tsv": + delimiter = urlEncode("\t"); + break; + case "pipes": + delimiter = urlEncode("|"); + break; + default: + throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); + } + + StringJoiner joiner = new StringJoiner(delimiter); + for (Object value : values) { + joiner.add(urlEncode(valueToString(value))); + } + + return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); + } + + /** + * Create an instance of ApiClient. + */ + public ApiClient() { + this.builder = createDefaultHttpClientBuilder(); + this.mapper = createDefaultObjectMapper(); + updateBaseUri("https://api.regexsolver.com/v1"); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + /** + * Create an instance of ApiClient. + * + * @param builder Http client builder. + * @param mapper Object mapper. + * @param baseUri Base URI + */ + public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { + this.builder = builder; + this.mapper = mapper; + updateBaseUri(baseUri != null ? baseUri : "https://api.regexsolver.com/v1"); + interceptor = null; + readTimeout = null; + connectTimeout = null; + responseInterceptor = null; + asyncResponseInterceptor = null; + } + + public static ObjectMapper createDefaultObjectMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); + mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); + mapper.registerModule(new JavaTimeModule()); + mapper.registerModule(new RFC3339JavaTimeModule()); + return mapper; + } + + protected final String getDefaultBaseUri() { + return basePath; + } + + public static HttpClient.Builder createDefaultHttpClientBuilder() { + return HttpClient.newBuilder(); + } + + public final void updateBaseUri(String baseUri) { + URI uri = URI.create(baseUri); + scheme = uri.getScheme(); + host = uri.getHost(); + port = uri.getPort(); + basePath = uri.getRawPath(); + } + + /** + * Set a custom {@link HttpClient.Builder} object to use when creating the + * {@link HttpClient} that is used by the API client. + * + * @param builder Custom client builder. + * @return This object. + */ + public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { + this.builder = builder; + return this; + } + + /** + * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. + * + *

The returned object is immutable and thread-safe.

+ * + * @return The HTTP client. + */ + public HttpClient getHttpClient() { + return builder.build(); + } + + /** + * Set a custom {@link ObjectMapper} to serialize and deserialize the request + * and response bodies. + * + * @param mapper Custom object mapper. + * @return This object. + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.mapper = mapper; + return this; + } + + /** + * Get a copy of the current {@link ObjectMapper}. + * + * @return A copy of the current object mapper. + */ + public ObjectMapper getObjectMapper() { + return mapper.copy(); + } + + /** + * Set a custom host name for the target service. + * + * @param host The host name of the target service. + * @return This object. + */ + public ApiClient setHost(String host) { + this.host = host; + return this; + } + + /** + * Set a custom port number for the target service. + * + * @param port The port of the target service. Set this to -1 to reset the + * value to the default for the scheme. + * @return This object. + */ + public ApiClient setPort(int port) { + this.port = port; + return this; + } + + /** + * Set a custom base path for the target service, for example '/v2'. + * + * @param basePath The base path against which the rest of the path is + * resolved. + * @return This object. + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get the base URI to resolve the endpoint paths against. + * + * @return The complete base URI that the rest of the API parameters are + * resolved against. + */ + public String getBaseUri() { + return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; + } + + /** + * Set a custom scheme for the target service, for example 'https'. + * + * @param scheme The scheme of the target service + * @return This object. + */ + public ApiClient setScheme(String scheme){ + this.scheme = scheme; + return this; + } + + /** + * Set a custom request interceptor. + * + *

A request interceptor is a mechanism for altering each request before it + * is sent. After the request has been fully configured but not yet built, the + * request builder is passed into this function for further modification, + * after which it is sent out.

+ * + *

This is useful for altering the requests in a custom manner, such as + * adding headers. It could also be used for logging and monitoring.

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setRequestInterceptor(Consumer interceptor) { + this.interceptor = interceptor; + return this; + } + + /** + * Get the custom interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer getRequestInterceptor() { + return interceptor; + } + + /** + * Set a custom response interceptor. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setResponseInterceptor(Consumer> interceptor) { + this.responseInterceptor = interceptor; + return this; + } + + /** + * Get the custom response interceptor. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getResponseInterceptor() { + return responseInterceptor; + } + + /** + * Set a custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + *

This is useful for logging, monitoring or extraction of header variables

+ * + * @param interceptor A function invoked before creating each request. A value + * of null resets the interceptor to a no-op. + * @return This object. + */ + public ApiClient setAsyncResponseInterceptor(Consumer> interceptor) { + this.asyncResponseInterceptor = interceptor; + return this; + } + + /** + * Get the custom async response interceptor. Use this interceptor when asyncNative is set to 'true'. + * + * @return The custom interceptor that was set, or null if there isn't any. + */ + public Consumer> getAsyncResponseInterceptor() { + return asyncResponseInterceptor; + } + + /** + * Set the read timeout for the http client. + * + *

This is the value used by default for each request, though it can be + * overridden on a per-request basis with a request interceptor.

+ * + * @param readTimeout The read timeout used by default by the http client. + * Setting this value to null resets the timeout to an + * effectively infinite value. + * @return This object. + */ + public ApiClient setReadTimeout(Duration readTimeout) { + this.readTimeout = readTimeout; + return this; + } + + /** + * Get the read timeout that was set. + * + * @return The read timeout, or null if no timeout was set. Null represents + * an infinite wait time. + */ + public Duration getReadTimeout() { + return readTimeout; + } + /** + * Sets the connect timeout (in milliseconds) for the http client. + * + *

In the case where a new connection needs to be established, if + * the connection cannot be established within the given {@code + * duration}, then {@link HttpClient#send(HttpRequest,BodyHandler) + * HttpClient::send} throws an {@link HttpConnectTimeoutException}, or + * {@link HttpClient#sendAsync(HttpRequest,BodyHandler) + * HttpClient::sendAsync} completes exceptionally with an + * {@code HttpConnectTimeoutException}. If a new connection does not + * need to be established, for example if a connection can be reused + * from a previous request, then this timeout duration has no effect. + * + * @param connectTimeout connection timeout in milliseconds + * + * @return This object. + */ + public ApiClient setConnectTimeout(Duration connectTimeout) { + this.connectTimeout = connectTimeout; + this.builder.connectTimeout(connectTimeout); + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public Duration getConnectTimeout() { + return connectTimeout; + } + + /** + * Returns the response body InputStream, transparently decoding gzip-compressed + * payloads when the server sets {@code Content-Encoding: gzip}. + * + * @param response HTTP response whose body should be consumed + * @return Original or decompressed InputStream for the response body + * @throws IOException if the response body cannot be accessed or wrapping fails + */ + public static InputStream getResponseBody(HttpResponse response) throws IOException { + if (response == null) { + return null; + } + InputStream body = response.body(); + if (body == null) { + return null; + } + Optional encoding = response.headers().firstValue("Content-Encoding"); + if (encoding.isPresent()) { + for (String token : encoding.get().split(",")) { + if ("gzip".equalsIgnoreCase(token.trim())) { + return new GZIPInputStream(body, 8192); + } + } + } + return body; + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java new file mode 100644 index 0000000..e742752 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -0,0 +1,92 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import java.net.http.HttpHeaders; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ApiException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private int code = 0; + private HttpHeaders responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, HttpHeaders responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, HttpHeaders responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, HttpHeaders responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, HttpHeaders responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return Headers as an HttpHeaders object + */ + public HttpHeaders getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java new file mode 100644 index 0000000..2dc7fe1 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -0,0 +1,60 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + * + * @param The type of data that is deserialized from response body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + public int getStatusCode() { + return statusCode; + } + + public Map> getHeaders() { + return headers; + } + + public T getData() { + return data; + } +} diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java new file mode 100644 index 0000000..0d258b5 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -0,0 +1,63 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Configuration { + public static final String VERSION = "1.1.0"; + + private static final AtomicReference defaultApiClient = new AtomicReference<>(); + private static volatile Supplier apiClientFactory = ApiClient::new; + + /** + * Get the default API client, which would be used when creating API instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + ApiClient client = defaultApiClient.get(); + if (client == null) { + client = defaultApiClient.updateAndGet(val -> { + if (val != null) { // changed by another thread + return val; + } + return apiClientFactory.get(); + }); + } + return client; + } + + /** + * Set the default API client, which would be used when creating API instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient.set(apiClient); + } + + /** + * set the callback used to create new ApiClient objects + */ + public static void setApiClientFactory(Supplier factory) { + apiClientFactory = Objects.requireNonNull(factory); + } + + private Configuration() { + } +} \ No newline at end of file diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java new file mode 100644 index 0000000..e265398 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -0,0 +1,261 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import com.regexsolver.api.generated.model.*; + +import java.text.DateFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class JSON { + private ObjectMapper mapper; + + public JSON() { + mapper = JsonMapper.builder() + .serializationInclusion(JsonInclude.Include.NON_NULL) + .disable(MapperFeature.ALLOW_COERCION_OF_SCALARS) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .enable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING) + .enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING) + .defaultDateFormat(new RFC3339DateFormat()) + .addModule(new JavaTimeModule()) + .build(); + } + + /** + * Set the date format for JSON (de)serialization with Date properties. + * + * @param dateFormat Date format + */ + public void setDateFormat(DateFormat dateFormat) { + mapper.setDateFormat(dateFormat); + } + + /** + * Get the object mapper + * + * @return object mapper + */ + public ObjectMapper getMapper() { return mapper; } + + /** + * Returns the target model class that should be used to deserialize the input data. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param modelClass The class that contains the discriminator mappings. + * + * @return the target model class. + */ + public static Class getClassForElement(JsonNode node, Class modelClass) { + ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass); + if (cdm != null) { + return cdm.getClassForElement(node, new HashSet>()); + } + return null; + } + + /** + * Helper class to register the discriminator mappings. + */ + @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + private static class ClassDiscriminatorMapping { + // The model class name. + Class modelClass; + // The name of the discriminator property. + String discriminatorName; + // The discriminator mappings for a model class. + Map> discriminatorMappings; + + // Constructs a new class discriminator. + ClassDiscriminatorMapping(Class cls, String propertyName, Map> mappings) { + modelClass = cls; + discriminatorName = propertyName; + discriminatorMappings = new HashMap>(); + if (mappings != null) { + discriminatorMappings.putAll(mappings); + } + } + + // Return the name of the discriminator property for this model class. + String getDiscriminatorPropertyName() { + return discriminatorName; + } + + // Return the discriminator value or null if the discriminator is not + // present in the payload. + String getDiscriminatorValue(JsonNode node) { + // Determine the value of the discriminator property in the input data. + if (discriminatorName != null) { + // Get the value of the discriminator property, if present in the input payload. + node = node.get(discriminatorName); + if (node != null && node.isValueNode()) { + String discrValue = node.asText(); + if (discrValue != null) { + return discrValue; + } + } + } + return null; + } + + /** + * Returns the target model class that should be used to deserialize the input data. + * This function can be invoked for anyOf/oneOf composed models with discriminator mappings. + * The discriminator mappings are used to determine the target model class. + * + * @param node The input data. + * @param visitedClasses The set of classes that have already been visited. + * + * @return the target model class. + */ + Class getClassForElement(JsonNode node, Set> visitedClasses) { + if (visitedClasses.contains(modelClass)) { + // Class has already been visited. + return null; + } + // Determine the value of the discriminator property in the input data. + String discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + return null; + } + Class cls = discriminatorMappings.get(discrValue); + // It may not be sufficient to return this cls directly because that target class + // may itself be a composed schema, possibly with its own discriminator. + visitedClasses.add(modelClass); + for (Class childClass : discriminatorMappings.values()) { + ClassDiscriminatorMapping childCdm = modelDiscriminators.get(childClass); + if (childCdm == null) { + continue; + } + if (!discriminatorName.equals(childCdm.discriminatorName)) { + discrValue = getDiscriminatorValue(node); + if (discrValue == null) { + continue; + } + } + if (childCdm != null) { + // Recursively traverse the discriminator mappings. + Class childDiscr = childCdm.getClassForElement(node, visitedClasses); + if (childDiscr != null) { + return childDiscr; + } + } + } + return cls; + } + } + + /** + * Returns true if inst is an instance of modelClass in the OpenAPI model hierarchy. + * + * The Java class hierarchy is not implemented the same way as the OpenAPI model hierarchy, + * so it's not possible to use the instanceof keyword. + * + * @param modelClass A OpenAPI model class. + * @param inst The instance object. + * @param visitedClasses The set of classes that have already been visited. + * + * @return true if inst is an instance of modelClass in the OpenAPI model hierarchy. + */ + public static boolean isInstanceOf(Class modelClass, Object inst, Set> visitedClasses) { + if (modelClass.isInstance(inst)) { + // This handles the 'allOf' use case with single parent inheritance. + return true; + } + if (visitedClasses.contains(modelClass)) { + // This is to prevent infinite recursion when the composed schemas have + // a circular dependency. + return false; + } + visitedClasses.add(modelClass); + + // Traverse the oneOf/anyOf composed schemas. + Map> descendants = modelDescendants.get(modelClass); + if (descendants != null) { + for (Class childType : descendants.values()) { + if (isInstanceOf(childType, inst, visitedClasses)) { + return true; + } + } + } + return false; + } + + /** + * A map of discriminators for all model classes. + */ + private static Map, ClassDiscriminatorMapping> modelDiscriminators = new HashMap<>(); + + /** + * A map of oneOf/anyOf descendants for each model class. + */ + private static Map, Map>> modelDescendants = new HashMap<>(); + + /** + * Register a model class discriminator. + * + * @param modelClass the model class + * @param discriminatorPropertyName the name of the discriminator property + * @param mappings a map with the discriminator mappings. + */ + public static void registerDiscriminator(Class modelClass, String discriminatorPropertyName, Map> mappings) { + ClassDiscriminatorMapping m = new ClassDiscriminatorMapping(modelClass, discriminatorPropertyName, mappings); + modelDiscriminators.put(modelClass, m); + } + + /** + * Register the oneOf/anyOf descendants of the modelClass. + * + * @param modelClass the model class + * @param descendants a map of oneOf/anyOf descendants. + */ + public static void registerDescendants(Class modelClass, Map> descendants) { + modelDescendants.put(modelClass, descendants); + } + + private static JSON json; + + static { + json = new JSON(); + } + + /** + * Get the default JSON instance. + * + * @return the default JSON instance + */ + public static JSON getDefault() { + return json; + } + + /** + * Set the default JSON instance. + * + * @param json JSON instance to be used + */ + public static void setDefault(JSON json) { + JSON.json = json; + } +} diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java new file mode 100644 index 0000000..636e0bd --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -0,0 +1,37 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Pair { + private final String name; + private final String value; + + public Pair(String name, String value) { + this.name = isValidString(name) ? name : ""; + this.value = isValidString(value) ? value : ""; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private static boolean isValidString(String arg) { + return arg != null; + } +} diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java new file mode 100644 index 0000000..eaa93e8 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -0,0 +1,57 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated; + +import java.text.DateFormat; +import java.text.FieldPosition; +import java.text.ParsePosition; +import java.util.Date; +import java.text.DecimalFormat; +import java.util.GregorianCalendar; +import java.util.TimeZone; +import com.fasterxml.jackson.databind.util.StdDateFormat; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class RFC3339DateFormat extends DateFormat { + private static final long serialVersionUID = 1L; + private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); + + private final StdDateFormat fmt = new StdDateFormat() + .withTimeZone(TIMEZONE_Z) + .withColonInTimeZone(true); + + public RFC3339DateFormat() { + this.calendar = new GregorianCalendar(); + this.numberFormat = new DecimalFormat(); + } + + @Override + public Date parse(String source) { + return parse(source, new ParsePosition(0)); + } + + @Override + public Date parse(String source, ParsePosition pos) { + return fmt.parse(source, pos); + } + + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + return fmt.format(date, toAppendTo, fieldPosition); + } + + @Override + public Object clone() { + return super.clone(); + } +} diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java new file mode 100644 index 0000000..a45e5d7 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -0,0 +1,100 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated; + +import java.io.IOException; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.format.DateTimeFormatter; +import java.time.temporal.Temporal; +import java.time.temporal.TemporalAccessor; +import java.util.function.BiFunction; +import java.util.function.Function; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; +import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class RFC3339InstantDeserializer extends InstantDeserializer { + private static final long serialVersionUID = 1L; + private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); + private final static boolean DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + = JavaTimeFeature.ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS.enabledByDefault(); + + public static final RFC3339InstantDeserializer INSTANT = new RFC3339InstantDeserializer<>( + Instant.class, DateTimeFormatter.ISO_INSTANT, + Instant::from, + a -> Instant.ofEpochMilli( a.value ), + a -> Instant.ofEpochSecond( a.integer, a.fraction ), + null, + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer OFFSET_DATE_TIME = new RFC3339InstantDeserializer<>( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + OffsetDateTime::from, + a -> OffsetDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> OffsetDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + (d, z) -> ( d.isEqual( OffsetDateTime.MIN ) || d.isEqual( OffsetDateTime.MAX ) ? + d : + d.withOffsetSameInstant( z.getRules().getOffset( d.toLocalDateTime() ) ) ), + true, // yes, replace zero offset with Z + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + public static final RFC3339InstantDeserializer ZONED_DATE_TIME = new RFC3339InstantDeserializer<>( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + ZonedDateTime::from, + a -> ZonedDateTime.ofInstant( Instant.ofEpochMilli( a.value ), a.zoneId ), + a -> ZonedDateTime.ofInstant( Instant.ofEpochSecond( a.integer, a.fraction ), a.zoneId ), + ZonedDateTime::withZoneSameInstant, + false, // keep zero offset and Z separate since zones explicitly supported + DEFAULT_NORMALIZE_ZONE_ID, + DEFAULT_ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS + ); + + protected RFC3339InstantDeserializer( + Class supportedType, + DateTimeFormatter formatter, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust, + boolean replaceZeroOffsetAsZ, + boolean normalizeZoneId, + boolean readNumericStringsAsTimestamp) { + super( + supportedType, + formatter, + parsedToValue, + fromMilliseconds, + fromNanoseconds, + adjust, + replaceZeroOffsetAsZ, + normalizeZoneId, + readNumericStringsAsTimestamp + ); + } + + @Override + protected T _fromString(JsonParser p, DeserializationContext ctxt, String string0) throws IOException { + return super._fromString(p, ctxt, string0.replace( ' ', 'T' )); + } +} \ No newline at end of file diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java new file mode 100644 index 0000000..6d8078a --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -0,0 +1,39 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZonedDateTime; + +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.Module.SetupContext; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class RFC3339JavaTimeModule extends SimpleModule { + private static final long serialVersionUID = 1L; + + public RFC3339JavaTimeModule() { + super("RFC3339JavaTimeModule"); + } + + @Override + public void setupModule(SetupContext context) { + super.setupModule(context); + + addDeserializer(Instant.class, RFC3339InstantDeserializer.INSTANT); + addDeserializer(OffsetDateTime.class, RFC3339InstantDeserializer.OFFSET_DATE_TIME); + addDeserializer(ZonedDateTime.class, RFC3339InstantDeserializer.ZONED_DATE_TIME); + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java new file mode 100644 index 0000000..8a91d67 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java new file mode 100644 index 0000000..d6367e7 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java new file mode 100644 index 0000000..412cbdb --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -0,0 +1,1362 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated.api; + +import com.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.ApiResponse; +import com.regexsolver.api.generated.Configuration; +import com.regexsolver.api.generated.Pair; + +import com.regexsolver.api.generated.model.Cardinality200ResponseDto; +import com.regexsolver.api.generated.model.Dot200ResponseDto; +import com.regexsolver.api.generated.model.Empty200ResponseDto; +import com.regexsolver.api.generated.model.ErrorResponseDto; +import com.regexsolver.api.generated.model.Length200ResponseDto; +import com.regexsolver.api.generated.model.TermRequestDto; +import com.regexsolver.api.generated.model.TwoTermsRequestDto; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +import java.util.concurrent.CompletableFuture; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class AnalyzeApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public AnalyzeApi() { + this(Configuration.getDefaultApiClient()); + } + + public AnalyzeApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + private ApiException getApiException(String operationId, HttpResponse response) { + try { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + if (responseBody != null) { + body = new String(responseBody.readAllBytes()); + responseBody.close(); + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } catch (IOException e) { + return new ApiException(e); + } + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * Cardinality + * Compute how many strings the term matches. + * @param termRequestDto (required) + * @return CompletableFuture<Cardinality200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture cardinality(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return cardinality(termRequestDto, null); + } + + /** + * Cardinality + * Compute how many strings the term matches. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Cardinality200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture cardinality(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return cardinalityWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Cardinality + * Compute how many strings the term matches. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Cardinality200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> cardinalityWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return cardinalityWithHttpInfo(termRequestDto, null); + } + + /** + * Cardinality + * Compute how many strings the term matches. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Cardinality200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> cardinalityWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = cardinalityRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("cardinality", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Cardinality200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder cardinalityRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling cardinality"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/cardinality"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * GraphViz Dot + * Build a Graphviz DOT representation of the term's automaton. + * @param termRequestDto (required) + * @return CompletableFuture<Dot200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture dot(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return dot(termRequestDto, null); + } + + /** + * GraphViz Dot + * Build a Graphviz DOT representation of the term's automaton. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Dot200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture dot(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return dotWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * GraphViz Dot + * Build a Graphviz DOT representation of the term's automaton. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> dotWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return dotWithHttpInfo(termRequestDto, null); + } + + /** + * GraphViz Dot + * Build a Graphviz DOT representation of the term's automaton. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> dotWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = dotRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("dot", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Dot200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder dotRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling dot"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/dot"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Empty + * Check if the term matches no strings. + * @param termRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture empty(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return empty(termRequestDto, null); + } + + /** + * Empty + * Check if the term matches no strings. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture empty(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return emptyWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Empty + * Check if the term matches no strings. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> emptyWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return emptyWithHttpInfo(termRequestDto, null); + } + + /** + * Empty + * Check if the term matches no strings. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> emptyWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = emptyRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("empty", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder emptyRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling empty"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/empty"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Empty String Only + * Check if the term matches only the empty string. + * @param termRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture emptyString(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return emptyString(termRequestDto, null); + } + + /** + * Empty String Only + * Check if the term matches only the empty string. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture emptyString(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return emptyStringWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Empty String Only + * Check if the term matches only the empty string. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> emptyStringWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return emptyStringWithHttpInfo(termRequestDto, null); + } + + /** + * Empty String Only + * Check if the term matches only the empty string. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> emptyStringWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = emptyStringRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("emptyString", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder emptyStringRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling emptyString"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/empty_string"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Equivalent + * Check if the two terms accept exactly the same language. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture equivalent(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return equivalent(twoTermsRequestDto, null); + } + + /** + * Equivalent + * Check if the two terms accept exactly the same language. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture equivalent(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + return equivalentWithHttpInfo(twoTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Equivalent + * Check if the two terms accept exactly the same language. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> equivalentWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return equivalentWithHttpInfo(twoTermsRequestDto, null); + } + + /** + * Equivalent + * Check if the two terms accept exactly the same language. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> equivalentWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = equivalentRequestBuilder(twoTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("equivalent", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder equivalentRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'twoTermsRequestDto' is set + if (twoTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling equivalent"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/equivalent"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(twoTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Length + * Compute the minimum and maximum length of strings matched by the term. + * @param termRequestDto (required) + * @return CompletableFuture<Length200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture length(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return length(termRequestDto, null); + } + + /** + * Length + * Compute the minimum and maximum length of strings matched by the term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Length200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture length(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return lengthWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Length + * Compute the minimum and maximum length of strings matched by the term. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Length200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> lengthWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return lengthWithHttpInfo(termRequestDto, null); + } + + /** + * Length + * Compute the minimum and maximum length of strings matched by the term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Length200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> lengthWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = lengthRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("length", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Length200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder lengthRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling length"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/length"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Pattern + * Return a regular expression pattern that represents the term. + * @param termRequestDto (required) + * @return CompletableFuture<Dot200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture pattern(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return pattern(termRequestDto, null); + } + + /** + * Pattern + * Return a regular expression pattern that represents the term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Dot200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture pattern(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return patternWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Pattern + * Return a regular expression pattern that represents the term. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> patternWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return patternWithHttpInfo(termRequestDto, null); + } + + /** + * Pattern + * Return a regular expression pattern that represents the term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> patternWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = patternRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("pattern", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Dot200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder patternRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling pattern"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/pattern"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Subset + * Check if the first term's language is a subset of the second term's language. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture subset(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return subset(twoTermsRequestDto, null); + } + + /** + * Subset + * Check if the first term's language is a subset of the second term's language. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture subset(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + return subsetWithHttpInfo(twoTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Subset + * Check if the first term's language is a subset of the second term's language. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> subsetWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return subsetWithHttpInfo(twoTermsRequestDto, null); + } + + /** + * Subset + * Check if the first term's language is a subset of the second term's language. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> subsetWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = subsetRequestBuilder(twoTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("subset", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder subsetRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'twoTermsRequestDto' is set + if (twoTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling subset"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/subset"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(twoTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Totality + * Check if the term matches all the possible strings. + * @param termRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture total(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return total(termRequestDto, null); + } + + /** + * Totality + * Check if the term matches all the possible strings. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture total(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return totalWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Totality + * Check if the term matches all the possible strings. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> totalWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return totalWithHttpInfo(termRequestDto, null); + } + + /** + * Totality + * Check if the term matches all the possible strings. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> totalWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = totalRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("total", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder totalRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling total"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/total"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java new file mode 100644 index 0000000..e706a56 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -0,0 +1,965 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated.api; + +import com.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.ApiResponse; +import com.regexsolver.api.generated.Configuration; +import com.regexsolver.api.generated.Pair; + +import com.regexsolver.api.generated.model.Concat200ResponseDto; +import com.regexsolver.api.generated.model.ErrorResponseDto; +import com.regexsolver.api.generated.model.MultiTermsRequestDto; +import com.regexsolver.api.generated.model.RepeatRequestDto; +import com.regexsolver.api.generated.model.TermRequestDto; +import com.regexsolver.api.generated.model.TwoTermsRequestDto; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +import java.util.concurrent.CompletableFuture; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ComputeApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public ComputeApi() { + this(Configuration.getDefaultApiClient()); + } + + public ComputeApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + private ApiException getApiException(String operationId, HttpResponse response) { + try { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + if (responseBody != null) { + body = new String(responseBody.readAllBytes()); + responseBody.close(); + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } catch (IOException e) { + return new ApiException(e); + } + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * Complement + * Computes the complement of the given term. + * @param termRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture complement(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return complement(termRequestDto, null); + } + + /** + * Complement + * Computes the complement of the given term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture complement(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return complementWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Complement + * Computes the complement of the given term. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> complementWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return complementWithHttpInfo(termRequestDto, null); + } + + /** + * Complement + * Computes the complement of the given term. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> complementWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = complementRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("complement", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder complementRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling complement"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/complement"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Concatenation + * Concatenate the given terms in order. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture concat(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return concat(multiTermsRequestDto, null); + } + + /** + * Concatenation + * Concatenate the given terms in order. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture concat(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + return concatWithHttpInfo(multiTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Concatenation + * Concatenate the given terms in order. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> concatWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return concatWithHttpInfo(multiTermsRequestDto, null); + } + + /** + * Concatenation + * Concatenate the given terms in order. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> concatWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = concatRequestBuilder(multiTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("concat", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder concatRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'multiTermsRequestDto' is set + if (multiTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling concat"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/concat"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(multiTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Difference + * Computes the difference between the two provided terms. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture difference(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return difference(twoTermsRequestDto, null); + } + + /** + * Difference + * Computes the difference between the two provided terms. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture difference(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + return differenceWithHttpInfo(twoTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Difference + * Computes the difference between the two provided terms. + * @param twoTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> differenceWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + return differenceWithHttpInfo(twoTermsRequestDto, null); + } + + /** + * Difference + * Computes the difference between the two provided terms. + * @param twoTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> differenceWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = differenceRequestBuilder(twoTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("difference", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder differenceRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'twoTermsRequestDto' is set + if (twoTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling difference"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/difference"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(twoTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Intersection + * Computes the intersection of the given terms. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture intersection(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return intersection(multiTermsRequestDto, null); + } + + /** + * Intersection + * Computes the intersection of the given terms. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture intersection(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + return intersectionWithHttpInfo(multiTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Intersection + * Computes the intersection of the given terms. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> intersectionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return intersectionWithHttpInfo(multiTermsRequestDto, null); + } + + /** + * Intersection + * Computes the intersection of the given terms. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> intersectionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = intersectionRequestBuilder(multiTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("intersection", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder intersectionRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'multiTermsRequestDto' is set + if (multiTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling intersection"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/intersection"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(multiTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Repeat + * Repeat a term between 'min' and 'max' times. + * @param repeatRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture repeat(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { + return repeat(repeatRequestDto, null); + } + + /** + * Repeat + * Repeat a term between 'min' and 'max' times. + * @param repeatRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture repeat(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + try { + return repeatWithHttpInfo(repeatRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Repeat + * Repeat a term between 'min' and 'max' times. + * @param repeatRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> repeatWithHttpInfo(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { + return repeatWithHttpInfo(repeatRequestDto, null); + } + + /** + * Repeat + * Repeat a term between 'min' and 'max' times. + * @param repeatRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> repeatWithHttpInfo(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = repeatRequestBuilder(repeatRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("repeat", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder repeatRequestBuilder(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + // verify the required parameter 'repeatRequestDto' is set + if (repeatRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'repeatRequestDto' when calling repeat"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/repeat"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(repeatRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Union + * Computes the union of the given terms. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture union(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return union(multiTermsRequestDto, null); + } + + /** + * Union + * Computes the union of the given terms. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture union(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + return unionWithHttpInfo(multiTermsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Union + * Computes the union of the given terms. + * @param multiTermsRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> unionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + return unionWithHttpInfo(multiTermsRequestDto, null); + } + + /** + * Union + * Computes the union of the given terms. + * @param multiTermsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> unionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = unionRequestBuilder(multiTermsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("union", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder unionRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'multiTermsRequestDto' is set + if (multiTermsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling union"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/union"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(multiTermsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java new file mode 100644 index 0000000..0af8b16 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -0,0 +1,302 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated.api; + +import com.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.ApiResponse; +import com.regexsolver.api.generated.Configuration; +import com.regexsolver.api.generated.Pair; + +import com.regexsolver.api.generated.model.ErrorResponseDto; +import com.regexsolver.api.generated.model.GenerateStringsRequestDto; +import com.regexsolver.api.generated.model.Strings200ResponseDto; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +import java.util.concurrent.CompletableFuture; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class GenerateApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public GenerateApi() { + this(Configuration.getDefaultApiClient()); + } + + public GenerateApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + private ApiException getApiException(String operationId, HttpResponse response) { + try { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + if (responseBody != null) { + body = new String(responseBody.readAllBytes()); + responseBody.close(); + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } catch (IOException e) { + return new ApiException(e); + } + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * Strings + * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * @param generateStringsRequestDto (required) + * @return CompletableFuture<Strings200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture strings(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { + return strings(generateStringsRequestDto, null); + } + + /** + * Strings + * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * @param generateStringsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Strings200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture strings(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + try { + return stringsWithHttpInfo(generateStringsRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Strings + * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * @param generateStringsRequestDto (required) + * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> stringsWithHttpInfo(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { + return stringsWithHttpInfo(generateStringsRequestDto, null); + } + + /** + * Strings + * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * @param generateStringsRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> stringsWithHttpInfo(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = stringsRequestBuilder(generateStringsRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("strings", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Strings200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder stringsRequestBuilder(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + // verify the required parameter 'generateStringsRequestDto' is set + if (generateStringsRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'generateStringsRequestDto' when calling strings"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/generate/strings"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(generateStringsRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java new file mode 100644 index 0000000..f3b5409 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -0,0 +1,144 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +import java.util.Objects; +import java.lang.reflect.Type; +import java.util.Map; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public abstract class AbstractOpenApiSchema { + + // store the actual instance of the schema/object + private Object instance; + + // is nullable + private Boolean isNullable; + + // schema type (e.g. oneOf, anyOf) + private final String schemaType; + + public AbstractOpenApiSchema(String schemaType, Boolean isNullable) { + this.schemaType = schemaType; + this.isNullable = isNullable; + } + + /** + * Get the list of oneOf/anyOf composed schemas allowed to be stored in this object + * + * @return an instance of the actual schema/object + */ + public abstract Map> getSchemas(); + + /** + * Get the actual instance + * + * @return an instance of the actual schema/object + */ + @JsonValue + public Object getActualInstance() {return instance;} + + /** + * Set the actual instance + * + * @param instance the actual instance of the schema/object + */ + public void setActualInstance(Object instance) {this.instance = instance;} + + /** + * Get the instant recursively when the schemas defined in oneOf/anyof happen to be oneOf/anyOf schema as well + * + * @return an instance of the actual schema/object + */ + public Object getActualInstanceRecursively() { + return getActualInstanceRecursively(this); + } + + private Object getActualInstanceRecursively(AbstractOpenApiSchema object) { + if (object.getActualInstance() == null) { + return null; + } else if (object.getActualInstance() instanceof AbstractOpenApiSchema) { + return getActualInstanceRecursively((AbstractOpenApiSchema)object.getActualInstance()); + } else { + return object.getActualInstance(); + } + } + + /** + * Get the schema type (e.g. anyOf, oneOf) + * + * @return the schema type + */ + public String getSchemaType() { + return schemaType; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ").append(getClass()).append(" {\n"); + sb.append(" instance: ").append(toIndentedString(instance)).append("\n"); + sb.append(" isNullable: ").append(toIndentedString(isNullable)).append("\n"); + sb.append(" schemaType: ").append(toIndentedString(schemaType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + return o == null ? "null" : o.toString().replace("\n", "\n "); + } + + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AbstractOpenApiSchema a = (AbstractOpenApiSchema) o; + return Objects.equals(this.instance, a.instance) && + Objects.equals(this.isNullable, a.isNullable) && + Objects.equals(this.schemaType, a.schemaType); + } + + @Override + public int hashCode() { + return Objects.hash(instance, isNullable, schemaType); + } + + /** + * Is nullable + * + * @return true if it's nullable + */ + public Boolean isNullable() { + if (Boolean.TRUE.equals(isNullable)) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + + +} diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java new file mode 100644 index 0000000..dc1ef0b --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -0,0 +1,217 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Wrapper for a boolean value. + */ +@JsonPropertyOrder({ + BooleanDto.JSON_PROPERTY_TYPE, + BooleanDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class BooleanDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + BOOLEAN(String.valueOf("boolean")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private Boolean value; + + public BooleanDto() { + } + + public BooleanDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public BooleanDto value(@javax.annotation.Nonnull Boolean value) { + this.value = value; + return this; + } + + /** + * Boolean value. + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull Boolean value) { + this.value = value; + } + + + /** + * Return true if this Boolean object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BooleanDto _boolean = (BooleanDto) o; + return Objects.equals(this.type, _boolean.type) && + Objects.equals(this.value, _boolean.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BooleanDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java new file mode 100644 index 0000000..837de74 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.CardinalityDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Cardinality200ResponseDto + */ +@JsonPropertyOrder({ + Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, + Cardinality200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Cardinality200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private CardinalityDto data; + + public Cardinality200ResponseDto() { + } + + public Cardinality200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Cardinality200ResponseDto data(@javax.annotation.Nonnull CardinalityDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public CardinalityDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull CardinalityDto data) { + this.data = data; + } + + + /** + * Return true if this cardinality_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cardinality200ResponseDto cardinality200Response = (Cardinality200ResponseDto) o; + return Objects.equals(this.success, cardinality200Response.success) && + Objects.equals(this.data, cardinality200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cardinality200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java new file mode 100644 index 0000000..3215d32 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -0,0 +1,181 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * The set of matched strings is finite but too large to be returned. + */ +@JsonPropertyOrder({ + CardinalityBigIntegerDto.JSON_PROPERTY_TYPE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class CardinalityBigIntegerDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + BIG_INTEGER(String.valueOf("bigInteger")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public CardinalityBigIntegerDto() { + } + + public CardinalityBigIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this CardinalityBigInteger object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardinalityBigIntegerDto cardinalityBigInteger = (CardinalityBigIntegerDto) o; + return Objects.equals(this.type, cardinalityBigInteger.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardinalityBigIntegerDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java new file mode 100644 index 0000000..7ced7f9 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -0,0 +1,362 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.regexsolver.api.generated.model.CardinalityBigIntegerDto; +import com.regexsolver.api.generated.model.CardinalityInfiniteDto; +import com.regexsolver.api.generated.model.CardinalityIntegerDto; +import java.util.Arrays; +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.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) +@JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) +public class CardinalityDto extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(CardinalityDto.class.getName()); + + public static class CardinalityDtoSerializer extends StdSerializer { + public CardinalityDtoSerializer(Class t) { + super(t); + } + + public CardinalityDtoSerializer() { + this(null); + } + + @Override + public void serialize(CardinalityDto value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class CardinalityDtoDeserializer extends StdDeserializer { + public CardinalityDtoDeserializer() { + this(CardinalityDto.class); + } + + public CardinalityDtoDeserializer(Class vc) { + super(vc); + } + + @Override + public CardinalityDto 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 CardinalityBigIntegerDto + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CardinalityBigIntegerDto.class.equals(Integer.class) || CardinalityBigIntegerDto.class.equals(Long.class) || CardinalityBigIntegerDto.class.equals(Float.class) || CardinalityBigIntegerDto.class.equals(Double.class) || CardinalityBigIntegerDto.class.equals(Boolean.class) || CardinalityBigIntegerDto.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((CardinalityBigIntegerDto.class.equals(Integer.class) || CardinalityBigIntegerDto.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((CardinalityBigIntegerDto.class.equals(Float.class) || CardinalityBigIntegerDto.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (CardinalityBigIntegerDto.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (CardinalityBigIntegerDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(CardinalityBigIntegerDto.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 'CardinalityBigIntegerDto'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CardinalityBigIntegerDto'", e); + } + + // deserialize CardinalityInfiniteDto + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CardinalityInfiniteDto.class.equals(Integer.class) || CardinalityInfiniteDto.class.equals(Long.class) || CardinalityInfiniteDto.class.equals(Float.class) || CardinalityInfiniteDto.class.equals(Double.class) || CardinalityInfiniteDto.class.equals(Boolean.class) || CardinalityInfiniteDto.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((CardinalityInfiniteDto.class.equals(Integer.class) || CardinalityInfiniteDto.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((CardinalityInfiniteDto.class.equals(Float.class) || CardinalityInfiniteDto.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (CardinalityInfiniteDto.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (CardinalityInfiniteDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(CardinalityInfiniteDto.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 'CardinalityInfiniteDto'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CardinalityInfiniteDto'", e); + } + + // deserialize CardinalityIntegerDto + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (CardinalityIntegerDto.class.equals(Integer.class) || CardinalityIntegerDto.class.equals(Long.class) || CardinalityIntegerDto.class.equals(Float.class) || CardinalityIntegerDto.class.equals(Double.class) || CardinalityIntegerDto.class.equals(Boolean.class) || CardinalityIntegerDto.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((CardinalityIntegerDto.class.equals(Integer.class) || CardinalityIntegerDto.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((CardinalityIntegerDto.class.equals(Float.class) || CardinalityIntegerDto.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (CardinalityIntegerDto.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (CardinalityIntegerDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(CardinalityIntegerDto.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 'CardinalityIntegerDto'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'CardinalityIntegerDto'", e); + } + + if (match == 1) { + CardinalityDto ret = new CardinalityDto(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for CardinalityDto: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public CardinalityDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "CardinalityDto cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public CardinalityDto() { + super("oneOf", Boolean.FALSE); + } + + public CardinalityDto(CardinalityBigIntegerDto o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CardinalityDto(CardinalityInfiniteDto o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public CardinalityDto(CardinalityIntegerDto o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("CardinalityBigIntegerDto", CardinalityBigIntegerDto.class); + schemas.put("CardinalityInfiniteDto", CardinalityInfiniteDto.class); + schemas.put("CardinalityIntegerDto", CardinalityIntegerDto.class); + JSON.registerDescendants(CardinalityDto.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("bigInteger", CardinalityBigIntegerDto.class); + mappings.put("infinite", CardinalityInfiniteDto.class); + mappings.put("integer", CardinalityIntegerDto.class); + mappings.put("Cardinality", CardinalityDto.class); + JSON.registerDiscriminator(CardinalityDto.class, "type", mappings); + } + + @Override + public Map> getSchemas() { + return CardinalityDto.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * CardinalityBigIntegerDto, CardinalityInfiniteDto, CardinalityIntegerDto + * + * 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(CardinalityBigIntegerDto.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(CardinalityInfiniteDto.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(CardinalityIntegerDto.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be CardinalityBigIntegerDto, CardinalityInfiniteDto, CardinalityIntegerDto"); + } + + /** + * Get the actual instance, which can be the following: + * CardinalityBigIntegerDto, CardinalityInfiniteDto, CardinalityIntegerDto + * + * @return The actual instance (CardinalityBigIntegerDto, CardinalityInfiniteDto, CardinalityIntegerDto) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `CardinalityBigIntegerDto`. If the actual instance is not `CardinalityBigIntegerDto`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CardinalityBigIntegerDto` + * @throws ClassCastException if the instance is not `CardinalityBigIntegerDto` + */ + public CardinalityBigIntegerDto getCardinalityBigIntegerDto() throws ClassCastException { + return (CardinalityBigIntegerDto)super.getActualInstance(); + } + + /** + * Get the actual instance of `CardinalityInfiniteDto`. If the actual instance is not `CardinalityInfiniteDto`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CardinalityInfiniteDto` + * @throws ClassCastException if the instance is not `CardinalityInfiniteDto` + */ + public CardinalityInfiniteDto getCardinalityInfiniteDto() throws ClassCastException { + return (CardinalityInfiniteDto)super.getActualInstance(); + } + + /** + * Get the actual instance of `CardinalityIntegerDto`. If the actual instance is not `CardinalityIntegerDto`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `CardinalityIntegerDto` + * @throws ClassCastException if the instance is not `CardinalityIntegerDto` + */ + public CardinalityIntegerDto getCardinalityIntegerDto() throws ClassCastException { + return (CardinalityIntegerDto)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 CardinalityInfiniteDto) { + if (getActualInstance() != null) { + joiner.add(((CardinalityInfiniteDto)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix)); + } + return joiner.toString(); + } + if (getActualInstance() instanceof CardinalityBigIntegerDto) { + if (getActualInstance() != null) { + joiner.add(((CardinalityBigIntegerDto)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix)); + } + return joiner.toString(); + } + if (getActualInstance() instanceof CardinalityIntegerDto) { + if (getActualInstance() != null) { + joiner.add(((CardinalityIntegerDto)getActualInstance()).toUrlQueryString(prefix + "one_of_2" + suffix)); + } + return joiner.toString(); + } + return null; + } + +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java new file mode 100644 index 0000000..79fd9a4 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -0,0 +1,181 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * The set of matched strings is infinite. + */ +@JsonPropertyOrder({ + CardinalityInfiniteDto.JSON_PROPERTY_TYPE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class CardinalityInfiniteDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + INFINITE(String.valueOf("infinite")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public CardinalityInfiniteDto() { + } + + public CardinalityInfiniteDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + /** + * Return true if this CardinalityInfinite object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardinalityInfiniteDto cardinalityInfinite = (CardinalityInfiniteDto) o; + return Objects.equals(this.type, cardinalityInfinite.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardinalityInfiniteDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java new file mode 100644 index 0000000..10b3131 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -0,0 +1,218 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * The set of matched strings is finite. + */ +@JsonPropertyOrder({ + CardinalityIntegerDto.JSON_PROPERTY_TYPE, + CardinalityIntegerDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class CardinalityIntegerDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + INTEGER(String.valueOf("integer")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private Long value; + + public CardinalityIntegerDto() { + } + + public CardinalityIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public CardinalityIntegerDto value(@javax.annotation.Nonnull Long value) { + this.value = value; + return this; + } + + /** + * Exact count. + * minimum: 0 + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull Long value) { + this.value = value; + } + + + /** + * Return true if this CardinalityInteger object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CardinalityIntegerDto cardinalityInteger = (CardinalityIntegerDto) o; + return Objects.equals(this.type, cardinalityInteger.type) && + Objects.equals(this.value, cardinalityInteger.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CardinalityIntegerDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java new file mode 100644 index 0000000..85a9dd4 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.TermDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Concat200ResponseDto + */ +@JsonPropertyOrder({ + Concat200ResponseDto.JSON_PROPERTY_SUCCESS, + Concat200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Concat200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private TermDto data; + + public Concat200ResponseDto() { + } + + public Concat200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Concat200ResponseDto data(@javax.annotation.Nonnull TermDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TermDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull TermDto data) { + this.data = data; + } + + + /** + * Return true if this concat_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Concat200ResponseDto concat200Response = (Concat200ResponseDto) o; + return Objects.equals(this.success, concat200Response.success) && + Objects.equals(this.data, concat200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Concat200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java new file mode 100644 index 0000000..d02ff6b --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.StringDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Dot200ResponseDto + */ +@JsonPropertyOrder({ + Dot200ResponseDto.JSON_PROPERTY_SUCCESS, + Dot200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Dot200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private StringDto data; + + public Dot200ResponseDto() { + } + + public Dot200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Dot200ResponseDto data(@javax.annotation.Nonnull StringDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StringDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull StringDto data) { + this.data = data; + } + + + /** + * Return true if this dot_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dot200ResponseDto dot200Response = (Dot200ResponseDto) o; + return Objects.equals(this.success, dot200Response.success) && + Objects.equals(this.data, dot200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dot200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java new file mode 100644 index 0000000..6755e58 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.BooleanDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Empty200ResponseDto + */ +@JsonPropertyOrder({ + Empty200ResponseDto.JSON_PROPERTY_SUCCESS, + Empty200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Empty200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private BooleanDto data; + + public Empty200ResponseDto() { + } + + public Empty200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Empty200ResponseDto data(@javax.annotation.Nonnull BooleanDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public BooleanDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull BooleanDto data) { + this.data = data; + } + + + /** + * Return true if this empty_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Empty200ResponseDto empty200Response = (Empty200ResponseDto) o; + return Objects.equals(this.success, empty200Response.success) && + Objects.equals(this.data, empty200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Empty200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java new file mode 100644 index 0000000..a9a4eef --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -0,0 +1,220 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Standard error payload returned when success is false. + */ +@JsonPropertyOrder({ + ErrorResponseDto.JSON_PROPERTY_SUCCESS, + ErrorResponseDto.JSON_PROPERTY_ERROR, + ErrorResponseDto.JSON_PROPERTY_ERROR_CODE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ErrorResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_ERROR = "error"; + @javax.annotation.Nonnull + private String error; + + public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; + @javax.annotation.Nullable + private String errorCode; + + public ErrorResponseDto() { + } + + public ErrorResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public ErrorResponseDto error(@javax.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Human readable error message. + * @return error + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setError(@javax.annotation.Nonnull String error) { + this.error = error; + } + + + public ErrorResponseDto errorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * The error code. + * @return errorCode + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getErrorCode() { + return errorCode; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setErrorCode(@javax.annotation.Nullable String errorCode) { + this.errorCode = errorCode; + } + + + /** + * Return true if this ErrorResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponseDto errorResponse = (ErrorResponseDto) o; + return Objects.equals(this.success, errorResponse.success) && + Objects.equals(this.error, errorResponse.error) && + Objects.equals(this.errorCode, errorResponse.errorCode); + } + + @Override + public int hashCode() { + return Objects.hash(success, error, errorCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + // add `errorCode` to the URL query string + if (getErrorCode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serrorCode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getErrorCode())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java new file mode 100644 index 0000000..fb6d515 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -0,0 +1,149 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Change how the engine executes the operation. + */ +@JsonPropertyOrder({ + ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ExecutionOptionsDto { + public static final String JSON_PROPERTY_TIMEOUT = "timeout"; + @javax.annotation.Nullable + private Integer timeout; + + public ExecutionOptionsDto() { + } + + public ExecutionOptionsDto timeout(@javax.annotation.Nullable Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Timeout in milliseconds for the operation. + * minimum: 1 + * @return timeout + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TIMEOUT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getTimeout() { + return timeout; + } + + + @JsonProperty(value = JSON_PROPERTY_TIMEOUT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTimeout(@javax.annotation.Nullable Integer timeout) { + this.timeout = timeout; + } + + + /** + * Return true if this ExecutionOptions object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExecutionOptionsDto executionOptions = (ExecutionOptionsDto) o; + return Objects.equals(this.timeout, executionOptions.timeout); + } + + @Override + public int hashCode() { + return Objects.hash(timeout); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExecutionOptionsDto {\n"); + sb.append(" timeout: ").append(toIndentedString(timeout)).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 `timeout` to the URL query string + if (getTimeout() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stimeout%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getTimeout())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java new file mode 100644 index 0000000..e59a3e2 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -0,0 +1,297 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.RequestOptionsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Request to generate up to 'limit' distinct strings matched by 'term', skipping the first 'offset' strings. + */ +@JsonPropertyOrder({ + GenerateStringsRequestDto.JSON_PROPERTY_TERM, + GenerateStringsRequestDto.JSON_PROPERTY_LIMIT, + GenerateStringsRequestDto.JSON_PROPERTY_OFFSET, + GenerateStringsRequestDto.JSON_PROPERTY_RETURN_STABLE_TERM, + GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class GenerateStringsRequestDto { + public static final String JSON_PROPERTY_TERM = "term"; + @javax.annotation.Nonnull + private TermDto term; + + public static final String JSON_PROPERTY_LIMIT = "limit"; + @javax.annotation.Nonnull + private Integer limit; + + public static final String JSON_PROPERTY_OFFSET = "offset"; + @javax.annotation.Nonnull + private Integer offset; + + public static final String JSON_PROPERTY_RETURN_STABLE_TERM = "returnStableTerm"; + @javax.annotation.Nullable + private Boolean returnStableTerm = false; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + @javax.annotation.Nullable + private RequestOptionsDto options; + + public GenerateStringsRequestDto() { + } + + public GenerateStringsRequestDto term(@javax.annotation.Nonnull TermDto term) { + this.term = term; + return this; + } + + /** + * Source term to generate strings from. + * @return term + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TermDto getTerm() { + return term; + } + + + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTerm(@javax.annotation.Nonnull TermDto term) { + this.term = term; + } + + + public GenerateStringsRequestDto limit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + return this; + } + + /** + * Maximum number of unique strings to return. + * minimum: 1 + * maximum: 100 + * @return limit + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getLimit() { + return limit; + } + + + @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setLimit(@javax.annotation.Nonnull Integer limit) { + this.limit = limit; + } + + + public GenerateStringsRequestDto offset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + return this; + } + + /** + * Number of matched strings to skip before starting to collect the results. Used for pagination. + * minimum: 0 + * @return offset + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getOffset() { + return offset; + } + + + @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setOffset(@javax.annotation.Nonnull Integer offset) { + this.offset = offset; + } + + + public GenerateStringsRequestDto returnStableTerm(@javax.annotation.Nullable Boolean returnStableTerm) { + this.returnStableTerm = returnStableTerm; + return this; + } + + /** + * If set to true, a stable term is returned. This term can be reused in subsequent calls to guarantee no strings are repeated. If the provided term is already stable, it will not be returned. + * @return returnStableTerm + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getReturnStableTerm() { + return returnStableTerm; + } + + + @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setReturnStableTerm(@javax.annotation.Nullable Boolean returnStableTerm) { + this.returnStableTerm = returnStableTerm; + } + + + public GenerateStringsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RequestOptionsDto getOptions() { + return options; + } + + + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + } + + + /** + * Return true if this GenerateStringsRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GenerateStringsRequestDto generateStringsRequest = (GenerateStringsRequestDto) o; + return Objects.equals(this.term, generateStringsRequest.term) && + Objects.equals(this.limit, generateStringsRequest.limit) && + Objects.equals(this.offset, generateStringsRequest.offset) && + Objects.equals(this.returnStableTerm, generateStringsRequest.returnStableTerm) && + Objects.equals(this.options, generateStringsRequest.options); + } + + @Override + public int hashCode() { + return Objects.hash(term, limit, offset, returnStableTerm, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GenerateStringsRequestDto {\n"); + sb.append(" term: ").append(toIndentedString(term)).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" returnStableTerm: ").append(toIndentedString(returnStableTerm)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `term` to the URL query string + if (getTerm() != null) { + joiner.add(getTerm().toUrlQueryString(prefix + "term" + suffix)); + } + + // add `limit` to the URL query string + if (getLimit() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%slimit%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getLimit())))); + } + + // add `offset` to the URL query string + if (getOffset() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%soffset%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOffset())))); + } + + // add `returnStableTerm` to the URL query string + if (getReturnStableTerm() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sreturnStableTerm%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getReturnStableTerm())))); + } + + // add `options` to the URL query string + if (getOptions() != null) { + joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java new file mode 100644 index 0000000..5aaeae9 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -0,0 +1,255 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.StringsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Response containing distinct strings generated from the requested 'term'. + */ +@JsonPropertyOrder({ + GenerateStringsResponseDto.JSON_PROPERTY_TYPE, + GenerateStringsResponseDto.JSON_PROPERTY_TERM, + GenerateStringsResponseDto.JSON_PROPERTY_STRINGS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class GenerateStringsResponseDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + GENERATED_STRINGS(String.valueOf("generatedStrings")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_TERM = "term"; + @javax.annotation.Nullable + private TermDto term; + + public static final String JSON_PROPERTY_STRINGS = "strings"; + @javax.annotation.Nonnull + private StringsDto strings; + + public GenerateStringsResponseDto() { + } + + public GenerateStringsResponseDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public GenerateStringsResponseDto term(@javax.annotation.Nullable TermDto term) { + this.term = term; + return this; + } + + /** + * A stable term to use in subsequent calls to guarantee the uniqueness of generated strings. Omitted if 'returnStableTerm' was false in the request, or if the provided term was already stable. + * @return term + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_TERM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TermDto getTerm() { + return term; + } + + + @JsonProperty(value = JSON_PROPERTY_TERM, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setTerm(@javax.annotation.Nullable TermDto term) { + this.term = term; + } + + + public GenerateStringsResponseDto strings(@javax.annotation.Nonnull StringsDto strings) { + this.strings = strings; + return this; + } + + /** + * The generated distinct strings. + * @return strings + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_STRINGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public StringsDto getStrings() { + return strings; + } + + + @JsonProperty(value = JSON_PROPERTY_STRINGS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setStrings(@javax.annotation.Nonnull StringsDto strings) { + this.strings = strings; + } + + + /** + * Return true if this GenerateStringsResponse object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GenerateStringsResponseDto generateStringsResponse = (GenerateStringsResponseDto) o; + return Objects.equals(this.type, generateStringsResponse.type) && + Objects.equals(this.term, generateStringsResponse.term) && + Objects.equals(this.strings, generateStringsResponse.strings); + } + + @Override + public int hashCode() { + return Objects.hash(type, term, strings); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GenerateStringsResponseDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" term: ").append(toIndentedString(term)).append("\n"); + sb.append(" strings: ").append(toIndentedString(strings)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `term` to the URL query string + if (getTerm() != null) { + joiner.add(getTerm().toUrlQueryString(prefix + "term" + suffix)); + } + + // add `strings` to the URL query string + if (getStrings() != null) { + joiner.add(getStrings().toUrlQueryString(prefix + "strings" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java new file mode 100644 index 0000000..114d13a --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.LengthDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Length200ResponseDto + */ +@JsonPropertyOrder({ + Length200ResponseDto.JSON_PROPERTY_SUCCESS, + Length200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Length200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private LengthDto data; + + public Length200ResponseDto() { + } + + public Length200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Length200ResponseDto data(@javax.annotation.Nonnull LengthDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public LengthDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull LengthDto data) { + this.data = data; + } + + + /** + * Return true if this length_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Length200ResponseDto length200Response = (Length200ResponseDto) o; + return Objects.equals(this.success, length200Response.success) && + Objects.equals(this.data, length200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Length200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java new file mode 100644 index 0000000..4019b19 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -0,0 +1,253 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Minimum and maximum length of any string in the language. + */ +@JsonPropertyOrder({ + LengthDto.JSON_PROPERTY_TYPE, + LengthDto.JSON_PROPERTY_MIN, + LengthDto.JSON_PROPERTY_MAX +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class LengthDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + LENGTH(String.valueOf("length")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_MIN = "min"; + @javax.annotation.Nullable + private Integer min; + + public static final String JSON_PROPERTY_MAX = "max"; + @javax.annotation.Nullable + private Integer max; + + public LengthDto() { + } + + public LengthDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public LengthDto min(@javax.annotation.Nullable Integer min) { + this.min = min; + return this; + } + + /** + * Shortest possible length, or null if empty. + * @return min + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MIN, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getMin() { + return min; + } + + + @JsonProperty(value = JSON_PROPERTY_MIN, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMin(@javax.annotation.Nullable Integer min) { + this.min = min; + } + + + public LengthDto max(@javax.annotation.Nullable Integer max) { + this.max = max; + return this; + } + + /** + * Longest possible length, or null if unbounded. + * @return max + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAX, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getMax() { + return max; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX, required = false) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMax(@javax.annotation.Nullable Integer max) { + this.max = max; + } + + + /** + * Return true if this Length object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + LengthDto length = (LengthDto) o; + return Objects.equals(this.type, length.type) && + Objects.equals(this.min, length.min) && + Objects.equals(this.max, length.max); + } + + @Override + public int hashCode() { + return Objects.hash(type, min, max); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LengthDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `min` to the URL query string + if (getMin() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smin%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMin())))); + } + + // add `max` to the URL query string + if (getMax() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smax%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMax())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java new file mode 100644 index 0000000..f703cee --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -0,0 +1,201 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.RequestOptionsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Request carrying 2 or more terms for n-ary operations. + */ +@JsonPropertyOrder({ + MultiTermsRequestDto.JSON_PROPERTY_TERMS, + MultiTermsRequestDto.JSON_PROPERTY_OPTIONS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class MultiTermsRequestDto { + public static final String JSON_PROPERTY_TERMS = "terms"; + @javax.annotation.Nonnull + private List terms = new ArrayList<>(); + + public static final String JSON_PROPERTY_OPTIONS = "options"; + @javax.annotation.Nullable + private RequestOptionsDto options; + + public MultiTermsRequestDto() { + } + + public MultiTermsRequestDto terms(@javax.annotation.Nonnull List terms) { + this.terms = terms; + return this; + } + + public MultiTermsRequestDto addTermsItem(TermDto termsItem) { + if (this.terms == null) { + this.terms = new ArrayList<>(); + } + this.terms.add(termsItem); + return this; + } + + /** + * Terms to process. Order matters for some operations. + * @return terms + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTerms() { + return terms; + } + + + @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTerms(@javax.annotation.Nonnull List terms) { + this.terms = terms; + } + + + public MultiTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RequestOptionsDto getOptions() { + return options; + } + + + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + } + + + /** + * Return true if this MultiTermsRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MultiTermsRequestDto multiTermsRequest = (MultiTermsRequestDto) o; + return Objects.equals(this.terms, multiTermsRequest.terms) && + Objects.equals(this.options, multiTermsRequest.options); + } + + @Override + public int hashCode() { + return Objects.hash(terms, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MultiTermsRequestDto {\n"); + sb.append(" terms: ").append(toIndentedString(terms)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `terms` to the URL query string + if (getTerms() != null) { + for (int i = 0; i < getTerms().size(); i++) { + if (getTerms().get(i) != null) { + joiner.add(getTerms().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sterms%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `options` to the URL query string + if (getOptions() != null) { + joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java new file mode 100644 index 0000000..b536a80 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -0,0 +1,258 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.RequestOptionsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Request to repeat a term between 'min' and 'max' times. + */ +@JsonPropertyOrder({ + RepeatRequestDto.JSON_PROPERTY_TERM, + RepeatRequestDto.JSON_PROPERTY_MIN, + RepeatRequestDto.JSON_PROPERTY_MAX, + RepeatRequestDto.JSON_PROPERTY_OPTIONS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class RepeatRequestDto { + public static final String JSON_PROPERTY_TERM = "term"; + @javax.annotation.Nonnull + private TermDto term; + + public static final String JSON_PROPERTY_MIN = "min"; + @javax.annotation.Nonnull + private Integer min; + + public static final String JSON_PROPERTY_MAX = "max"; + @javax.annotation.Nullable + private Integer max; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + @javax.annotation.Nullable + private RequestOptionsDto options; + + public RepeatRequestDto() { + } + + public RepeatRequestDto term(@javax.annotation.Nonnull TermDto term) { + this.term = term; + return this; + } + + /** + * Term to repeat. + * @return term + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TermDto getTerm() { + return term; + } + + + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTerm(@javax.annotation.Nonnull TermDto term) { + this.term = term; + } + + + public RepeatRequestDto min(@javax.annotation.Nonnull Integer min) { + this.min = min; + return this; + } + + /** + * Inclusive lower bound of repetitions. + * @return min + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MIN, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getMin() { + return min; + } + + + @JsonProperty(value = JSON_PROPERTY_MIN, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMin(@javax.annotation.Nonnull Integer min) { + this.min = min; + } + + + public RepeatRequestDto max(@javax.annotation.Nullable Integer max) { + this.max = max; + return this; + } + + /** + * Inclusive upper bound. If omitted or null, the repetition is unbounded. + * @return max + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAX, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getMax() { + return max; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMax(@javax.annotation.Nullable Integer max) { + this.max = max; + } + + + public RepeatRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RequestOptionsDto getOptions() { + return options; + } + + + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + } + + + /** + * Return true if this RepeatRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RepeatRequestDto repeatRequest = (RepeatRequestDto) o; + return Objects.equals(this.term, repeatRequest.term) && + Objects.equals(this.min, repeatRequest.min) && + Objects.equals(this.max, repeatRequest.max) && + Objects.equals(this.options, repeatRequest.options); + } + + @Override + public int hashCode() { + return Objects.hash(term, min, max, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RepeatRequestDto {\n"); + sb.append(" term: ").append(toIndentedString(term)).append("\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `term` to the URL query string + if (getTerm() != null) { + joiner.add(getTerm().toUrlQueryString(prefix + "term" + suffix)); + } + + // add `min` to the URL query string + if (getMin() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smin%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMin())))); + } + + // add `max` to the URL query string + if (getMax() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smax%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMax())))); + } + + // add `options` to the URL query string + if (getOptions() != null) { + joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java new file mode 100644 index 0000000..190acca --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -0,0 +1,222 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.ExecutionOptionsDto; +import com.regexsolver.api.generated.model.ResponseOptionsDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Change how the engine handle the operation. + */ +@JsonPropertyOrder({ + RequestOptionsDto.JSON_PROPERTY_SCHEMA_VERSION, + RequestOptionsDto.JSON_PROPERTY_RESPONSE, + RequestOptionsDto.JSON_PROPERTY_EXECUTION +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class RequestOptionsDto { + public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; + @javax.annotation.Nonnull + private Integer schemaVersion; + + public static final String JSON_PROPERTY_RESPONSE = "response"; + @javax.annotation.Nullable + private ResponseOptionsDto response; + + public static final String JSON_PROPERTY_EXECUTION = "execution"; + @javax.annotation.Nullable + private ExecutionOptionsDto execution; + + public RequestOptionsDto() { + } + + public RequestOptionsDto schemaVersion(@javax.annotation.Nonnull Integer schemaVersion) { + this.schemaVersion = schemaVersion; + return this; + } + + /** + * Client-expected schema version. + * @return schemaVersion + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SCHEMA_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Integer getSchemaVersion() { + return schemaVersion; + } + + + @JsonProperty(value = JSON_PROPERTY_SCHEMA_VERSION, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSchemaVersion(@javax.annotation.Nonnull Integer schemaVersion) { + this.schemaVersion = schemaVersion; + } + + + public RequestOptionsDto response(@javax.annotation.Nullable ResponseOptionsDto response) { + this.response = response; + return this; + } + + /** + * Get response + * @return response + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_RESPONSE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ResponseOptionsDto getResponse() { + return response; + } + + + @JsonProperty(value = JSON_PROPERTY_RESPONSE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setResponse(@javax.annotation.Nullable ResponseOptionsDto response) { + this.response = response; + } + + + public RequestOptionsDto execution(@javax.annotation.Nullable ExecutionOptionsDto execution) { + this.execution = execution; + return this; + } + + /** + * Get execution + * @return execution + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_EXECUTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ExecutionOptionsDto getExecution() { + return execution; + } + + + @JsonProperty(value = JSON_PROPERTY_EXECUTION, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setExecution(@javax.annotation.Nullable ExecutionOptionsDto execution) { + this.execution = execution; + } + + + /** + * Return true if this RequestOptions object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequestOptionsDto requestOptions = (RequestOptionsDto) o; + return Objects.equals(this.schemaVersion, requestOptions.schemaVersion) && + Objects.equals(this.response, requestOptions.response) && + Objects.equals(this.execution, requestOptions.execution); + } + + @Override + public int hashCode() { + return Objects.hash(schemaVersion, response, execution); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequestOptionsDto {\n"); + sb.append(" schemaVersion: ").append(toIndentedString(schemaVersion)).append("\n"); + sb.append(" response: ").append(toIndentedString(response)).append("\n"); + sb.append(" execution: ").append(toIndentedString(execution)).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 `schemaVersion` to the URL query string + if (getSchemaVersion() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sschemaVersion%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSchemaVersion())))); + } + + // add `response` to the URL query string + if (getResponse() != null) { + joiner.add(getResponse().toUrlQueryString(prefix + "response" + suffix)); + } + + // add `execution` to the URL query string + if (getExecution() != null) { + joiner.add(getExecution().toUrlQueryString(prefix + "execution" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java new file mode 100644 index 0000000..a468e12 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Change how the engine returns results. + */ +@JsonPropertyOrder({ + ResponseOptionsDto.JSON_PROPERTY_FORMAT +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ResponseOptionsDto { + /** + * Return format of the term. + */ + public enum FormatEnum { + ANY(String.valueOf("any")), + + FAIR(String.valueOf("fair")), + + REGEX(String.valueOf("regex")); + + private String value; + + FormatEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static FormatEnum fromValue(String value) { + for (FormatEnum b : FormatEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_FORMAT = "format"; + @javax.annotation.Nullable + private FormatEnum format; + + public ResponseOptionsDto() { + } + + public ResponseOptionsDto format(@javax.annotation.Nullable FormatEnum format) { + this.format = format; + return this; + } + + /** + * Return format of the term. + * @return format + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FORMAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FormatEnum getFormat() { + return format; + } + + + @JsonProperty(value = JSON_PROPERTY_FORMAT, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFormat(@javax.annotation.Nullable FormatEnum format) { + this.format = format; + } + + + /** + * Return true if this ResponseOptions object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResponseOptionsDto responseOptions = (ResponseOptionsDto) o; + return Objects.equals(this.format, responseOptions.format); + } + + @Override + public int hashCode() { + return Objects.hash(format); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResponseOptionsDto {\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `format` to the URL query string + if (getFormat() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sformat%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFormat())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java new file mode 100644 index 0000000..0f3dbdd --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -0,0 +1,217 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Wrapper for a string value. + */ +@JsonPropertyOrder({ + StringDto.JSON_PROPERTY_TYPE, + StringDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class StringDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + STRING(String.valueOf("string")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private String value; + + public StringDto() { + } + + public StringDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public StringDto value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * String value. + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + /** + * Return true if this String object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StringDto string = (StringDto) o; + return Objects.equals(this.type, string.type) && + Objects.equals(this.value, string.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java new file mode 100644 index 0000000..bda8689 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.GenerateStringsResponseDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Strings200ResponseDto + */ +@JsonPropertyOrder({ + Strings200ResponseDto.JSON_PROPERTY_SUCCESS, + Strings200ResponseDto.JSON_PROPERTY_DATA +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Strings200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @javax.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @javax.annotation.Nonnull + private GenerateStringsResponseDto data; + + public Strings200ResponseDto() { + } + + public Strings200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@javax.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Strings200ResponseDto data(@javax.annotation.Nonnull GenerateStringsResponseDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GenerateStringsResponseDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@javax.annotation.Nonnull GenerateStringsResponseDto data) { + this.data = data; + } + + + /** + * Return true if this strings_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Strings200ResponseDto strings200Response = (Strings200ResponseDto) o; + return Objects.equals(this.success, strings200Response.success) && + Objects.equals(this.data, strings200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Strings200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java new file mode 100644 index 0000000..d18a63b --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -0,0 +1,231 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Wrapper for a list of strings. + */ +@JsonPropertyOrder({ + StringsDto.JSON_PROPERTY_TYPE, + StringsDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class StringsDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + STRINGS(String.valueOf("strings")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private List value = new ArrayList<>(); + + public StringsDto() { + } + + public StringsDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public StringsDto value(@javax.annotation.Nonnull List value) { + this.value = value; + return this; + } + + public StringsDto addValueItem(String valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Array of unique strings. + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull List value) { + this.value = value; + } + + + /** + * Return true if this Strings object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + StringsDto strings = (StringsDto) o; + return Objects.equals(this.type, strings.type) && + Objects.equals(this.value, strings.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringsDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + for (int i = 0; i < getValue().size(); i++) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s%s=%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix), + ApiClient.urlEncode(ApiClient.valueToString(getValue().get(i))))); + } + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java new file mode 100644 index 0000000..17d39ee --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -0,0 +1,306 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonValue; +import com.regexsolver.api.generated.model.TermFairDto; +import com.regexsolver.api.generated.model.TermRegexDto; +import java.util.Arrays; +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.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.JSON; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@JsonDeserialize(using = TermDto.TermDtoDeserializer.class) +@JsonSerialize(using = TermDto.TermDtoSerializer.class) +public class TermDto extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(TermDto.class.getName()); + + public static class TermDtoSerializer extends StdSerializer { + public TermDtoSerializer(Class t) { + super(t); + } + + public TermDtoSerializer() { + this(null); + } + + @Override + public void serialize(TermDto value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class TermDtoDeserializer extends StdDeserializer { + public TermDtoDeserializer() { + this(TermDto.class); + } + + public TermDtoDeserializer(Class vc) { + super(vc); + } + + @Override + public TermDto 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 TermFairDto + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TermFairDto.class.equals(Integer.class) || TermFairDto.class.equals(Long.class) || TermFairDto.class.equals(Float.class) || TermFairDto.class.equals(Double.class) || TermFairDto.class.equals(Boolean.class) || TermFairDto.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((TermFairDto.class.equals(Integer.class) || TermFairDto.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((TermFairDto.class.equals(Float.class) || TermFairDto.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (TermFairDto.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (TermFairDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(TermFairDto.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 'TermFairDto'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TermFairDto'", e); + } + + // deserialize TermRegexDto + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (TermRegexDto.class.equals(Integer.class) || TermRegexDto.class.equals(Long.class) || TermRegexDto.class.equals(Float.class) || TermRegexDto.class.equals(Double.class) || TermRegexDto.class.equals(Boolean.class) || TermRegexDto.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= ((TermRegexDto.class.equals(Integer.class) || TermRegexDto.class.equals(Long.class)) && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= ((TermRegexDto.class.equals(Float.class) || TermRegexDto.class.equals(Double.class)) && token == JsonToken.VALUE_NUMBER_FLOAT); + attemptParsing |= (TermRegexDto.class.equals(Boolean.class) && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (TermRegexDto.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + deserialized = tree.traverse(jp.getCodec()).readValueAs(TermRegexDto.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 'TermRegexDto'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'TermRegexDto'", e); + } + + if (match == 1) { + TermDto ret = new TermDto(); + ret.setActualInstance(deserialized); + return ret; + } + throw new IOException(String.format(java.util.Locale.ROOT, "Failed deserialization for TermDto: %d classes match result, expected 1", match)); + } + + /** + * Handle deserialization of the 'null' value. + */ + @Override + public TermDto getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "TermDto cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap<>(); + + public TermDto() { + super("oneOf", Boolean.FALSE); + } + + public TermDto(TermFairDto o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public TermDto(TermRegexDto o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("TermFairDto", TermFairDto.class); + schemas.put("TermRegexDto", TermRegexDto.class); + JSON.registerDescendants(TermDto.class, Collections.unmodifiableMap(schemas)); + // Initialize and register the discriminator mappings. + Map> mappings = new HashMap>(); + mappings.put("fair", TermFairDto.class); + mappings.put("regex", TermRegexDto.class); + mappings.put("Term", TermDto.class); + JSON.registerDiscriminator(TermDto.class, "type", mappings); + } + + @Override + public Map> getSchemas() { + return TermDto.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * TermFairDto, TermRegexDto + * + * 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(TermFairDto.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(TermRegexDto.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + throw new RuntimeException("Invalid instance type. Must be TermFairDto, TermRegexDto"); + } + + /** + * Get the actual instance, which can be the following: + * TermFairDto, TermRegexDto + * + * @return The actual instance (TermFairDto, TermRegexDto) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `TermFairDto`. If the actual instance is not `TermFairDto`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `TermFairDto` + * @throws ClassCastException if the instance is not `TermFairDto` + */ + public TermFairDto getTermFairDto() throws ClassCastException { + return (TermFairDto)super.getActualInstance(); + } + + /** + * Get the actual instance of `TermRegexDto`. If the actual instance is not `TermRegexDto`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `TermRegexDto` + * @throws ClassCastException if the instance is not `TermRegexDto` + */ + public TermRegexDto getTermRegexDto() throws ClassCastException { + return (TermRegexDto)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 TermRegexDto) { + if (getActualInstance() != null) { + joiner.add(((TermRegexDto)getActualInstance()).toUrlQueryString(prefix + "one_of_0" + suffix)); + } + return joiner.toString(); + } + if (getActualInstance() instanceof TermFairDto) { + if (getActualInstance() != null) { + joiner.add(((TermFairDto)getActualInstance()).toUrlQueryString(prefix + "one_of_1" + suffix)); + } + return joiner.toString(); + } + return null; + } + +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java new file mode 100644 index 0000000..2a2f9e1 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -0,0 +1,217 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Term encoded as FAIR (Fast Automaton Internal Representation), a stable, signed format used internally by the engine. + */ +@JsonPropertyOrder({ + TermFairDto.JSON_PROPERTY_TYPE, + TermFairDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class TermFairDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + FAIR(String.valueOf("fair")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private String value; + + public TermFairDto() { + } + + public TermFairDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public TermFairDto value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * FAIR payload. + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + /** + * Return true if this TermFair object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TermFairDto termFair = (TermFairDto) o; + return Objects.equals(this.type, termFair.type) && + Objects.equals(this.value, termFair.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TermFairDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java new file mode 100644 index 0000000..62fe4f8 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -0,0 +1,217 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Term encoded as a regular expression pattern. + */ +@JsonPropertyOrder({ + TermRegexDto.JSON_PROPERTY_TYPE, + TermRegexDto.JSON_PROPERTY_VALUE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class TermRegexDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + REGEX(String.valueOf("regex")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @javax.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_VALUE = "value"; + @javax.annotation.Nonnull + private String value; + + public TermRegexDto() { + } + + public TermRegexDto type(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@javax.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public TermRegexDto value(@javax.annotation.Nonnull String value) { + this.value = value; + return this; + } + + /** + * Regular expression pattern. + * @return value + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getValue() { + return value; + } + + + @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setValue(@javax.annotation.Nonnull String value) { + this.value = value; + } + + + /** + * Return true if this TermRegex object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TermRegexDto termRegex = (TermRegexDto) o; + return Objects.equals(this.type, termRegex.type) && + Objects.equals(this.value, termRegex.value); + } + + @Override + public int hashCode() { + return Objects.hash(type, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TermRegexDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `value` to the URL query string + if (getValue() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java new file mode 100644 index 0000000..3406468 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -0,0 +1,186 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.RequestOptionsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Request a single term. + */ +@JsonPropertyOrder({ + TermRequestDto.JSON_PROPERTY_TERM, + TermRequestDto.JSON_PROPERTY_OPTIONS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class TermRequestDto { + public static final String JSON_PROPERTY_TERM = "term"; + @javax.annotation.Nonnull + private TermDto term; + + public static final String JSON_PROPERTY_OPTIONS = "options"; + @javax.annotation.Nullable + private RequestOptionsDto options; + + public TermRequestDto() { + } + + public TermRequestDto term(@javax.annotation.Nonnull TermDto term) { + this.term = term; + return this; + } + + /** + * Get term + * @return term + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TermDto getTerm() { + return term; + } + + + @JsonProperty(value = JSON_PROPERTY_TERM, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTerm(@javax.annotation.Nonnull TermDto term) { + this.term = term; + } + + + public TermRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RequestOptionsDto getOptions() { + return options; + } + + + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + } + + + /** + * Return true if this TermRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TermRequestDto termRequest = (TermRequestDto) o; + return Objects.equals(this.term, termRequest.term) && + Objects.equals(this.options, termRequest.options); + } + + @Override + public int hashCode() { + return Objects.hash(term, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TermRequestDto {\n"); + sb.append(" term: ").append(toIndentedString(term)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `term` to the URL query string + if (getTerm() != null) { + joiner.add(getTerm().toUrlQueryString(prefix + "term" + suffix)); + } + + // add `options` to the URL query string + if (getOptions() != null) { + joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java new file mode 100644 index 0000000..92aa3d8 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -0,0 +1,201 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.RequestOptionsDto; +import com.regexsolver.api.generated.model.TermDto; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Request carrying exactly 2 terms. + */ +@JsonPropertyOrder({ + TwoTermsRequestDto.JSON_PROPERTY_TERMS, + TwoTermsRequestDto.JSON_PROPERTY_OPTIONS +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class TwoTermsRequestDto { + public static final String JSON_PROPERTY_TERMS = "terms"; + @javax.annotation.Nonnull + private List terms = new ArrayList<>(); + + public static final String JSON_PROPERTY_OPTIONS = "options"; + @javax.annotation.Nullable + private RequestOptionsDto options; + + public TwoTermsRequestDto() { + } + + public TwoTermsRequestDto terms(@javax.annotation.Nonnull List terms) { + this.terms = terms; + return this; + } + + public TwoTermsRequestDto addTermsItem(TermDto termsItem) { + if (this.terms == null) { + this.terms = new ArrayList<>(); + } + this.terms.add(termsItem); + return this; + } + + /** + * Exactly 2 terms. + * @return terms + */ + @javax.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTerms() { + return terms; + } + + + @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setTerms(@javax.annotation.Nonnull List terms) { + this.terms = terms; + } + + + public TwoTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + return this; + } + + /** + * Get options + * @return options + */ + @javax.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RequestOptionsDto getOptions() { + return options; + } + + + @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + this.options = options; + } + + + /** + * Return true if this TwoTermsRequest object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TwoTermsRequestDto twoTermsRequest = (TwoTermsRequestDto) o; + return Objects.equals(this.terms, twoTermsRequest.terms) && + Objects.equals(this.options, twoTermsRequest.options); + } + + @Override + public int hashCode() { + return Objects.hash(terms, options); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TwoTermsRequestDto {\n"); + sb.append(" terms: ").append(toIndentedString(terms)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `terms` to the URL query string + if (getTerms() != null) { + for (int i = 0; i < getTerms().size(); i++) { + if (getTerms().get(i) != null) { + joiner.add(getTerms().get(i).toUrlQueryString(String.format(java.util.Locale.ROOT, "%sterms%s%s", prefix, suffix, + "".equals(suffix) ? "" : String.format(java.util.Locale.ROOT, "%s%d%s", containerPrefix, i, containerSuffix)))); + } + } + } + + // add `options` to the URL query string + if (getOptions() != null) { + joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/package-info.java b/src/main/java/com/regexsolver/api/package-info.java deleted file mode 100644 index 62b3b26..0000000 --- a/src/main/java/com/regexsolver/api/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Contains all the classes you need to start using the library. - *

- * To start using this library you need to first request an API token at RegexSolver Console, - * set it as environment variable in REGEXSOLVER_API_TOKEN then call RegexSolverApiWrapper.initialize(). - *

- *

- * You can find some examples in our documentation. - *

- */ -package com.regexsolver.api; \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java new file mode 100644 index 0000000..a1e46f6 --- /dev/null +++ b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java @@ -0,0 +1,540 @@ +package com.regexsolver.api; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.*; + +import com.regexsolver.api.exceptions.*; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.api.AnalyzeApi; +import com.regexsolver.api.generated.api.ComputeApi; +import com.regexsolver.api.generated.api.GenerateApi; +import com.regexsolver.api.generated.model.*; +import java.lang.reflect.Field; +import java.net.http.HttpHeaders; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class AsyncRegexSolverClientTest { + + @Mock + private AnalyzeApi analyzeApi; + + @Mock + private ComputeApi computeApi; + + @Mock + private GenerateApi generateApi; + + private AsyncRegexSolverClient client; + + @BeforeEach + void setUp() throws Exception { + // Build the real client + client = AsyncRegexSolverClient.builder() + .apiToken("test-token") + .build(); + + // Use reflection to inject the mocks into the final class fields + injectMock(client, "analyzeApi", analyzeApi); + injectMock(client, "computeApi", computeApi); + injectMock(client, "generateApi", generateApi); + } + + private void injectMock(Object target, String fieldName, Object mock) + throws Exception { + Field field = target.getClass().getDeclaredField(fieldName); + field.setAccessible(true); + field.set(target, mock); + } + + @Test + void testGetCardinalityInteger() { + Term term = Term.regex("abc"); + + Cardinality200ResponseDto responseDto = new Cardinality200ResponseDto(); + CardinalityDto data = new CardinalityDto( + new CardinalityIntegerDto().value(42L) + ); + responseDto.setData(data); + + when(analyzeApi.cardinality(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Cardinality result = client.getCardinality(term).join(); + + assertThat(result).isInstanceOf(Cardinality.Integer.class); + assertThat(((Cardinality.Integer) result).getValue()).isEqualTo(42L); + assertThat(term.getCachedCardinality()).isEqualTo(result); + } + + @Test + void testGetCardinalityInfinite() { + Term term = Term.regex(".*"); + + Cardinality200ResponseDto responseDto = new Cardinality200ResponseDto(); + CardinalityDto data = new CardinalityDto(new CardinalityInfiniteDto()); + responseDto.setData(data); + + when(analyzeApi.cardinality(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Cardinality result = client.getCardinality(term).join(); + + assertThat(result).isInstanceOf(Cardinality.Infinite.class); + } + + @Test + void testGetLength() { + Term term = Term.regex("abc"); + + Length200ResponseDto responseDto = new Length200ResponseDto(); + LengthDto data = new LengthDto(); + data.setMin(3); + data.setMax(3); + responseDto.setData(data); + + when(analyzeApi.length(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Length result = client.getLength(term).join(); + + assertThat(result.getMin()).isEqualTo(3); + assertThat(result.getMax()).isEqualTo(3); + } + + @Test + void testIsEmpty() { + Term term = Term.regex("[]"); + + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Boolean result = client.isEmpty(term).join(); + + assertThat(result).isTrue(); + assertThat(term.getCachedEmpty()).isTrue(); + } + + @Test + void testComputeUnion() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("b"); + + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("a|b")); + responseDto.setData(data); + + when(computeApi.union(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.union(List.of(term1, term2)).join(); + + assertThat(result).isNotNull(); + assertThat(result.getPattern()).contains("a|b"); + } + + @Test + void testErrorHandling400_BadRequest() { + Term term = Term.regex("invalid["); + + String body = "{\"error\": \"Invalid regex\"}"; + ApiException apiException = new ApiException( + 400, + "Bad Request", + null, + body + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> client.isEmpty(term).join()) + .hasCauseInstanceOf(BadRequestException.class) + .hasMessageContaining("Invalid regex"); + } + + @Test + void testErrorHandling_InvalidJson() { + String body = + "{\"success\": false, \"error\": \"Invalid JSON\", \"errorCode\": \"InvalidJson\"}"; + ApiException apiException = new ApiException( + 400, + "Bad Request", + null, + body + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.isEmpty(Term.regex("abc")).join() + ).hasCauseInstanceOf(InvalidJsonException.class); + } + + @Test + void testErrorHandling_TooManyTerms() { + String body = + "{\"success\": false, \"error\": \"Too many terms\", \"errorCode\": \"TooManyTerms\"}"; + ApiException apiException = new ApiException( + 400, + "Bad Request", + null, + body + ); + + when(computeApi.union(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.union(List.of(Term.regex("a"), Term.regex("b"))).join() + ).hasCauseInstanceOf(TooManyTermsException.class); + } + + @Test + void testErrorHandling_TimeoutTooLarge() { + String body = + "{\"success\": false, \"error\": \"Timeout too large\", \"errorCode\": \"TimeoutTooLarge\"}"; + ApiException apiException = new ApiException( + 400, + "Bad Request", + null, + body + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.isEmpty(Term.regex("abc")).join() + ).hasCauseInstanceOf(TimeoutTooLargeException.class); + } + + @Test + void testErrorHandling_MissingOrMalformedToken() { + String body = + "{\"success\": false, \"error\": \"Missing token\", \"errorCode\": \"MissingOrMalformedToken\"}"; + ApiException apiException = new ApiException( + 401, + "Unauthorized", + null, + body + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.isEmpty(Term.regex("abc")).join() + ).hasCauseInstanceOf(MissingOrMalformedTokenException.class); + } + + @Test + void testErrorHandling_QuotaExceeded() { + String body = + "{\"success\": false, \"error\": \"Quota exceeded\", \"errorCode\": \"QuotaExceeded\"}"; + ApiException apiException = new ApiException( + 403, + "Forbidden", + null, + body + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.isEmpty(Term.regex("abc")).join() + ).hasCauseInstanceOf(QuotaExceededException.class); + } + + @Test + void testErrorHandling_500() { + ApiException apiException = new ApiException( + 500, + "Internal Server Error", + null, + null + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> + client.isEmpty(Term.regex("abc")).join() + ).hasCauseInstanceOf(InternalServerException.class); + } + + @Test + void testErrorHandling_OtherApiError() { + ApiException apiException = new ApiException( + 418, + "I'm a teapot", + null, + null + ); + + when(analyzeApi.empty(any())).thenReturn( + CompletableFuture.failedFuture(apiException) + ); + + assertThatThrownBy(() -> client.isEmpty(Term.regex("abc")).join()) + .hasCauseInstanceOf( + com.regexsolver.api.exceptions.ApiException.class + ) + .satisfies(e -> + assertThat( + ( + (com.regexsolver.api.exceptions.ApiException) e.getCause() + ).getStatusCode() + ).isEqualTo(418) + ); + } + + @Test + void testRetryOn429() { + Term term = Term.regex("abc"); + + HttpHeaders mockHeaders = mock(HttpHeaders.class); + when(mockHeaders.firstValue("Retry-After")).thenReturn( + Optional.of("0.1") + ); + ApiException error429 = new ApiException( + 429, + "Too Many Requests", + mockHeaders, + null + ); + + Empty200ResponseDto successResponse = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + successResponse.setData(data); + + // First call fails with 429, second call succeeds + when(analyzeApi.empty(any())) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.completedFuture(successResponse)); + + Boolean result = client.isEmpty(term).join(); + + assertThat(result).isTrue(); + // Verify it was called exactly twice + verify(analyzeApi, times(2)).empty(any()); + } + + @Test + void testEquivalent() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("a"); + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.equivalent(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.equivalent(term1, term2).join()).isTrue(); + } + + @Test + void testSubset() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("a|b"); + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.subset(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.subset(term1, term2).join()).isTrue(); + } + + @Test + void testIsEmptyString() { + Term term = Term.regex(""); + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.emptyString(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.isEmptyString(term).join()).isTrue(); + } + + @Test + void testIsTotal() { + Term term = Term.regex(".*"); + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.total(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.isTotal(term).join()).isTrue(); + } + + @Test + void testGetPattern() { + Term term = Term.regex("a"); + Dot200ResponseDto responseDto = new Dot200ResponseDto(); + StringDto data = new StringDto(); + data.setValue("a"); + responseDto.setData(data); + + when(analyzeApi.pattern(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.getPattern(term).join()).isEqualTo("a"); + } + + @Test + void testGetDot() { + Term term = Term.regex("a"); + Dot200ResponseDto responseDto = new Dot200ResponseDto(); + StringDto data = new StringDto(); + data.setValue("digraph {...}"); + responseDto.setData(data); + + when(analyzeApi.dot(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.getDot(term).join()).isEqualTo("digraph {...}"); + } + + @Test + void testConcat() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("b"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("ab")); + responseDto.setData(data); + + when(computeApi.concat(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.concat(List.of(term1, term2)).join(); + assertThat(result.getPattern()).contains("ab"); + } + + @Test + void testIntersection() { + Term term1 = Term.regex("a."); + Term term2 = Term.regex(".b"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("ab")); + responseDto.setData(data); + + when(computeApi.intersection(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.intersection(List.of(term1, term2)).join(); + assertThat(result.getPattern()).contains("ab"); + } + + @Test + void testDifference() { + Term term1 = Term.regex("a|b"); + Term term2 = Term.regex("b"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("a")); + responseDto.setData(data); + + when(computeApi.difference(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.difference(term1, term2).join(); + assertThat(result.getPattern()).contains("a"); + } + + @Test + void testRepeat() { + Term term = Term.regex("a"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("a{2,3}")); + responseDto.setData(data); + + when(computeApi.repeat(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.repeat(term, 2, 3).join(); + assertThat(result.getPattern()).contains("a{2,3}"); + } + + @Test + void testComplement() { + Term term = Term.regex(".*a.*"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermRegexDto().value("[^a].*")); + responseDto.setData(data); + + when(computeApi.complement(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.complement(term).join(); + assertThat(result.getPattern()).contains("[^a].*"); + } + + @Test + void testGenerateStrings() { + Term term = Term.regex("a*"); + Strings200ResponseDto responseDto = new Strings200ResponseDto(); + StringsDto stringsDto = new StringsDto(); + stringsDto.setValue(List.of("", "a", "aa")); + GenerateStringsResponseDto generateStrings = + new GenerateStringsResponseDto(); + generateStrings.setStrings(stringsDto); + responseDto.setData(generateStrings); + + when(generateApi.strings(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + List result = client.generateStrings(term, 3, 0).join(); + assertThat(result).containsExactly("", "a", "aa"); + } +} diff --git a/src/test/java/com/regexsolver/api/IntegrationTest.java b/src/test/java/com/regexsolver/api/IntegrationTest.java deleted file mode 100644 index beba50d..0000000 --- a/src/test/java/com/regexsolver/api/IntegrationTest.java +++ /dev/null @@ -1,201 +0,0 @@ -package com.regexsolver.api; - -import com.regexsolver.api.dto.Cardinality; -import com.regexsolver.api.dto.Length; -import com.regexsolver.api.exception.ApiError; - -import org.junit.Before; -import org.junit.Test; - -import java.util.List; - -import static org.junit.Assert.*; - -public class IntegrationTest { - @Before - public void setUp() throws Exception { - RegexSolver.initialize(); - } - - // Analyze - - @Test - public void test_analyze_cardinality() throws Exception { - Term term = Term.regex("[0-4]"); - - Cardinality cardinality = term.getCardinality(); - assertEquals("Integer(5)", cardinality.toString()); - } - - @Test - public void test_analyze_dot() throws Exception { - Term term = Term.regex("(abc|de)"); - String dot = term.getDot(); - assertTrue(dot.startsWith("digraph ")); - } - - @Test - public void test_analyze_empty_string() throws Exception { - Term term = Term.regex(""); - boolean result = term.isEmptyString(); - assertTrue(result); - } - - @Test - public void test_analyze_empty() throws Exception { - Term term = Term.regex("[]"); - boolean result = term.isEmpty(); - assertTrue(result); - } - - @Test - public void test_analyze_total() throws Exception { - Term term = Term.regex(".*"); - boolean result = term.isTotal(); - assertTrue(result); - } - - @Test - public void test_analyze_equivalent() throws Exception { - Term term1 = Term.regex("(abc|de)"); - Term term2 = Term.fair( - " strings = term.generateStrings(10); - assertEquals(4, strings.size()); - } - - // README - - @Test - public void test_readme_quickstart() throws Exception { - Term term1 = Term.regex("(abc|de|fg){2,}"); - Term term2 = Term.regex("de.*"); - Term term3 = Term.regex(".*abc"); - - Term result = term1.intersection(term2, term3) - .difference(Term.regex(".+(abc|de).+")); - assertEquals("de(fg)*abc", result.getPattern()); - } - - @Test - public void test_readme_response_format() throws Exception { - Term term = Term.regex("abcde"); - - OperationOptions operationOptions = OperationOptions.newDefault() - .responseFormat(ResponseFormat.REGEX); - Term result1 = term.union(operationOptions, Term.regex("de")); - - assertEquals("regex=(abc)?de", result1.toString()); - - operationOptions = OperationOptions.newDefault() - .responseFormat(ResponseFormat.FAIR); - Term result2 = term.union(operationOptions, Term.regex("de")); - - assertTrue(result2.toString().startsWith("fair=")); - } - - @Test - public void test_readme_execution_timeout() throws Exception { - try { - Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); - Term term2 = Term.regex(".*abc.*"); - - OperationOptions operationOptions = OperationOptions.newDefault() - .executionTimeout(5); - term1.difference(operationOptions, term2); - } catch (ApiError e) { - System.out.println(e.getMessage()); - } - } -} \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/ModelsTest.java b/src/test/java/com/regexsolver/api/ModelsTest.java new file mode 100644 index 0000000..9a7b850 --- /dev/null +++ b/src/test/java/com/regexsolver/api/ModelsTest.java @@ -0,0 +1,220 @@ +package com.regexsolver.api; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.regexsolver.api.generated.model.*; +import java.util.Optional; +import org.junit.jupiter.api.Test; + +class ModelsTest { + + @Test + void testTermCreationRegex() { + Term term = Term.regex("abc"); + assertThat(term.serialize()).isEqualTo("regex=abc"); + assertThat(term.toDto()).isNotNull(); + } + + @Test + void testTermCreationFair() { + Term term = Term.fair("fair_payload"); + assertThat(term.serialize()).isEqualTo("fair=fair_payload"); + assertThat(term.toDto()).isNotNull(); + } + + @Test + void testTermFromDtoRegex() { + TermDto genTerm = new TermDto(new TermRegexDto().value("abc")); + Term term = Term.fromDto(genTerm); + assertThat(term.serialize()).isEqualTo("regex=abc"); + assertThat(term.toDto()).isNotNull(); + } + + @Test + void testTermFromDtoFair() { + TermDto genTerm = new TermDto(new TermFairDto().value("payload")); + Term term = Term.fromDto(genTerm); + assertThat(term.serialize()).isEqualTo("fair=payload"); + assertThat(term.toDto()).isNotNull(); + } + + @Test + void testCardinalityInteger() { + Cardinality.Integer c = new Cardinality.Integer(10L); + assertThat(c.getValue()).isEqualTo(10L); + assertThat(c.isEmpty()).contains(false); + assertThat(c.isEmptyString()).contains(false); + assertThat(c.isTotal()).contains(false); + assertThat(c.toString()).isEqualTo(""); + } + + @Test + void testCardinalityFromDtoInteger() { + CardinalityDto genCard = new CardinalityDto( + new CardinalityIntegerDto().value(10L) + ); + Cardinality c = Cardinality.fromDto(genCard); + assertThat(c).isInstanceOf(Cardinality.Integer.class); + assertThat(((Cardinality.Integer) c).getValue()).isEqualTo(10L); + } + + @Test + void testCardinalityFromDtoBigInteger() { + CardinalityDto genCard = new CardinalityDto( + new CardinalityBigIntegerDto() + ); + Cardinality c = Cardinality.fromDto(genCard); + assertThat(c).isInstanceOf(Cardinality.BigInteger.class); + } + + @Test + void testCardinalityFromDtoInfinite() { + CardinalityDto genCard = new CardinalityDto( + new CardinalityInfiniteDto() + ); + Cardinality c = Cardinality.fromDto(genCard); + assertThat(c).isInstanceOf(Cardinality.Infinite.class); + } + + @Test + void testCardinalityIntegerZero() { + Cardinality.Integer c = new Cardinality.Integer(0L); + assertThat(c.isEmpty()).contains(true); + assertThat(c.isEmptyString()).contains(false); + } + + @Test + void testCardinalityIntegerOne() { + Cardinality.Integer c = new Cardinality.Integer(1L); + assertThat(c.isEmpty()).contains(false); + // Equivalent to Python's `is None` + assertThat(c.isEmptyString()).isEmpty(); + } + + @Test + void testCardinalityBigInteger() { + Cardinality.BigInteger c = new Cardinality.BigInteger(); + assertThat(c.isEmpty()).contains(false); + assertThat(c.isEmptyString()).contains(false); + assertThat(c.isTotal()).contains(false); + assertThat(c.toString()).isEqualTo(""); + } + + @Test + void testCardinalityInfinite() { + Cardinality.Infinite c = new Cardinality.Infinite(); + assertThat(c.isEmpty()).contains(false); + assertThat(c.isEmptyString()).contains(false); + assertThat(c.toString()).isEqualTo(""); + } + + @Test + void testLength() { + Length length = new Length(1, 5); + assertThat(length.getMin()).isEqualTo(1); + assertThat(length.getMax()).isEqualTo(5); + assertThat(length.isEmpty()).contains(false); + assertThat(length.isEmptyString()).contains(false); + assertThat(length.isTotal()).contains(false); + assertThat(length.toString()).isEqualTo(""); + } + + @Test + void testLengthFromDto() { + LengthDto genLen = new LengthDto(); + genLen.setMin(1); + genLen.setMax(5); + + Length lengthObj = Length.fromDto(genLen); + assertThat(lengthObj.getMin()).isEqualTo(1); + assertThat(lengthObj.getMax()).isEqualTo(5); + } + + @Test + void testLengthEmpty() { + Length length = new Length(null, null); + assertThat(length.isEmpty()).contains(true); + } + + @Test + void testLengthEmptyString() { + Length length = new Length(0, 0); + assertThat(length.isEmptyString()).contains(true); + } + + @Test + void testLengthTotalCandidate() { + Length length = new Length(0, null); + assertThat(length.isTotal()).isEmpty(); + } + + @Test + void testTermPropertiesCaching() { + Term term = Term.regex("abc"); + assertThat(term.getCachedCardinality()).isNull(); + + Cardinality.Integer c = new Cardinality.Integer(5L); + term.setCachedCardinality(c); + + // Simulate AsyncRegexSolverClient behavior + term.setPropertiesMixin(c); + + assertThat(term.getCachedCardinality()).isEqualTo(c); + // Since Integer(5).isEmpty() contains false, it should set _empty to false + assertThat(term.getCachedEmpty()).isFalse(); + } + + @Test + void testTermGetFairAndPattern() { + Term regexTerm = Term.regex("abc"); + assertThat(regexTerm.getPattern()).contains("abc"); + assertThat(regexTerm.getFair()).isEmpty(); + + Term fairTerm = Term.fair("payload"); + assertThat(fairTerm.getFair()).contains("payload"); + assertThat(fairTerm.getPattern()).isEmpty(); + + fairTerm.setCachedPattern("abc"); + assertThat(fairTerm.getPattern()).contains("abc"); + } + + @Test + void testTermSerializeDeserialize() { + Term term = Term.regex("abc"); + String serialized = term.serialize(); + assertThat(serialized).isEqualTo("regex=abc"); + assertThat(term.toString()).isEqualTo("regex=abc"); + + Optional deserializedOpt = Term.deserialize(serialized); + Term deserialized = deserializedOpt.get(); + assertThat(deserialized).isEqualTo(term); + assertThat(deserialized.hashCode()).isEqualTo(term.hashCode()); + + Term fairTerm = Term.fair("payload"); + assertThat(Term.deserialize(fairTerm.serialize())).isEqualTo(fairTerm); + + assertThat(Term.deserialize("invalid")).isNull(); + assertThat(Term.deserialize("unknown=value")).isNull(); + } + + @Test + void testTermIsMatch() { + Term term = Term.regex("a.b"); + assertThat(term.isMatch("axb")).isTrue(); + assertThat(term.isMatch("a\nb")).isTrue(); // DOTALL behavior + assertThat(term.isMatch("ab")).isFalse(); + assertThat(term.isMatch("axxb")).isFalse(); // anchored (fullmatch) + + Term fairTerm = Term.fair("payload"); + assertThatThrownBy(() -> fairTerm.isMatch("abc")).isInstanceOf( + IllegalStateException.class + ); + } + + @Test + void testTermRepr() { + Term term = Term.regex("abc"); + assertThat(term.toString()).isEqualTo(""); + } +} diff --git a/src/test/java/com/regexsolver/api/RateLimiterTest.java b/src/test/java/com/regexsolver/api/RateLimiterTest.java new file mode 100644 index 0000000..f3a0884 --- /dev/null +++ b/src/test/java/com/regexsolver/api/RateLimiterTest.java @@ -0,0 +1,74 @@ +package com.regexsolver.api; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +class RateLimiterTest { + + @Test + void testRateLimiterWaitIfNecessaryNoWait() { + RateLimiter rl = RateLimiter.getInstance("test-token-1"); + + long start = System.currentTimeMillis(); + // Should complete immediately since we haven't triggered a wait + rl.waitIfNecessary().join(); + long end = System.currentTimeMillis(); + + assertThat(end - start).isLessThan(50); // Allowing a small buffer for execution time + } + + @Test + void testRateLimiterTriggerAndWait() { + RateLimiter rl = RateLimiter.getInstance("test-token-2"); + + // Trigger a 0.2 second (200ms) delay + rl.trigger(0.2); + + long start = System.currentTimeMillis(); + rl.waitIfNecessary().join(); + long end = System.currentTimeMillis(); + + long duration = end - start; + // It should have waited at least ~200ms + assertThat(duration).isGreaterThanOrEqualTo(150); // 150ms to prevent flaky tests on slow CI + } + + @Test + void testRateLimiterTriggerAlreadyCleared() { + RateLimiter rl = RateLimiter.getInstance("test-token-3"); + + // Trigger a 0.1 second delay + rl.trigger(0.1); + + // Immediately trigger a shorter delay (0.05 seconds) + rl.trigger(0.05); + + long start = System.currentTimeMillis(); + rl.waitIfNecessary().join(); + long end = System.currentTimeMillis(); + + long duration = end - start; + + // The rate limiter should respect the LONGER of the two triggered delays + // Next retry was set to now + 100ms, the second call tried to set it to now + 50ms, + // but updateAndGet ensures it keeps the later Instant. + assertThat(duration).isGreaterThanOrEqualTo(80); + } + + @Test + void testGetInstanceReturnsSameInstanceForSameToken() { + RateLimiter rl1 = RateLimiter.getInstance("tokenA"); + RateLimiter rl2 = RateLimiter.getInstance("tokenA"); + + assertThat(rl1).isSameAs(rl2); + } + + @Test + void testGetInstanceReturnsDifferentInstanceForDifferentTokens() { + RateLimiter rl1 = RateLimiter.getInstance("tokenB"); + RateLimiter rl2 = RateLimiter.getInstance("tokenC"); + + assertThat(rl1).isNotSameAs(rl2); + } +} diff --git a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java new file mode 100644 index 0000000..b7a2b5d --- /dev/null +++ b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java @@ -0,0 +1,152 @@ +package com.regexsolver.api; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.lang.reflect.Field; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +@ExtendWith(MockitoExtension.class) +class RegexSolverClientTest { + + @Mock + private AsyncRegexSolverClient asyncClient; + + private RegexSolverClient client; + + @BeforeEach + void setUp() throws Exception { + // Build the synchronous client + client = RegexSolverClient.builder().apiToken("test-token").build(); + + // Use reflection to inject the mocked Async client into the private field + Field field = RegexSolverClient.class.getDeclaredField("asyncClient"); + field.setAccessible(true); + field.set(client, asyncClient); + } + + @Test + void testSyncClientGetCardinality() { + Term term = Term.regex("abc"); + Cardinality.Integer mockResult = new Cardinality.Integer(42L); + + when(asyncClient.getCardinality(any())).thenReturn( + CompletableFuture.completedFuture(mockResult) + ); + + Cardinality result = client.getCardinality(term); + + assertThat(result).isInstanceOf(Cardinality.Integer.class); + assertThat(((Cardinality.Integer) result).getValue()).isEqualTo(42L); + + // Verify the async client was called + verify(asyncClient).getCardinality(term); + } + + @Test + void testSyncClientIsEmpty() { + Term term = Term.regex("abc"); + + when(asyncClient.isEmpty(any())).thenReturn( + CompletableFuture.completedFuture(false) + ); + + boolean result = client.isEmpty(term); + + assertThat(result).isFalse(); + verify(asyncClient).isEmpty(term); + } + + @Test + void testSyncClientUnion() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("b"); + Term mockResultTerm = Term.regex("a|b"); + List termList = List.of(term1, term2); + + // We mock the format and timeout overloaded method since the base + // concat/union/intersection methods in AsyncClient pass 'null' down. + when(asyncClient.union(any(), isNull(), isNull())).thenReturn( + CompletableFuture.completedFuture(mockResultTerm) + ); + + // Let's assume the sync client passes down to the async client's 3-arg method + Term result = client.union(termList, null, null); + + assertThat(result.getPattern()).contains("a|b"); + verify(asyncClient).union(termList, null, null); + } + + @Test + void testSyncClientComplement() { + Term term = Term.regex(".*a.*"); + Term mockResultTerm = Term.regex("[^a].*"); + + when(asyncClient.complement(any(), isNull(), isNull())).thenReturn( + CompletableFuture.completedFuture(mockResultTerm) + ); + + Term result = client.complement(term, null, null); + + assertThat(result.getPattern()).contains("[^a].*"); + verify(asyncClient).complement(term, null, null); + } + + @Test + void testSyncClientGetLength() { + Term term = Term.regex("(abc)?d"); + Length mockLength = new Length(1, 4); + + when(asyncClient.getLength(any())).thenReturn( + CompletableFuture.completedFuture(mockLength) + ); + + Length result = client.getLength(term); + + assertThat(result.getMin()).isEqualTo(1); + assertThat(result.getMax()).isEqualTo(4); + verify(asyncClient).getLength(term); + } + + @Test + void testSyncClientIntersection() { + Term term1 = Term.regex("a"); + Term term2 = Term.regex("ab"); + Term mockResultTerm = Term.regex("a"); + List termList = List.of(term1, term2); + + when(asyncClient.intersection(any(), isNull(), isNull())).thenReturn( + CompletableFuture.completedFuture(mockResultTerm) + ); + + Term result = client.intersection(termList, null, null); + + assertThat(result.getPattern()).contains("a"); + verify(asyncClient).intersection(termList, null, null); + } + + @Test + void testSyncClientGenerateStrings() { + Term term = Term.regex("a*"); + List mockStrings = List.of("", "a", "aa"); + + when(asyncClient.generateStrings(any(), eq(3), eq(0))).thenReturn( + CompletableFuture.completedFuture(mockStrings) + ); + + List result = client.generateStrings(term, 3, 0); + + assertThat(result).containsExactly("", "a", "aa"); + verify(asyncClient).generateStrings(term, 3, 0); + } +} diff --git a/src/test/java/com/regexsolver/api/TermOperationTest.java b/src/test/java/com/regexsolver/api/TermOperationTest.java deleted file mode 100644 index 44d4e77..0000000 --- a/src/test/java/com/regexsolver/api/TermOperationTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.regexsolver.api; - -import com.regexsolver.api.exception.ApiError; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; - -import static org.junit.Assert.*; - -public class TermOperationTest { - private MockWebServer server; - - @Before - public void setUp() throws Exception { - server = new MockWebServer(); - server.start(); - - RegexSolver.initialize("TOKEN", server.url("/").toString()); - } - - @After - public void tearDown() throws IOException { - server.shutdown(); - } - - @Test - public void test_errorResponse() throws IOException { - MockResponse response = TestUtils.generateErrorMockResponse(TestUtils.getResourceFileContent("response_error.json"), 400); - server.enqueue(response); - - Term.Regex term1 = Term.regex("abc"); - Term.Regex term2 = Term.regex("de"); - - try { - term1.intersection(term2); - fail(); - } catch (ApiError e) { - assertEquals("The API returned the following error: A random error.", e.getMessage()); - } - } -} \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/TermSerializeTest.java b/src/test/java/com/regexsolver/api/TermSerializeTest.java deleted file mode 100644 index 4073af1..0000000 --- a/src/test/java/com/regexsolver/api/TermSerializeTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.regexsolver.api; - - -import org.junit.Test; - -import java.util.Optional; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -public class TermSerializeTest { - @Test - public void test_serialization_deserialization() { - assertSerialization(Term.regex(".*")); - assertSerialization(Term.regex("=")); - assertSerialization(Term.regex("")); - - assertSerialization(Term.fair("rgmsW[1g2LvP=Gr&V>sLc#w-!No&(oq@Sf>X).?lI3{uh{80qWEH[#0.pHq@B-9o[LpP-a#fYI+")); - assertSerialization(Term.fair("=rgmsW[1g2LvP=Gr&+")); - assertSerialization(Term.fair("")); - - assertTrue(Term.deserialize(null).isEmpty()); - assertTrue(Term.deserialize("not a term").isEmpty()); - } - - private void assertSerialization(Term term) { - String serialized = term.serialize(); - Optional deserializedOptional = Term.deserialize(serialized); - assertTrue(deserializedOptional.isPresent()); - Term deserialized = deserializedOptional.get(); - assertEquals(term, deserialized); - } -} \ No newline at end of file diff --git a/src/test/java/com/regexsolver/api/TestUtils.java b/src/test/java/com/regexsolver/api/TestUtils.java deleted file mode 100644 index 3553248..0000000 --- a/src/test/java/com/regexsolver/api/TestUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.regexsolver.api; - -import com.fasterxml.jackson.databind.ObjectMapper; -import okhttp3.mockwebserver.MockResponse; -import okio.Buffer; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import static org.junit.Assert.assertNotNull; - -class TestUtils { - public static String getResourceFileContent(String resourceName) throws IOException { - String content; - try (InputStream inputStream = TestUtils.class - .getClassLoader() - .getResourceAsStream(resourceName)) { - assertNotNull(inputStream); - content = new String(inputStream.readAllBytes()); - } - return content; - } - - public static MockResponse generateMockResponse(String content) { - return new MockResponse() - .addHeader("Content-Type", "application/json; charset=utf-8") - .addHeader("Cache-Control", "no-cache") - .setBody(content); - } - - public static MockResponse generateErrorMockResponse(String content, int code) { - return generateMockResponse(content) - .setResponseCode(code); - } - - public static T readBuffer(Buffer buffer, Class type) throws IOException { - ByteArrayOutputStream stream - = new ByteArrayOutputStream(); - buffer.writeTo(stream); - - String json = stream.toString(); - - ObjectMapper mapper = new ObjectMapper(); - return mapper.readValue(json, type); - } -} diff --git a/src/test/resources/response_error.json b/src/test/resources/response_error.json deleted file mode 100644 index 0faf2d7..0000000 --- a/src/test/resources/response_error.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "type": "error", - "message": "A random error." -} \ No newline at end of file From 5f980607081c54dbddfbf3cfe29178999beffdc9 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 29 Mar 2026 17:19:19 +0200 Subject: [PATCH 11/24] Update README.md --- README.md | 142 +++++++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index caf0f9e..1bfa60b 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,11 @@ # RegexSolver Java API Client - [Homepage](https://regexsolver.com) | [Online Demo](https://regexsolver.com/demo) | [Documentation](https://docs.regexsolver.com) | [Developer Console](https://console.regexsolver.com) **RegexSolver** is a powerful toolkit for building, combining, and analyzing regular expressions. It is designed for constraint solvers, test generators, and other systems that need advanced regex operations. ## Installation -### Requirements - -- Java >=11 +Requirements: **Java >= 11** ### Maven @@ -26,37 +23,60 @@ implementation "com.regexsolver.api:RegexSolver:1.1.0" ``` -## Usage +## Quick Start 1. Create an API token in the [Developer Console](https://console.regexsolver.com/). -2. Initialize the client and start working with terms: +2. Initialize the client and start working with terms. + +### Synchronous Usage + +The synchronous client provides a simple, blocking API. ```java -import com.regexsolver.api.RegexSolver; +import com.regexsolver.api.RegexSolverClient; import com.regexsolver.api.Term; -import com.regexsolver.api.exception.ApiError; - -import java.io.IOException; +import java.util.Arrays; public class Main { - public static void main(String[] args) throws IOException, ApiError { - // Set REGEXSOLVER_API_TOKEN in your env and call initialize(), - // or pass the token directly: - RegexSolver.initialize(); // or RegexSolver.initialize("YOUR_API_TOKEN"); + public static void main(String[] args) { + RegexSolverClient client = RegexSolverClient.builder() + .apiToken("YOUR_API_TOKEN") + .build(); - // Create terms Term term1 = Term.regex("(abc|de|fg){2,}"); Term term2 = Term.regex("de.*"); - Term term3 = Term.regex(".*abc"); - // Compute intersection and difference - Term result = term1.intersection(term2, term3) - .difference(Term.regex(".+(abc|de).+")); - System.out.println(result.getPattern()); // de(fg)*abc + Term intersection = client.intersection(Arrays.asList(term1, term2)); + String pattern = client.getPattern(intersection); + System.out.println(pattern); // de(abc|de|fg)+ } } ``` +### Asynchronous Usage + +For non-blocking applications, use the asynchronous client. + +```java +import com.regexsolver.api.AsyncRegexSolverClient; +import com.regexsolver.api.Term; +import java.util.Arrays; + +public class Main { + public static void main(String[] args) { + AsyncRegexSolverClient client = AsyncRegexSolverClient.builder() + .apiToken("YOUR_API_TOKEN") + .build(); + + Term term1 = Term.regex("(abc|de|fg){2,}"); + Term term2 = Term.regex("de.*"); + + client.intersection(Arrays.asList(term1, term2)) + .thenCompose(client::getPattern) + .thenAccept(System.out::println); // de(abc|de|fg)+ + } +} +``` ## Key Concepts & Limitations @@ -68,32 +88,28 @@ RegexSolver supports a subset of regular expressions that adhere to the principl - **Line Feed and Dot:** RegexSolver handles all characters the same way. The dot `.` matches any Unicode character including line feed (`\n`). - **Empty Regular Expressions:** The empty language (matches no string) is represented by constructs like `[]` (empty character class). This is distinct from the empty string. - ## Response Formats The API can handle terms in two formats: - `regex`: a regular expression pattern - `fair`: FAIR (Fast Automaton Internal Representation), a stable, signed format used internally by the engine -By default, the engine returns whatever the operation produces, with no extra convertion. Override with `responseFormat`: +By default, the engine returns whatever the operation produces, with no extra convertion. Override with `ResponseFormat`: ```java -Term term = Term.regex("abcde"); +import com.regexsolver.api.ResponseFormat; -OperationOptions operationOptions = OperationOptions.newDefault() - .responseFormat(ResponseFormat.REGEX); -Term result1 = term.union(operationOptions, Term.regex("de")); +Term term1 = Term.regex("abcde"); +Term term2 = Term.regex("de"); +Term result1 = client.union(Arrays.asList(term1, term2), ResponseFormat.REGEX, null); System.out.println(result1); // regex=(abc)?de -operationOptions = OperationOptions.newDefault() - .responseFormat(ResponseFormat.FAIR); -Term result2 = term.union(operationOptions, Term.regex("de")); - +Term result2 = client.union(Arrays.asList(term1, term2), ResponseFormat.FAIR, null); System.out.println(result2); // fair=... ``` -If the format does not matter, omit `responseFormat` or set it to `ResponseFormat.ANY`. +If the format does not matter, omit `ResponseFormat` or set it to `ResponseFormat.ANY`. Regardless of the format, you can always call `getPattern()` to obtain the regex pattern of a term. @@ -102,16 +118,16 @@ Regardless of the format, you can always call `getPattern()` to obtain the regex Set a server-side compute timeout in milliseconds with `executionTimeout`: ```java -// Limit the server-side compute time to 5 ms +import com.regexsolver.api.exceptions.TimeoutExceededException; + +// Limit the server-side compute time to 100 ms try { Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); Term term2 = Term.regex(".*abc.*"); - - OperationOptions operationOptions = OperationOptions.newDefault() - .executionTimeout(5); - Term out = term1.difference(operationOptions, term2); -} catch (ApiError e) { - System.out.println(e.getMessage()); // The operation took too much time. + + Term res = client.difference(term1, term2, null, 100); +} catch (TimeoutExceededException error) { + System.out.println(error.getMessage()); // The operation took too much time. } ``` @@ -119,50 +135,44 @@ Timeout is best effort. The exact time is not guaranteed. ## API Overview -`Term` exposes the following methods. - -### Build -| Method | Return | Description | -| -------- | ------- | ------- | -| `Term.fair(String fair)` | `Term` | Creates a term from a FAIR. | -| `Term.regex(String regex)` | `Term` | Creates a term from a regex pattern. | +`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. ### Analyze | Method | Return | Description | | -------- | ------- | ------- | -| `t.equivalent(Term term)` | `boolean` | `true` if `t` and `term` accept exactly the same language. Supports `executionTimeout`. | -| `t.getCardinality()` | `Cardinality` | Returns the cardinality of the term (i.e., the number of possible matched strings). | -| `t.getDot()` | `String` | Returns a Graphviz DOT representation of the automaton for the term. | -| `t.getFair()` | `String` | Returns the FAIR of the term if defined. | -| `t.getLength()` | `Length` | Returns the minimum and maximum length of matched strings. | -| `t.getPattern()` | `String` | Returns a regular expression pattern for the term. | -| `t.isEmpty()` | `boolean` | `true` if the term matches no string. | -| `t.isEmptyString()` | `boolean` | `true` if the term matches only the empty string. | -| `t.isTotal()` | `boolean` | `true` if the term matches all possible strings. | -| `t.subset(Term term)` | `boolean` | `true` if every string matched by `t` is also matched by `term`. Supports `executionTimeout`. | +| `client.equivalent(term1, term2)` | `boolean` | `true` if `term1` and `term2` accept exactly the same language. | +| `client.getCardinality(term)` | `Cardinality` | Returns the number of possible matched strings. | +| `client.getDot(term)` | `String` | Returns a Graphviz DOT representation of the automaton. | +| `client.getLength(term)` | `Length` | Returns the minimum and maximum length of matched strings. | +| `client.getPattern(term)` | `String` | Returns a regular expression pattern for the term. | +| `client.isEmpty(term)` | `boolean` | `true` if the term matches no string. | +| `client.isEmptyString(term)` | `boolean` | `true` if the term matches only the empty string. | +| `client.isTotal(term)` | `boolean` | `true` if the term matches all possible strings. | +| `client.subset(term1, term2)` | `boolean` | `true` if every string matched by `term1` is also matched by `term2`. | + +*Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* ### Compute | Method | Return | Description | | -------- | ------- | ------- | -| `t.concat(Term... terms)` | `Term` | Concatenates `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | -| `t.difference(Term term)` | `Term` | Computes the difference `t - term`. Supports `responseFormat` and `executionTimeout`. | -| `t.intersection(Term... terms)` | `Term` | Computes the intersection of `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | -| `t.repeat(int min, Integer max)` | `Term` | Computes the repetition of the term between `min` and `max` times; if `max` is `null`, the repetition is unbounded. Supports `responseFormat` and `executionTimeout`. | -| `t.union(Term... terms)` | `Term` | Computes the union of `t` with the given terms. Supports `responseFormat` and `executionTimeout`. | +| `client.complement(term)` | `Term` | Computes the complement of the given term. | +| `client.concat(terms)` | `Term` | Concatenates multiple terms in order. | +| `client.difference(term1, term2)` | `Term` | Computes the difference `term1 - term2`. | +| `client.intersection(terms)` | `Term` | Computes the intersection of the given terms. | +| `client.repeat(term, min, max)` | `Term` | Computes the repetition of the term between `min` and `max` times. | +| `client.union(terms)` | `Term` | Computes the union of the given terms. | + +*Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* ### Generate | Method | Return | Description | | -------- | ------- | ------- | -| `t.generateStrings(int count)` | `String[]` | Generates up to `count` unique example strings matched by `t`. Supports `executionTimeout`. | +| `client.generateStrings(term, limit, offset)` | `List` | Generates up to `limit` unique strings matched by `term`, skipping the first `offset` strings. | -### Other -| Method | Return | Description | -| -------- | ------- | ------- | -| `t.serialize()` | `String` | Returns a serialized form of `t`. | -| `Term.deserialize(String string)` | `Term` | Returns a deserialized term from the given `string`. | +*Note: For `AsyncRegexSolverClient`, this method returns `CompletableFuture>`.* ## Cross-Language Support From 3d2b26ad8f97688d3b361fcdabe873e39ab81e8c Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 29 Mar 2026 19:08:17 +0200 Subject: [PATCH 12/24] Update methods calls --- README.md | 20 +- .../api/AsyncRegexSolverClient.java | 242 ++++++++++------- .../com/regexsolver/api/OperationOptions.java | 44 +++ .../regexsolver/api/RegexSolverClient.java | 252 +++++++++--------- .../api/RegexSolverClientTest.java | 14 +- 5 files changed, 332 insertions(+), 240 deletions(-) create mode 100644 src/main/java/com/regexsolver/api/OperationOptions.java diff --git a/README.md b/README.md index 1bfa60b..131eb57 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ public class Main { Term term1 = Term.regex("(abc|de|fg){2,}"); Term term2 = Term.regex("de.*"); - Term intersection = client.intersection(Arrays.asList(term1, term2)); + Term intersection = client.intersection(term1, term2); String pattern = client.getPattern(intersection); System.out.println(pattern); // de(abc|de|fg)+ } @@ -71,7 +71,7 @@ public class Main { Term term1 = Term.regex("(abc|de|fg){2,}"); Term term2 = Term.regex("de.*"); - client.intersection(Arrays.asList(term1, term2)) + client.intersection(term1, term2) .thenCompose(client::getPattern) .thenAccept(System.out::println); // de(abc|de|fg)+ } @@ -94,38 +94,38 @@ The API can handle terms in two formats: - `regex`: a regular expression pattern - `fair`: FAIR (Fast Automaton Internal Representation), a stable, signed format used internally by the engine -By default, the engine returns whatever the operation produces, with no extra convertion. Override with `ResponseFormat`: +By default, the engine returns whatever the operation produces, with no extra convertion. Override with `OperationOptions`: ```java import com.regexsolver.api.ResponseFormat; +import com.regexsolver.api.OperationOptions; Term term1 = Term.regex("abcde"); Term term2 = Term.regex("de"); -Term result1 = client.union(Arrays.asList(term1, term2), ResponseFormat.REGEX, null); +Term result1 = client.union(Arrays.asList(term1, term2), new OperationOptions().responseFormat(ResponseFormat.REGEX)); System.out.println(result1); // regex=(abc)?de -Term result2 = client.union(Arrays.asList(term1, term2), ResponseFormat.FAIR, null); +Term result2 = client.union(Arrays.asList(term1, term2), new OperationOptions().responseFormat(ResponseFormat.FAIR)); System.out.println(result2); // fair=... ``` -If the format does not matter, omit `ResponseFormat` or set it to `ResponseFormat.ANY`. - Regardless of the format, you can always call `getPattern()` to obtain the regex pattern of a term. ## Bounding execution time -Set a server-side compute timeout in milliseconds with `executionTimeout`: +Set a server-side compute timeout in milliseconds with `executionTimeout` in `OperationOptions`: ```java import com.regexsolver.api.exceptions.TimeoutExceededException; +import com.regexsolver.api.OperationOptions; // Limit the server-side compute time to 100 ms try { Term term1 = Term.regex(".*ab.*c(de|fg).*dab.*c(de|fg).*ab.*c(de|fg).*dab.*c"); Term term2 = Term.regex(".*abc.*"); - Term res = client.difference(term1, term2, null, 100); + Term res = client.difference(term1, term2, new OperationOptions().executionTimeout(100)); } catch (TimeoutExceededException error) { System.out.println(error.getMessage()); // The operation took too much time. } @@ -135,7 +135,7 @@ Timeout is best effort. The exact time is not guaranteed. ## API Overview -`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. +`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. All methods accept an optional `OperationOptions` object as the last parameter. ### Analyze diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index ab47830..89cce26 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -9,8 +9,8 @@ import com.regexsolver.api.generated.api.GenerateApi; import com.regexsolver.api.generated.model.*; import java.net.http.HttpHeaders; +import java.util.Arrays; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -81,18 +81,23 @@ public AsyncRegexSolverClient build() { // --- INTERNAL HELPERS --- - private RequestOptionsDto buildOptions( - Integer timeout, - ResponseFormat format - ) { - RequestOptionsDto options = new RequestOptionsDto().schemaVersion(1); - if (timeout != null) { - options.execution(new ExecutionOptionsDto().timeout(timeout)); - } - if (format != null) { - options.response(new ResponseOptionsDto().format(format.toDto())); + private RequestOptionsDto buildOptions(OperationOptions options) { + RequestOptionsDto dto = new RequestOptionsDto().schemaVersion(1); + if (options != null) { + options + .getExecutionTimeout() + .ifPresent(timeout -> + dto.execution(new ExecutionOptionsDto().timeout(timeout)) + ); + options + .getResponseFormat() + .ifPresent(format -> + dto.response( + new ResponseOptionsDto().format(format.toDto()) + ) + ); } - return options; + return dto; } private CompletableFuture executeWithRetry( @@ -261,19 +266,19 @@ private RegexSolverException mapException(ApiException ex) { * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public CompletableFuture getCardinality(Term term) { - return getCardinality(term, null); + return getCardinality(term, (OperationOptions) null); } /** * Computes how many unique strings the term matches asynchronously. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public CompletableFuture getCardinality( Term term, - Integer timeout + OperationOptions options ) { if (term.getCachedCardinality() != null) { return CompletableFuture.completedFuture( @@ -282,7 +287,7 @@ public CompletableFuture getCardinality( } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.cardinality(request) ).thenApply(resp -> { @@ -299,23 +304,26 @@ public CompletableFuture getCardinality( * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public CompletableFuture getLength(Term term) { - return getLength(term, null); + return getLength(term, (OperationOptions) null); } /** * Computes the minimum and maximum length of strings matched by the term asynchronously. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ - public CompletableFuture getLength(Term term, Integer timeout) { + public CompletableFuture getLength( + Term term, + OperationOptions options + ) { if (term.getCachedLength() != null) { return CompletableFuture.completedFuture(term.getCachedLength()); } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.length(request)).thenApply( resp -> { Length len = Length.fromDto(resp.getData()); @@ -332,23 +340,26 @@ public CompletableFuture getLength(Term term, Integer timeout) { * @return A CompletableFuture containing true if the language is completely empty, false otherwise. */ public CompletableFuture isEmpty(Term term) { - return isEmpty(term, null); + return isEmpty(term, (OperationOptions) null); } /** * Checks if the term matches no strings at all asynchronously. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing true if the language is completely empty, false otherwise. */ - public CompletableFuture isEmpty(Term term, Integer timeout) { + public CompletableFuture isEmpty( + Term term, + OperationOptions options + ) { if (term.getCachedEmpty() != null) { return CompletableFuture.completedFuture(term.getCachedEmpty()); } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.empty(request)).thenApply( resp -> { boolean val = resp.getData().getValue(); @@ -369,19 +380,19 @@ public CompletableFuture isEmpty(Term term, Integer timeout) { * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. */ public CompletableFuture isEmptyString(Term term) { - return isEmptyString(term, null); + return isEmptyString(term, (OperationOptions) null); } /** * Checks if the term matches only the empty string asynchronously. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. */ public CompletableFuture isEmptyString( Term term, - Integer timeout + OperationOptions options ) { if (term.getCachedEmptyString() != null) { return CompletableFuture.completedFuture( @@ -390,7 +401,7 @@ public CompletableFuture isEmptyString( } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.emptyString(request) ).thenApply(resp -> { @@ -412,23 +423,26 @@ public CompletableFuture isEmptyString( * @return A CompletableFuture containing true if the term matches every possible string. */ public CompletableFuture isTotal(Term term) { - return isTotal(term, null); + return isTotal(term, (OperationOptions) null); } /** * Checks if the term matches all possible strings asynchronously. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing true if the term matches every possible string. */ - public CompletableFuture isTotal(Term term, Integer timeout) { + public CompletableFuture isTotal( + Term term, + OperationOptions options + ) { if (term.getCachedTotal() != null) { return CompletableFuture.completedFuture(term.getCachedTotal()); } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.total(request)).thenApply( resp -> { boolean val = resp.getData().getValue(); @@ -450,32 +464,35 @@ public CompletableFuture isTotal(Term term, Integer timeout) { * @return A CompletableFuture containing a valid regular expression string representing the language. */ public CompletableFuture getPattern(Term term) { - return getPattern(term, null); + return getPattern(term, (OperationOptions) null); } /** * Returns a regular expression pattern that represents the term asynchronously. * * @param term The term to extract the pattern from. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a valid regular expression string representing the language. */ - public CompletableFuture getPattern(Term term, Integer timeout) { - Optional patternOpt = term.getPattern(); - if (patternOpt.isPresent()) { - return CompletableFuture.completedFuture(patternOpt.get()); - } - - TermRequestDto request = new TermRequestDto() - .term(term.toDto()) - .options(buildOptions(timeout, null)); - return executeWithRetry(() -> analyzeApi.pattern(request)).thenApply( - resp -> { - String val = resp.getData().getValue(); - term.setCachedPattern(val); - return val; - } - ); + public CompletableFuture getPattern( + Term term, + OperationOptions options + ) { + return term + .getPattern() + .map(CompletableFuture::completedFuture) + .orElseGet(() -> { + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(options)); + return executeWithRetry(() -> + analyzeApi.pattern(request) + ).thenApply(resp -> { + String val = resp.getData().getValue(); + term.setCachedPattern(val); + return val; + }); + }); } /** @@ -485,23 +502,26 @@ public CompletableFuture getPattern(Term term, Integer timeout) { * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. */ public CompletableFuture getDot(Term term) { - return getDot(term, null); + return getDot(term, (OperationOptions) null); } /** * Builds a Graphviz DOT representation of the term's automaton asynchronously. * * @param term The term to visualize. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. */ - public CompletableFuture getDot(Term term, Integer timeout) { + public CompletableFuture getDot( + Term term, + OperationOptions options + ) { if (term.getCachedDot() != null) { return CompletableFuture.completedFuture(term.getCachedDot()); } TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.dot(request)).thenApply( resp -> { String val = resp.getData().getValue(); @@ -519,7 +539,7 @@ public CompletableFuture getDot(Term term, Integer timeout) { * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. */ public CompletableFuture equivalent(Term term1, Term term2) { - return equivalent(term1, term2, null); + return equivalent(term1, term2, (OperationOptions) null); } /** @@ -527,18 +547,18 @@ public CompletableFuture equivalent(Term term1, Term term2) { * * @param term1 The first term. * @param term2 The second term to compare against. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. */ public CompletableFuture equivalent( Term term1, Term term2, - Integer timeout + OperationOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(term1.toDto()) .addTermsItem(term2.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.equivalent(request)).thenApply( resp -> resp.getData().getValue() ); @@ -552,7 +572,7 @@ public CompletableFuture equivalent( * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. */ public CompletableFuture subset(Term subset, Term superset) { - return subset(subset, superset, null); + return subset(subset, superset, (OperationOptions) null); } /** @@ -560,18 +580,18 @@ public CompletableFuture subset(Term subset, Term superset) { * * @param subset The term to test as the subset. * @param superset The term representing the entire set space. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. */ public CompletableFuture subset( Term subset, Term superset, - Integer timeout + OperationOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(subset.toDto()) .addTermsItem(superset.toDto()) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> analyzeApi.subset(request)).thenApply( resp -> resp.getData().getValue() ); @@ -579,6 +599,16 @@ public CompletableFuture subset( // --- COMPUTE OPERATIONS --- + /** + * Concatenates the given terms sequentially asynchronously. + * + * @param terms Variadic terms to concatenate in order. + * @return A CompletableFuture containing a newly computed concatenated term. + */ + public CompletableFuture concat(Term... terms) { + return concat(Arrays.asList(terms)); + } + /** * Concatenates the given terms sequentially asynchronously. * @@ -586,30 +616,38 @@ public CompletableFuture subset( * @return A CompletableFuture containing a newly computed concatenated term. */ public CompletableFuture concat(List terms) { - return concat(terms, ResponseFormat.ANY, null); + return concat(terms, (OperationOptions) null); } /** * Concatenates the given terms sequentially asynchronously. * * @param terms A dynamic list of terms to concatenate in order. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a newly computed concatenated term. */ public CompletableFuture concat( List terms, - ResponseFormat format, - Integer timeout + OperationOptions options ) { MultiTermsRequestDto request = new MultiTermsRequestDto() .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.concat(request)).thenApply( resp -> Term.fromDto(resp.getData()) ); } + /** + * Computes the intersection of the given terms asynchronously. + * + * @param terms Variadic terms to intersect. + * @return A CompletableFuture containing a term representing only strings matched by ALL provided terms. + */ + public CompletableFuture intersection(Term... terms) { + return intersection(Arrays.asList(terms)); + } + /** * Computes the intersection of the given terms asynchronously. * @@ -617,30 +655,38 @@ public CompletableFuture concat( * @return A CompletableFuture containing a term representing only strings matched by ALL provided terms. */ public CompletableFuture intersection(List terms) { - return intersection(terms, ResponseFormat.ANY, null); + return intersection(terms, (OperationOptions) null); } /** * Computes the intersection of the given terms asynchronously. * * @param terms A dynamic list of terms to intersect. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a term representing only strings matched by ALL provided terms. */ public CompletableFuture intersection( List terms, - ResponseFormat format, - Integer timeout + OperationOptions options ) { MultiTermsRequestDto request = new MultiTermsRequestDto() .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.intersection(request) ).thenApply(resp -> Term.fromDto(resp.getData())); } + /** + * Computes the union of the given terms asynchronously. + * + * @param terms Variadic terms to combine. + * @return A CompletableFuture containing a term representing strings matched by ANY of the provided terms. + */ + public CompletableFuture union(Term... terms) { + return union(Arrays.asList(terms)); + } + /** * Computes the union of the given terms asynchronously. * @@ -648,25 +694,23 @@ public CompletableFuture intersection( * @return A CompletableFuture containing a term representing strings matched by ANY of the provided terms. */ public CompletableFuture union(List terms) { - return union(terms, ResponseFormat.ANY, null); + return union(terms, (OperationOptions) null); } /** * Computes the union of the given terms asynchronously. * * @param terms A dynamic list of terms to combine. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a term representing strings matched by ANY of the provided terms. */ public CompletableFuture union( List terms, - ResponseFormat format, - Integer timeout + OperationOptions options ) { MultiTermsRequestDto request = new MultiTermsRequestDto() .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.union(request)).thenApply( resp -> Term.fromDto(resp.getData()) ); @@ -680,7 +724,7 @@ public CompletableFuture union( * @return A CompletableFuture containing a computed difference term. */ public CompletableFuture difference(Term base, Term excluded) { - return difference(base, excluded, ResponseFormat.ANY, null); + return difference(base, excluded, (OperationOptions) null); } /** @@ -688,20 +732,18 @@ public CompletableFuture difference(Term base, Term excluded) { * * @param base The base language term to subtract from. * @param excluded The term whose language should be removed from the base. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a computed difference term. */ public CompletableFuture difference( Term base, Term excluded, - ResponseFormat format, - Integer timeout + OperationOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(base.toDto()) .addTermsItem(excluded.toDto()) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.difference(request)).thenApply( resp -> Term.fromDto(resp.getData()) ); @@ -714,25 +756,23 @@ public CompletableFuture difference( * @return A CompletableFuture containing the complemented term. */ public CompletableFuture complement(Term term) { - return complement(term, ResponseFormat.ANY, null); + return complement(term, (OperationOptions) null); } /** * Computes the complement of the given term asynchronously. * * @param term The term to complement. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing the complemented term. */ public CompletableFuture complement( Term term, - ResponseFormat format, - Integer timeout + OperationOptions options ) { TermRequestDto request = new TermRequestDto() .term(term.toDto()) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.complement(request)).thenApply( resp -> Term.fromDto(resp.getData()) ); @@ -747,7 +787,7 @@ public CompletableFuture complement( * @return A CompletableFuture containing a computed repeated term. */ public CompletableFuture repeat(Term term, int min, Integer max) { - return repeat(term, min, max, ResponseFormat.ANY, null); + return repeat(term, min, max, (OperationOptions) null); } /** @@ -756,22 +796,20 @@ public CompletableFuture repeat(Term term, int min, Integer max) { * @param term The term to repeat. * @param min The inclusive lower bound of repetitions. * @param max The inclusive upper bound. If null, repetitions are unbounded. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a computed repeated term. */ public CompletableFuture repeat( Term term, int min, Integer max, - ResponseFormat format, - Integer timeout + OperationOptions options ) { RepeatRequestDto request = new RepeatRequestDto() .term(term.toDto()) .min(min) .max(max) - .options(buildOptions(timeout, format)); + .options(buildOptions(options)); return executeWithRetry(() -> computeApi.repeat(request)).thenApply( resp -> Term.fromDto(resp.getData()) ); @@ -792,7 +830,7 @@ public CompletableFuture> generateStrings( int limit, int offset ) { - return generateStrings(term, limit, offset, null); + return generateStrings(term, limit, offset, (OperationOptions) null); } /** @@ -801,14 +839,14 @@ public CompletableFuture> generateStrings( * @param term The term to sample generated strings from. * @param limit The maximum number of unique strings to return. * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A CompletableFuture containing a list of strings that match the term. */ public CompletableFuture> generateStrings( Term term, int limit, int offset, - Integer timeout + OperationOptions options ) { Term termToUse = term.getCachedStableTerm() != null @@ -821,7 +859,7 @@ public CompletableFuture> generateStrings( .limit(limit) .offset(offset) .returnStableTerm(returnStableTerm) - .options(buildOptions(timeout, null)); + .options(buildOptions(options)); return executeWithRetry(() -> generateApi.strings(request)).thenApply( resp -> { diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java new file mode 100644 index 0000000..df906bd --- /dev/null +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -0,0 +1,44 @@ +package com.regexsolver.api; + +import java.util.Optional; + +/** + * Options for RegexSolver operations. + */ +public class OperationOptions { + + private Integer executionTimeout; + private ResponseFormat responseFormat; + + public OperationOptions() {} + + public OperationOptions( + Integer executionTimeout, + ResponseFormat responseFormat + ) { + this.executionTimeout = executionTimeout; + this.responseFormat = responseFormat; + } + + public static OperationOptions builder() { + return new OperationOptions(); + } + + public OperationOptions executionTimeout(Integer timeout) { + this.executionTimeout = timeout; + return this; + } + + public OperationOptions responseFormat(ResponseFormat format) { + this.responseFormat = format; + return this; + } + + public Optional getExecutionTimeout() { + return Optional.ofNullable(executionTimeout); + } + + public Optional getResponseFormat() { + return Optional.ofNullable(responseFormat); + } +} diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 9191f3e..559946f 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -11,8 +11,8 @@ public final class RegexSolverClient { private final AsyncRegexSolverClient asyncClient; - private RegexSolverClient(AsyncRegexSolverClient asyncClient) { - this.asyncClient = asyncClient; + private RegexSolverClient(Builder builder) { + this.asyncClient = builder.asyncBuilder.build(); } public static Builder builder() { @@ -35,7 +35,7 @@ public Builder baseUrl(String baseUrl) { } public RegexSolverClient build() { - return new RegexSolverClient(asyncBuilder.build()); + return new RegexSolverClient(this); } } @@ -45,105 +45,105 @@ public RegexSolverClient build() { * Computes how many unique strings the term matches. * * @param term The term to analyze. - * @return A Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public Cardinality getCardinality(Term term) { - return asyncClient.getCardinality(term).join(); + return getCardinality(term, (OperationOptions) null); } /** - * Computes how many unique strings the term matches, with a timeout. + * Computes how many unique strings the term matches. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. - * @return A Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. + * @param options Options for the operation. + * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ - public Cardinality getCardinality(Term term, Integer timeout) { - return asyncClient.getCardinality(term, timeout).join(); + public Cardinality getCardinality(Term term, OperationOptions options) { + return asyncClient.getCardinality(term, options).join(); } /** * Computes the minimum and maximum length of strings matched by the term. * * @param term The term to analyze. - * @return A Length object containing min and max integers. Limits are null if unbounded or undefined. + * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public Length getLength(Term term) { - return asyncClient.getLength(term).join(); + return getLength(term, (OperationOptions) null); } /** - * Computes the minimum and maximum length of strings matched by the term, with a timeout. + * Computes the minimum and maximum length of strings matched by the term. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. - * @return A Length object containing min and max integers. Limits are null if unbounded or undefined. + * @param options Options for the operation. + * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ - public Length getLength(Term term, Integer timeout) { - return asyncClient.getLength(term, timeout).join(); + public Length getLength(Term term, OperationOptions options) { + return asyncClient.getLength(term, options).join(); } /** * Checks if the term matches no strings at all. * * @param term The term to analyze. - * @return True if the language is completely empty, false otherwise. + * @return true if the language is completely empty, false otherwise. */ public boolean isEmpty(Term term) { - return asyncClient.isEmpty(term).join(); + return isEmpty(term, (OperationOptions) null); } /** - * Checks if the term matches no strings at all, with a timeout. + * Checks if the term matches no strings at all. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. - * @return True if the language is completely empty, false otherwise. + * @param options Options for the operation. + * @return true if the language is completely empty, false otherwise. */ - public boolean isEmpty(Term term, Integer timeout) { - return asyncClient.isEmpty(term, timeout).join(); + public boolean isEmpty(Term term, OperationOptions options) { + return asyncClient.isEmpty(term, options).join(); } /** * Checks if the term matches only the empty string. * * @param term The term to analyze. - * @return True if the term strictly matches the empty string ("") and nothing else. + * @return true if the term strictly matches the empty string ("") and nothing else. */ public boolean isEmptyString(Term term) { - return asyncClient.isEmptyString(term).join(); + return isEmptyString(term, (OperationOptions) null); } /** - * Checks if the term matches only the empty string, with a timeout. + * Checks if the term matches only the empty string. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. - * @return True if the term strictly matches the empty string ("") and nothing else. + * @param options Options for the operation. + * @return true if the term strictly matches the empty string ("") and nothing else. */ - public boolean isEmptyString(Term term, Integer timeout) { - return asyncClient.isEmptyString(term, timeout).join(); + public boolean isEmptyString(Term term, OperationOptions options) { + return asyncClient.isEmptyString(term, options).join(); } /** * Checks if the term matches all possible strings. * * @param term The term to analyze. - * @return True if the term matches every possible string. + * @return true if the term matches every possible string. */ public boolean isTotal(Term term) { - return asyncClient.isTotal(term).join(); + return isTotal(term, (OperationOptions) null); } /** - * Checks if the term matches all possible strings, with a timeout. + * Checks if the term matches all possible strings. * * @param term The term to analyze. - * @param timeout Timeout in milliseconds for the operation. - * @return True if the term matches every possible string. + * @param options Options for the operation. + * @return true if the term matches every possible string. */ - public boolean isTotal(Term term, Integer timeout) { - return asyncClient.isTotal(term, timeout).join(); + public boolean isTotal(Term term, OperationOptions options) { + return asyncClient.isTotal(term, options).join(); } /** @@ -153,18 +153,18 @@ public boolean isTotal(Term term, Integer timeout) { * @return A valid regular expression string representing the language. */ public String getPattern(Term term) { - return asyncClient.getPattern(term).join(); + return getPattern(term, (OperationOptions) null); } /** - * Returns a regular expression pattern that represents the term, with a timeout. + * Returns a regular expression pattern that represents the term. * * @param term The term to extract the pattern from. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A valid regular expression string representing the language. */ - public String getPattern(Term term, Integer timeout) { - return asyncClient.getPattern(term, timeout).join(); + public String getPattern(Term term, OperationOptions options) { + return asyncClient.getPattern(term, options).join(); } /** @@ -174,18 +174,18 @@ public String getPattern(Term term, Integer timeout) { * @return The raw DOT syntax for Graphviz compilation. */ public String getDot(Term term) { - return asyncClient.getDot(term).join(); + return getDot(term, (OperationOptions) null); } /** - * Builds a Graphviz DOT representation of the term's automaton, with a timeout. + * Builds a Graphviz DOT representation of the term's automaton. * * @param term The term to visualize. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return The raw DOT syntax for Graphviz compilation. */ - public String getDot(Term term, Integer timeout) { - return asyncClient.getDot(term, timeout).join(); + public String getDot(Term term, OperationOptions options) { + return asyncClient.getDot(term, options).join(); } /** @@ -193,22 +193,22 @@ public String getDot(Term term, Integer timeout) { * * @param term1 The first term. * @param term2 The second term to compare against. - * @return True if they are entirely equivalent, false otherwise. + * @return true if they are entirely equivalent, false otherwise. */ public boolean equivalent(Term term1, Term term2) { - return asyncClient.equivalent(term1, term2).join(); + return equivalent(term1, term2, (OperationOptions) null); } /** - * Checks if the two terms accept exactly the same language, with a timeout. + * Checks if the two terms accept exactly the same language. * * @param term1 The first term. * @param term2 The second term to compare against. - * @param timeout Timeout in milliseconds for the operation. - * @return True if they are entirely equivalent, false otherwise. + * @param options Options for the operation. + * @return true if they are entirely equivalent, false otherwise. */ - public boolean equivalent(Term term1, Term term2, Integer timeout) { - return asyncClient.equivalent(term1, term2, timeout).join(); + public boolean equivalent(Term term1, Term term2, OperationOptions options) { + return asyncClient.equivalent(term1, term2, options).join(); } /** @@ -216,26 +216,40 @@ public boolean equivalent(Term term1, Term term2, Integer timeout) { * * @param subset The term to test as the subset. * @param superset The term representing the entire set space. - * @return True if every string matched by subset is also matched by superset. + * @return true if every string matched by subset is also matched by superset. */ public boolean subset(Term subset, Term superset) { - return asyncClient.subset(subset, superset).join(); + return subset(subset, superset, (OperationOptions) null); } /** - * Checks if the first term's language is a subset of the second term's language, with a timeout. + * Checks if the first term's language is a subset of the second term's language. * * @param subset The term to test as the subset. * @param superset The term representing the entire set space. - * @param timeout Timeout in milliseconds for the operation. - * @return True if every string matched by subset is also matched by superset. + * @param options Options for the operation. + * @return true if every string matched by subset is also matched by superset. */ - public boolean subset(Term subset, Term superset, Integer timeout) { - return asyncClient.subset(subset, superset, timeout).join(); + public boolean subset( + Term subset, + Term superset, + OperationOptions options + ) { + return asyncClient.subset(subset, superset, options).join(); } // --- COMPUTE OPERATIONS --- + /** + * Concatenates the given terms sequentially. + * + * @param terms Variadic terms to concatenate in order. + * @return A newly computed concatenated term. + */ + public Term concat(Term... terms) { + return asyncClient.concat(terms).join(); + } + /** * Concatenates the given terms sequentially. * @@ -243,23 +257,28 @@ public boolean subset(Term subset, Term superset, Integer timeout) { * @return A newly computed concatenated term. */ public Term concat(List terms) { - return asyncClient.concat(terms).join(); + return concat(terms, (OperationOptions) null); } /** - * Concatenates the given terms sequentially, allowing for format and timeout specification. + * Concatenates the given terms sequentially, allowing for options specification. * * @param terms A list of terms to concatenate in order. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A newly computed concatenated term. */ - public Term concat( - List terms, - ResponseFormat format, - Integer timeout - ) { - return asyncClient.concat(terms, format, timeout).join(); + public Term concat(List terms, OperationOptions options) { + return asyncClient.concat(terms, options).join(); + } + + /** + * Computes the intersection of the given terms. + * + * @param terms Variadic terms to intersect. + * @return A term representing only strings matched by ALL provided terms. + */ + public Term intersection(Term... terms) { + return asyncClient.intersection(terms).join(); } /** @@ -269,23 +288,28 @@ public Term concat( * @return A term representing only strings matched by ALL provided terms. */ public Term intersection(List terms) { - return asyncClient.intersection(terms).join(); + return intersection(terms, (OperationOptions) null); } /** - * Computes the intersection of the given terms, allowing for format and timeout specification. + * Computes the intersection of the given terms, allowing for options specification. * * @param terms A list of terms to intersect. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A term representing only strings matched by ALL provided terms. */ - public Term intersection( - List terms, - ResponseFormat format, - Integer timeout - ) { - return asyncClient.intersection(terms, format, timeout).join(); + public Term intersection(List terms, OperationOptions options) { + return asyncClient.intersection(terms, options).join(); + } + + /** + * Computes the union of the given terms. + * + * @param terms Variadic terms to combine. + * @return A term representing strings matched by ANY of the provided terms. + */ + public Term union(Term... terms) { + return asyncClient.union(terms).join(); } /** @@ -295,23 +319,18 @@ public Term intersection( * @return A term representing strings matched by ANY of the provided terms. */ public Term union(List terms) { - return asyncClient.union(terms).join(); + return union(terms, (OperationOptions) null); } /** - * Computes the union of the given terms, allowing for format and timeout specification. + * Computes the union of the given terms, allowing for options specification. * * @param terms A list of terms to combine. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A term representing strings matched by ANY of the provided terms. */ - public Term union( - List terms, - ResponseFormat format, - Integer timeout - ) { - return asyncClient.union(terms, format, timeout).join(); + public Term union(List terms, OperationOptions options) { + return asyncClient.union(terms, options).join(); } /** @@ -322,25 +341,19 @@ public Term union( * @return A computed difference term. */ public Term difference(Term base, Term excluded) { - return asyncClient.difference(base, excluded).join(); + return difference(base, excluded, (OperationOptions) null); } /** - * Computes the difference between the two provided terms, allowing for format and timeout specification. + * Computes the difference between the two provided terms. * * @param base The base language term to subtract from. * @param excluded The term whose language should be removed from the base. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A computed difference term. */ - public Term difference( - Term base, - Term excluded, - ResponseFormat format, - Integer timeout - ) { - return asyncClient.difference(base, excluded, format, timeout).join(); + public Term difference(Term base, Term excluded, OperationOptions options) { + return asyncClient.difference(base, excluded, options).join(); } /** @@ -350,19 +363,18 @@ public Term difference( * @return The complemented term. */ public Term complement(Term term) { - return asyncClient.complement(term).join(); + return complement(term, (OperationOptions) null); } /** - * Computes the complement of the given term, allowing for format and timeout specification. + * Computes the complement of the given term. * * @param term The term to complement. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return The complemented term. */ - public Term complement(Term term, ResponseFormat format, Integer timeout) { - return asyncClient.complement(term, format, timeout).join(); + public Term complement(Term term, OperationOptions options) { + return asyncClient.complement(term, options).join(); } /** @@ -374,27 +386,25 @@ public Term complement(Term term, ResponseFormat format, Integer timeout) { * @return A computed repeated term. */ public Term repeat(Term term, int min, Integer max) { - return asyncClient.repeat(term, min, max).join(); + return repeat(term, min, max, (OperationOptions) null); } /** - * Repeats a term between a minimum and maximum number of times, allowing for format and timeout specification. + * Repeats a term between a minimum and maximum number of times. * * @param term The term to repeat. * @param min The inclusive lower bound of repetitions. * @param max The inclusive upper bound. If null, repetitions are unbounded. - * @param format The return format of the term (any, regex or fair). - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A computed repeated term. */ public Term repeat( Term term, int min, Integer max, - ResponseFormat format, - Integer timeout + OperationOptions options ) { - return asyncClient.repeat(term, min, max, format, timeout).join(); + return asyncClient.repeat(term, min, max, options).join(); } // --- GENERATE OPERATIONS --- @@ -408,24 +418,24 @@ public Term repeat( * @return A list of strings that match the term. */ public List generateStrings(Term term, int limit, int offset) { - return asyncClient.generateStrings(term, limit, offset).join(); + return generateStrings(term, limit, offset, (OperationOptions) null); } /** - * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings, with a timeout. + * Generates up to {@code limit} distinct strings matched by the term, skipping the first {@code offset} strings. * * @param term The term to sample generated strings from. * @param limit The maximum number of unique strings to return. * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. - * @param timeout Timeout in milliseconds for the operation. + * @param options Options for the operation. * @return A list of strings that match the term. */ public List generateStrings( Term term, int limit, int offset, - Integer timeout + OperationOptions options ) { - return asyncClient.generateStrings(term, limit, offset, timeout).join(); + return asyncClient.generateStrings(term, limit, offset, options).join(); } } diff --git a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java index b7a2b5d..4fdfb00 100644 --- a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java @@ -81,10 +81,10 @@ void testSyncClientUnion() { ); // Let's assume the sync client passes down to the async client's 3-arg method - Term result = client.union(termList, null, null); + Term result = client.union(termList); assertThat(result.getPattern()).contains("a|b"); - verify(asyncClient).union(termList, null, null); + verify(asyncClient).union(termList); } @Test @@ -92,14 +92,14 @@ void testSyncClientComplement() { Term term = Term.regex(".*a.*"); Term mockResultTerm = Term.regex("[^a].*"); - when(asyncClient.complement(any(), isNull(), isNull())).thenReturn( + when(asyncClient.complement(any())).thenReturn( CompletableFuture.completedFuture(mockResultTerm) ); - Term result = client.complement(term, null, null); + Term result = client.complement(term); assertThat(result.getPattern()).contains("[^a].*"); - verify(asyncClient).complement(term, null, null); + verify(asyncClient).complement(term); } @Test @@ -129,10 +129,10 @@ void testSyncClientIntersection() { CompletableFuture.completedFuture(mockResultTerm) ); - Term result = client.intersection(termList, null, null); + Term result = client.intersection(termList); assertThat(result.getPattern()).contains("a"); - verify(asyncClient).intersection(termList, null, null); + verify(asyncClient).intersection(termList); } @Test From 41b1561a2e2115ea345feae187947003eb4d60b2 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Mon, 6 Apr 2026 14:53:12 +0200 Subject: [PATCH 13/24] Update library --- .openapi-generator-ignore | 4 +- .openapi-generator/FILES | 2 - README.md | 39 +- api/openapi.yaml | 1756 +++++++++++++++++ generate-api.sh | 3 +- pom.xml | 28 +- .../api/AsyncRegexSolverClient.java | 2 +- .../java/com/regexsolver/api/Cardinality.java | 7 +- src/main/java/com/regexsolver/api/Length.java | 4 +- src/main/java/com/regexsolver/api/Term.java | 12 +- .../api/exceptions/package-info.java | 4 + .../regexsolver/api/generated/ApiClient.java | 2 +- .../api/generated/ApiException.java | 2 +- .../api/generated/ApiResponse.java | 2 +- .../api/generated/Configuration.java | 2 +- .../com/regexsolver/api/generated/JSON.java | 4 +- .../com/regexsolver/api/generated/Pair.java | 2 +- .../api/generated/RFC3339DateFormat.java | 2 +- .../generated/RFC3339InstantDeserializer.java | 2 +- .../api/generated/RFC3339JavaTimeModule.java | 2 +- .../api/generated/ServerConfiguration.java | 2 +- .../api/generated/ServerVariable.java | 2 +- .../api/generated/api/AnalyzeApi.java | 92 +- .../api/generated/api/ComputeApi.java | 62 +- .../api/generated/api/GenerateApi.java | 12 +- .../model/AbstractOpenApiSchema.java | 2 +- .../api/generated/model/BooleanDto.java | 18 +- .../model/Cardinality200ResponseDto.java | 18 +- .../model/CardinalityBigIntegerDto.java | 10 +- .../api/generated/model/CardinalityDto.java | 2 +- .../model/CardinalityInfiniteDto.java | 10 +- .../model/CardinalityIntegerDto.java | 18 +- .../generated/model/Concat200ResponseDto.java | 18 +- .../generated/model/Dot200ResponseDto.java | 18 +- .../generated/model/Empty200ResponseDto.java | 18 +- .../api/generated/model/ErrorResponseDto.java | 26 +- .../generated/model/ExecutionOptionsDto.java | 10 +- .../model/GenerateStringsRequestDto.java | 42 +- .../model/GenerateStringsResponseDto.java | 26 +- .../generated/model/Length200ResponseDto.java | 18 +- .../api/generated/model/LengthDto.java | 26 +- .../generated/model/MultiTermsRequestDto.java | 18 +- .../api/generated/model/RepeatRequestDto.java | 34 +- .../generated/model/RequestOptionsDto.java | 26 +- .../generated/model/ResponseOptionsDto.java | 10 +- .../api/generated/model/StringDto.java | 18 +- .../model/Strings200ResponseDto.java | 18 +- .../api/generated/model/StringsDto.java | 18 +- .../api/generated/model/TermDto.java | 2 +- .../api/generated/model/TermFairDto.java | 18 +- .../api/generated/model/TermRegexDto.java | 18 +- .../api/generated/model/TermRequestDto.java | 18 +- .../generated/model/TwoTermsRequestDto.java | 18 +- .../com/regexsolver/api/package-info.java | 4 + src/main/java/module-info.java | 14 + 55 files changed, 2178 insertions(+), 387 deletions(-) create mode 100644 api/openapi.yaml create mode 100644 src/main/java/com/regexsolver/api/exceptions/package-info.java create mode 100644 src/main/java/com/regexsolver/api/package-info.java create mode 100644 src/main/java/module-info.java diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 51baa4b..63474a0 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -1,5 +1,5 @@ src/main/java/com/regexsolver/api/exceptions/** -test/ +**/test/ pom.xml .gitignore git_push.sh @@ -17,4 +17,4 @@ gradlew.bat gradle/ gradle.properties build.sbt -*.xml +**/*.xml diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 77bda1d..bd78d14 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,6 +1,4 @@ api/openapi.yaml -gradle.properties -src/main/AndroidManifest.xml src/main/java/com/regexsolver/api/generated/ApiClient.java src/main/java/com/regexsolver/api/generated/ApiException.java src/main/java/com/regexsolver/api/generated/ApiResponse.java diff --git a/README.md b/README.md index 131eb57..644f94a 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,6 @@ The synchronous client provides a simple, blocking API. ```java import com.regexsolver.api.RegexSolverClient; import com.regexsolver.api.Term; -import java.util.Arrays; public class Main { public static void main(String[] args) { @@ -60,7 +59,7 @@ For non-blocking applications, use the asynchronous client. ```java import com.regexsolver.api.AsyncRegexSolverClient; import com.regexsolver.api.Term; -import java.util.Arrays; +import java.util.concurrent.CompletableFuture; public class Main { public static void main(String[] args) { @@ -103,10 +102,10 @@ import com.regexsolver.api.OperationOptions; Term term1 = Term.regex("abcde"); Term term2 = Term.regex("de"); -Term result1 = client.union(Arrays.asList(term1, term2), new OperationOptions().responseFormat(ResponseFormat.REGEX)); +Term result1 = client.union(term1, term2, new OperationOptions().responseFormat(ResponseFormat.REGEX)); System.out.println(result1); // regex=(abc)?de -Term result2 = client.union(Arrays.asList(term1, term2), new OperationOptions().responseFormat(ResponseFormat.FAIR)); +Term result2 = client.union(term1, term2, new OperationOptions().responseFormat(ResponseFormat.FAIR)); System.out.println(result2); // fair=... ``` @@ -141,15 +140,15 @@ Timeout is best effort. The exact time is not guaranteed. | Method | Return | Description | | -------- | ------- | ------- | -| `client.equivalent(term1, term2)` | `boolean` | `true` if `term1` and `term2` accept exactly the same language. | -| `client.getCardinality(term)` | `Cardinality` | Returns the number of possible matched strings. | -| `client.getDot(term)` | `String` | Returns a Graphviz DOT representation of the automaton. | -| `client.getLength(term)` | `Length` | Returns the minimum and maximum length of matched strings. | -| `client.getPattern(term)` | `String` | Returns a regular expression pattern for the term. | -| `client.isEmpty(term)` | `boolean` | `true` if the term matches no string. | -| `client.isEmptyString(term)` | `boolean` | `true` if the term matches only the empty string. | -| `client.isTotal(term)` | `boolean` | `true` if the term matches all possible strings. | -| `client.subset(term1, term2)` | `boolean` | `true` if every string matched by `term1` is also matched by `term2`. | +| `client.equivalent(term1, term2, options?)` | `boolean` | `true` if `term1` and `term2` accept exactly the same language. | +| `client.getCardinality(term, options?)` | `Cardinality` | Returns the number of possible matched strings. | +| `client.getDot(term, options?)` | `String` | Returns a Graphviz DOT representation of the automaton. | +| `client.getLength(term, options?)` | `Length` | Returns the minimum and maximum length of matched strings. | +| `client.getPattern(term, options?)` | `String` | Returns a regular expression pattern for the term. | +| `client.isEmpty(term, options?)` | `boolean` | `true` if the term matches no string. | +| `client.isEmptyString(term, options?)` | `boolean` | `true` if the term matches only the empty string. | +| `client.isTotal(term, options?)` | `boolean` | `true` if the term matches all possible strings. | +| `client.subset(term1, term2, options?)` | `boolean` | `true` if every string matched by `term1` is also matched by `term2`. | *Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* @@ -157,12 +156,12 @@ Timeout is best effort. The exact time is not guaranteed. | Method | Return | Description | | -------- | ------- | ------- | -| `client.complement(term)` | `Term` | Computes the complement of the given term. | -| `client.concat(terms)` | `Term` | Concatenates multiple terms in order. | -| `client.difference(term1, term2)` | `Term` | Computes the difference `term1 - term2`. | -| `client.intersection(terms)` | `Term` | Computes the intersection of the given terms. | -| `client.repeat(term, min, max)` | `Term` | Computes the repetition of the term between `min` and `max` times. | -| `client.union(terms)` | `Term` | Computes the union of the given terms. | +| `client.complement(term, options?)` | `Term` | Computes the complement of the given term. | +| `client.concat(term1, term2, ..., options?)` | `Term` | Concatenates multiple terms in order. | +| `client.difference(term1, term2, options?)` | `Term` | Computes the difference `term1 - term2`. | +| `client.intersection(term1, term2, ..., options?)` | `Term` | Computes the intersection of the given terms. | +| `client.repeat(term, min, max, options?)` | `Term` | Computes the repetition of the term between `min` and `max` times. | +| `client.union(term1, term2, ..., options?)` | `Term` | Computes the union of the given terms. | *Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* @@ -170,7 +169,7 @@ Timeout is best effort. The exact time is not guaranteed. | Method | Return | Description | | -------- | ------- | ------- | -| `client.generateStrings(term, limit, offset)` | `List` | Generates up to `limit` unique strings matched by `term`, skipping the first `offset` strings. | +| `client.generateStrings(term, limit, offset, options?)` | `List` | Generates up to `limit` unique strings matched by `term`, skipping the first `offset` strings. | *Note: For `AsyncRegexSolverClient`, this method returns `CompletableFuture>`.* diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..7079ddd --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,1756 @@ +openapi: 3.0.3 +info: + title: RegexSolver + version: 1.1.0 +servers: +- url: https://api.regexsolver.com/v1 +security: +- BearerAuth: [] +paths: + /analyze/cardinality: + post: + description: Compute how many strings the term matches. + operationId: cardinality + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: integer + value: 26 + schema: + $ref: "#/components/schemas/cardinality_200_response" + description: Cardinality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Cardinality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/dot: + post: + description: Build a Graphviz DOT representation of the term's automaton. + operationId: dot + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: string + value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ + 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ + \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ + 1\"];\n}" + schema: + $ref: "#/components/schemas/dot_200_response" + description: Graphviz DOT representation. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: GraphViz Dot + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty: + post: + description: Check if the term matches no strings. + operationId: empty + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty language result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Empty + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty_string: + post: + description: Check if the term matches only the empty string. + operationId: empty_string + requestBody: + content: + application/json: + example: + term: + type: regex + value: "" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty string only result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Empty String Only + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/total: + post: + description: Check if the term matches all the possible strings. + operationId: total + requestBody: + content: + application/json: + example: + term: + type: regex + value: .* + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Totality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Totality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/equivalent: + post: + description: Check if the two terms accept exactly the same language. + operationId: equivalent + requestBody: + content: + application/json: + example: + terms: + - type: regex + value: (abcd|abef) + - type: regex + value: ab(cd|ef) + schema: + $ref: "#/components/schemas/TwoTermsRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Language equivalence result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Equivalent + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/length: + post: + description: Compute the minimum and maximum length of strings matched by the + term. + operationId: length + requestBody: + content: + application/json: + example: + term: + type: regex + value: (abc)?d + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: length + min: 1 + max: 4 + schema: + $ref: "#/components/schemas/length_200_response" + description: Length bounds. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Bad request. The input was invalid or could not be parsed. + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Unauthorized. Missing or invalid bearer token. + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Forbidden. You do not have access to this resource. + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found. The resource does not exist. + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests. Rate limit exceeded. + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error. + summary: Length + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/pattern: + post: + description: Return a regular expression pattern that represents the term. + operationId: pattern + requestBody: + content: + application/json: + example: + term: + type: fair + value: "2.21.1 2.21 - 1.3.5 + 2.1.1 5.10.2 5.11.0 3.25.3 @@ -50,9 +50,9 @@ - com.google.code.findbugs - jsr305 - 3.0.2 + jakarta.annotation + jakarta.annotation-api + ${jakarta.annotation.version} @@ -85,12 +85,6 @@ 0.2.9 - - jakarta.annotation - jakarta.annotation-api - ${jakarta.annotation.version} - - org.junit.jupiter junit-jupiter-api @@ -128,6 +122,15 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + org.apache.maven.plugins maven-source-plugin @@ -145,6 +148,9 @@ org.apache.maven.plugins maven-javadoc-plugin 3.7.0 + + 11 + attach-javadocs @@ -157,7 +163,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.2.4 sign-artifacts diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index 89cce26..95f18fa 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -37,7 +37,7 @@ private AsyncRegexSolverClient(Builder builder) { this.rateLimiter = RateLimiter.getInstance(this.apiToken); ApiClient apiClient = new ApiClient(); - apiClient.setBasePath(this.baseUrl); + apiClient.updateBaseUri(this.baseUrl); apiClient.setRequestInterceptor(requestBuilder -> { requestBuilder.header( "User-Agent", diff --git a/src/main/java/com/regexsolver/api/Cardinality.java b/src/main/java/com/regexsolver/api/Cardinality.java index 3718012..3dcb979 100644 --- a/src/main/java/com/regexsolver/api/Cardinality.java +++ b/src/main/java/com/regexsolver/api/Cardinality.java @@ -24,13 +24,14 @@ static Cardinality fromDto(CardinalityDto card) { } } - /** Indicates that the set of matched strings is finite and exactly calculable. - * @param value The exact count of uniquely matched strings. - */ + /** Indicates that the set of matched strings is finite and exactly calculable. */ public static final class Integer extends Cardinality { private final long value; + /** + * @param value The exact count of uniquely matched strings. + */ public Integer(long value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/Length.java b/src/main/java/com/regexsolver/api/Length.java index ba1d97a..0d0ba5f 100644 --- a/src/main/java/com/regexsolver/api/Length.java +++ b/src/main/java/com/regexsolver/api/Length.java @@ -21,12 +21,12 @@ static Length fromDto(LengthDto len) { return new Length(len.getMin(), len.getMax()); } - /** The shortest possible matched string length, or {@link Optional::empty} if the language is empty. */ + /** The shortest possible matched string length, or {@link java.util.Optional#empty()} if the language is empty. */ public Optional getMin() { return Optional.ofNullable(min); } - /** The longest possible matched string length, or {@link Optional::empty} if the length is unbounded. */ + /** The longest possible matched string length, or {@link java.util.Optional#empty()} if the length is unbounded. */ public Optional getMax() { return Optional.ofNullable(max); } diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 665540d..d3cf665 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -206,7 +206,11 @@ public Optional getFair() { @Override TermDto toDto() { - return new TermDto(new TermRegexDto().value(getValue())); + return new TermDto( + new TermRegexDto() + .type(TermRegexDto.TypeEnum.REGEX) + .value(getValue()) + ); } @Override @@ -233,7 +237,11 @@ public Optional getFair() { @Override TermDto toDto() { - return new TermDto(new TermFairDto().value(getValue())); + return new TermDto( + new TermFairDto() + .type(TermFairDto.TypeEnum.FAIR) + .value(getValue()) + ); } @Override diff --git a/src/main/java/com/regexsolver/api/exceptions/package-info.java b/src/main/java/com/regexsolver/api/exceptions/package-info.java new file mode 100644 index 0000000..612475e --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/package-info.java @@ -0,0 +1,4 @@ +/** + * Exception classes for the RegexSolver Java client. + */ +package com.regexsolver.api.exceptions; diff --git a/src/main/java/com/regexsolver/api/generated/ApiClient.java b/src/main/java/com/regexsolver/api/generated/ApiClient.java index aa4356d..75b362d 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiClient.java +++ b/src/main/java/com/regexsolver/api/generated/ApiClient.java @@ -53,7 +53,7 @@ *

The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index e742752..50d29c4 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index 2dc7fe1..d279928 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index 0d258b5..e8bf0ef 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index e265398..dd6b5b0 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index 636e0bd..ec2b0ef 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index eaa93e8..e6dd2e9 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index a45e5d7..69b2ece 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index 6d8078a..2381d9f 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index 8a91d67..5e3c41f 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index d6367e7..1513a7c 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index 412cbdb..2c74f21 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -53,7 +53,7 @@ import java.util.concurrent.CompletableFuture; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -178,7 +178,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * @return CompletableFuture<Cardinality200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture cardinality(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture cardinality(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return cardinality(termRequestDto, null); } @@ -190,7 +190,7 @@ public CompletableFuture cardinality(@javax.annotatio * @return CompletableFuture<Cardinality200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture cardinality(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture cardinality(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return cardinalityWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -207,7 +207,7 @@ public CompletableFuture cardinality(@javax.annotatio * @return CompletableFuture<ApiResponse<Cardinality200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> cardinalityWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> cardinalityWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return cardinalityWithHttpInfo(termRequestDto, null); } @@ -219,7 +219,7 @@ public CompletableFuture> cardinalityWith * @return CompletableFuture<ApiResponse<Cardinality200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> cardinalityWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> cardinalityWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = cardinalityRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -271,7 +271,7 @@ public CompletableFuture> cardinalityWith } } - private HttpRequest.Builder cardinalityRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder cardinalityRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling cardinality"); @@ -310,7 +310,7 @@ private HttpRequest.Builder cardinalityRequestBuilder(@javax.annotation.Nonnull * @return CompletableFuture<Dot200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture dot(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture dot(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return dot(termRequestDto, null); } @@ -322,7 +322,7 @@ public CompletableFuture dot(@javax.annotation.Nonnull TermRe * @return CompletableFuture<Dot200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture dot(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture dot(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return dotWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -339,7 +339,7 @@ public CompletableFuture dot(@javax.annotation.Nonnull TermRe * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> dotWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> dotWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return dotWithHttpInfo(termRequestDto, null); } @@ -351,7 +351,7 @@ public CompletableFuture> dotWithHttpInfo(@javax. * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> dotWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> dotWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = dotRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -403,7 +403,7 @@ public CompletableFuture> dotWithHttpInfo(@javax. } } - private HttpRequest.Builder dotRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder dotRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling dot"); @@ -442,7 +442,7 @@ private HttpRequest.Builder dotRequestBuilder(@javax.annotation.Nonnull TermRequ * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture empty(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture empty(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return empty(termRequestDto, null); } @@ -454,7 +454,7 @@ public CompletableFuture empty(@javax.annotation.Nonnull Te * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture empty(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture empty(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return emptyWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -471,7 +471,7 @@ public CompletableFuture empty(@javax.annotation.Nonnull Te * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> emptyWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> emptyWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return emptyWithHttpInfo(termRequestDto, null); } @@ -483,7 +483,7 @@ public CompletableFuture> emptyWithHttpInfo(@ja * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> emptyWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> emptyWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = emptyRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -535,7 +535,7 @@ public CompletableFuture> emptyWithHttpInfo(@ja } } - private HttpRequest.Builder emptyRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder emptyRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling empty"); @@ -574,7 +574,7 @@ private HttpRequest.Builder emptyRequestBuilder(@javax.annotation.Nonnull TermRe * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture emptyString(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture emptyString(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return emptyString(termRequestDto, null); } @@ -586,7 +586,7 @@ public CompletableFuture emptyString(@javax.annotation.Nonn * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture emptyString(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture emptyString(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return emptyStringWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -603,7 +603,7 @@ public CompletableFuture emptyString(@javax.annotation.Nonn * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> emptyStringWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> emptyStringWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return emptyStringWithHttpInfo(termRequestDto, null); } @@ -615,7 +615,7 @@ public CompletableFuture> emptyStringWithHttpIn * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> emptyStringWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> emptyStringWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = emptyStringRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -667,7 +667,7 @@ public CompletableFuture> emptyStringWithHttpIn } } - private HttpRequest.Builder emptyStringRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder emptyStringRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling emptyString"); @@ -706,7 +706,7 @@ private HttpRequest.Builder emptyStringRequestBuilder(@javax.annotation.Nonnull * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture equivalent(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture equivalent(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return equivalent(twoTermsRequestDto, null); } @@ -718,7 +718,7 @@ public CompletableFuture equivalent(@javax.annotation.Nonnu * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture equivalent(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture equivalent(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { return equivalentWithHttpInfo(twoTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -735,7 +735,7 @@ public CompletableFuture equivalent(@javax.annotation.Nonnu * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> equivalentWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture> equivalentWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return equivalentWithHttpInfo(twoTermsRequestDto, null); } @@ -747,7 +747,7 @@ public CompletableFuture> equivalentWithHttpInf * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> equivalentWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> equivalentWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = equivalentRequestBuilder(twoTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -799,7 +799,7 @@ public CompletableFuture> equivalentWithHttpInf } } - private HttpRequest.Builder equivalentRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder equivalentRequestBuilder(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'twoTermsRequestDto' is set if (twoTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling equivalent"); @@ -838,7 +838,7 @@ private HttpRequest.Builder equivalentRequestBuilder(@javax.annotation.Nonnull T * @return CompletableFuture<Length200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture length(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture length(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return length(termRequestDto, null); } @@ -850,7 +850,7 @@ public CompletableFuture length(@javax.annotation.Nonnull * @return CompletableFuture<Length200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture length(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture length(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return lengthWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -867,7 +867,7 @@ public CompletableFuture length(@javax.annotation.Nonnull * @return CompletableFuture<ApiResponse<Length200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> lengthWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> lengthWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return lengthWithHttpInfo(termRequestDto, null); } @@ -879,7 +879,7 @@ public CompletableFuture> lengthWithHttpInfo(@ * @return CompletableFuture<ApiResponse<Length200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> lengthWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> lengthWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = lengthRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -931,7 +931,7 @@ public CompletableFuture> lengthWithHttpInfo(@ } } - private HttpRequest.Builder lengthRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder lengthRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling length"); @@ -970,7 +970,7 @@ private HttpRequest.Builder lengthRequestBuilder(@javax.annotation.Nonnull TermR * @return CompletableFuture<Dot200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture pattern(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture pattern(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return pattern(termRequestDto, null); } @@ -982,7 +982,7 @@ public CompletableFuture pattern(@javax.annotation.Nonnull Te * @return CompletableFuture<Dot200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture pattern(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture pattern(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return patternWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -999,7 +999,7 @@ public CompletableFuture pattern(@javax.annotation.Nonnull Te * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> patternWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> patternWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return patternWithHttpInfo(termRequestDto, null); } @@ -1011,7 +1011,7 @@ public CompletableFuture> patternWithHttpInfo(@ja * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> patternWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> patternWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = patternRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -1063,7 +1063,7 @@ public CompletableFuture> patternWithHttpInfo(@ja } } - private HttpRequest.Builder patternRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder patternRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling pattern"); @@ -1102,7 +1102,7 @@ private HttpRequest.Builder patternRequestBuilder(@javax.annotation.Nonnull Term * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture subset(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture subset(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return subset(twoTermsRequestDto, null); } @@ -1114,7 +1114,7 @@ public CompletableFuture subset(@javax.annotation.Nonnull T * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture subset(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture subset(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { return subsetWithHttpInfo(twoTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -1131,7 +1131,7 @@ public CompletableFuture subset(@javax.annotation.Nonnull T * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> subsetWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture> subsetWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return subsetWithHttpInfo(twoTermsRequestDto, null); } @@ -1143,7 +1143,7 @@ public CompletableFuture> subsetWithHttpInfo(@j * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> subsetWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> subsetWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = subsetRequestBuilder(twoTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -1195,7 +1195,7 @@ public CompletableFuture> subsetWithHttpInfo(@j } } - private HttpRequest.Builder subsetRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder subsetRequestBuilder(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'twoTermsRequestDto' is set if (twoTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling subset"); @@ -1234,7 +1234,7 @@ private HttpRequest.Builder subsetRequestBuilder(@javax.annotation.Nonnull TwoTe * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture total(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture total(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return total(termRequestDto, null); } @@ -1246,7 +1246,7 @@ public CompletableFuture total(@javax.annotation.Nonnull Te * @return CompletableFuture<Empty200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture total(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture total(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return totalWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -1263,7 +1263,7 @@ public CompletableFuture total(@javax.annotation.Nonnull Te * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> totalWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> totalWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return totalWithHttpInfo(termRequestDto, null); } @@ -1275,7 +1275,7 @@ public CompletableFuture> totalWithHttpInfo(@ja * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> totalWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> totalWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = totalRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -1327,7 +1327,7 @@ public CompletableFuture> totalWithHttpInfo(@ja } } - private HttpRequest.Builder totalRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder totalRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling total"); diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index e706a56..30d0a8d 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -177,7 +177,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture complement(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture complement(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return complement(termRequestDto, null); } @@ -189,7 +189,7 @@ public CompletableFuture complement(@javax.annotation.Nonn * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture complement(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture complement(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { return complementWithHttpInfo(termRequestDto, headers) .thenApply(ApiResponse::getData); @@ -206,7 +206,7 @@ public CompletableFuture complement(@javax.annotation.Nonn * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> complementWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + public CompletableFuture> complementWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { return complementWithHttpInfo(termRequestDto, null); } @@ -218,7 +218,7 @@ public CompletableFuture> complementWithHttpIn * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> complementWithHttpInfo(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + public CompletableFuture> complementWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = complementRequestBuilder(termRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -270,7 +270,7 @@ public CompletableFuture> complementWithHttpIn } } - private HttpRequest.Builder complementRequestBuilder(@javax.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder complementRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { // verify the required parameter 'termRequestDto' is set if (termRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling complement"); @@ -309,7 +309,7 @@ private HttpRequest.Builder complementRequestBuilder(@javax.annotation.Nonnull T * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture concat(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture concat(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return concat(multiTermsRequestDto, null); } @@ -321,7 +321,7 @@ public CompletableFuture concat(@javax.annotation.Nonnull * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture concat(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture concat(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { return concatWithHttpInfo(multiTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -338,7 +338,7 @@ public CompletableFuture concat(@javax.annotation.Nonnull * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> concatWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture> concatWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return concatWithHttpInfo(multiTermsRequestDto, null); } @@ -350,7 +350,7 @@ public CompletableFuture> concatWithHttpInfo(@ * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> concatWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> concatWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = concatRequestBuilder(multiTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -402,7 +402,7 @@ public CompletableFuture> concatWithHttpInfo(@ } } - private HttpRequest.Builder concatRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder concatRequestBuilder(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'multiTermsRequestDto' is set if (multiTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling concat"); @@ -441,7 +441,7 @@ private HttpRequest.Builder concatRequestBuilder(@javax.annotation.Nonnull Multi * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture difference(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture difference(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return difference(twoTermsRequestDto, null); } @@ -453,7 +453,7 @@ public CompletableFuture difference(@javax.annotation.Nonn * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture difference(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture difference(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { return differenceWithHttpInfo(twoTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -470,7 +470,7 @@ public CompletableFuture difference(@javax.annotation.Nonn * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> differenceWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { + public CompletableFuture> differenceWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto) throws ApiException { return differenceWithHttpInfo(twoTermsRequestDto, null); } @@ -482,7 +482,7 @@ public CompletableFuture> differenceWithHttpIn * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> differenceWithHttpInfo(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> differenceWithHttpInfo(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = differenceRequestBuilder(twoTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -534,7 +534,7 @@ public CompletableFuture> differenceWithHttpIn } } - private HttpRequest.Builder differenceRequestBuilder(@javax.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder differenceRequestBuilder(@jakarta.annotation.Nonnull TwoTermsRequestDto twoTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'twoTermsRequestDto' is set if (twoTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'twoTermsRequestDto' when calling difference"); @@ -573,7 +573,7 @@ private HttpRequest.Builder differenceRequestBuilder(@javax.annotation.Nonnull T * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture intersection(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture intersection(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return intersection(multiTermsRequestDto, null); } @@ -585,7 +585,7 @@ public CompletableFuture intersection(@javax.annotation.No * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture intersection(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture intersection(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { return intersectionWithHttpInfo(multiTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -602,7 +602,7 @@ public CompletableFuture intersection(@javax.annotation.No * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> intersectionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture> intersectionWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return intersectionWithHttpInfo(multiTermsRequestDto, null); } @@ -614,7 +614,7 @@ public CompletableFuture> intersectionWithHttp * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> intersectionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> intersectionWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = intersectionRequestBuilder(multiTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -666,7 +666,7 @@ public CompletableFuture> intersectionWithHttp } } - private HttpRequest.Builder intersectionRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder intersectionRequestBuilder(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'multiTermsRequestDto' is set if (multiTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling intersection"); @@ -705,7 +705,7 @@ private HttpRequest.Builder intersectionRequestBuilder(@javax.annotation.Nonnull * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture repeat(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { + public CompletableFuture repeat(@jakarta.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { return repeat(repeatRequestDto, null); } @@ -717,7 +717,7 @@ public CompletableFuture repeat(@javax.annotation.Nonnull * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture repeat(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + public CompletableFuture repeat(@jakarta.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { try { return repeatWithHttpInfo(repeatRequestDto, headers) .thenApply(ApiResponse::getData); @@ -734,7 +734,7 @@ public CompletableFuture repeat(@javax.annotation.Nonnull * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> repeatWithHttpInfo(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { + public CompletableFuture> repeatWithHttpInfo(@jakarta.annotation.Nonnull RepeatRequestDto repeatRequestDto) throws ApiException { return repeatWithHttpInfo(repeatRequestDto, null); } @@ -746,7 +746,7 @@ public CompletableFuture> repeatWithHttpInfo(@ * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> repeatWithHttpInfo(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + public CompletableFuture> repeatWithHttpInfo(@jakarta.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = repeatRequestBuilder(repeatRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -798,7 +798,7 @@ public CompletableFuture> repeatWithHttpInfo(@ } } - private HttpRequest.Builder repeatRequestBuilder(@javax.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder repeatRequestBuilder(@jakarta.annotation.Nonnull RepeatRequestDto repeatRequestDto, Map headers) throws ApiException { // verify the required parameter 'repeatRequestDto' is set if (repeatRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'repeatRequestDto' when calling repeat"); @@ -837,7 +837,7 @@ private HttpRequest.Builder repeatRequestBuilder(@javax.annotation.Nonnull Repea * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture union(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture union(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return union(multiTermsRequestDto, null); } @@ -849,7 +849,7 @@ public CompletableFuture union(@javax.annotation.Nonnull M * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture union(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture union(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { return unionWithHttpInfo(multiTermsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -866,7 +866,7 @@ public CompletableFuture union(@javax.annotation.Nonnull M * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> unionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { + public CompletableFuture> unionWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto) throws ApiException { return unionWithHttpInfo(multiTermsRequestDto, null); } @@ -878,7 +878,7 @@ public CompletableFuture> unionWithHttpInfo(@j * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> unionWithHttpInfo(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + public CompletableFuture> unionWithHttpInfo(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = unionRequestBuilder(multiTermsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -930,7 +930,7 @@ public CompletableFuture> unionWithHttpInfo(@j } } - private HttpRequest.Builder unionRequestBuilder(@javax.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder unionRequestBuilder(@jakarta.annotation.Nonnull MultiTermsRequestDto multiTermsRequestDto, Map headers) throws ApiException { // verify the required parameter 'multiTermsRequestDto' is set if (multiTermsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'multiTermsRequestDto' when calling union"); diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index 0af8b16..06b97f5 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -49,7 +49,7 @@ import java.util.concurrent.CompletableFuture; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -174,7 +174,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx * @return CompletableFuture<Strings200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture strings(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { + public CompletableFuture strings(@jakarta.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { return strings(generateStringsRequestDto, null); } @@ -186,7 +186,7 @@ public CompletableFuture strings(@javax.annotation.Nonnul * @return CompletableFuture<Strings200ResponseDto> * @throws ApiException if fails to make API call */ - public CompletableFuture strings(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + public CompletableFuture strings(@jakarta.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { try { return stringsWithHttpInfo(generateStringsRequestDto, headers) .thenApply(ApiResponse::getData); @@ -203,7 +203,7 @@ public CompletableFuture strings(@javax.annotation.Nonnul * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> stringsWithHttpInfo(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { + public CompletableFuture> stringsWithHttpInfo(@jakarta.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto) throws ApiException { return stringsWithHttpInfo(generateStringsRequestDto, null); } @@ -215,7 +215,7 @@ public CompletableFuture> stringsWithHttpInfo * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> * @throws ApiException if fails to make API call */ - public CompletableFuture> stringsWithHttpInfo(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + public CompletableFuture> stringsWithHttpInfo(@jakarta.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { try { HttpRequest.Builder localVarRequestBuilder = stringsRequestBuilder(generateStringsRequestDto, headers); return memberVarHttpClient.sendAsync( @@ -267,7 +267,7 @@ public CompletableFuture> stringsWithHttpInfo } } - private HttpRequest.Builder stringsRequestBuilder(@javax.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { + private HttpRequest.Builder stringsRequestBuilder(@jakarta.annotation.Nonnull GenerateStringsRequestDto generateStringsRequestDto, Map headers) throws ApiException { // verify the required parameter 'generateStringsRequestDto' is set if (generateStringsRequestDto == null) { throw new ApiException(400, "Missing the required parameter 'generateStringsRequestDto' when calling strings"); diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index f3b5409..59bab64 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index dc1ef0b..2b1aa26 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type @@ -72,17 +72,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean value; public BooleanDto() { } - public BooleanDto type(@javax.annotation.Nonnull TypeEnum type) { + public BooleanDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -91,7 +91,7 @@ public BooleanDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -101,12 +101,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public BooleanDto value(@javax.annotation.Nonnull Boolean value) { + public BooleanDto value(@jakarta.annotation.Nonnull Boolean value) { this.value = value; return this; } @@ -115,7 +115,7 @@ public BooleanDto value(@javax.annotation.Nonnull Boolean value) { * Boolean value. * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getValue() { @@ -125,7 +125,7 @@ public Boolean getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull Boolean value) { + public void setValue(@jakarta.annotation.Nonnull Boolean value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index 837de74..c5c3cda 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -37,20 +37,20 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private CardinalityDto data; public Cardinality200ResponseDto() { } - public Cardinality200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Cardinality200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Cardinality200ResponseDto success(@javax.annotation.Nonnull Boolean succe * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Cardinality200ResponseDto data(@javax.annotation.Nonnull CardinalityDto data) { + public Cardinality200ResponseDto data(@jakarta.annotation.Nonnull CardinalityDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Cardinality200ResponseDto data(@javax.annotation.Nonnull CardinalityDto d * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public CardinalityDto getData() { @@ -93,7 +93,7 @@ public CardinalityDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull CardinalityDto data) { + public void setData(@jakarta.annotation.Nonnull CardinalityDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index 3215d32..edcfeb0 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type @@ -71,13 +71,13 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public CardinalityBigIntegerDto() { } - public CardinalityBigIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { + public CardinalityBigIntegerDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -86,7 +86,7 @@ public CardinalityBigIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -96,7 +96,7 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index 7ced7f9..0312fb4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index 79fd9a4..aa5fe8c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type @@ -71,13 +71,13 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public CardinalityInfiniteDto() { } - public CardinalityInfiniteDto type(@javax.annotation.Nonnull TypeEnum type) { + public CardinalityInfiniteDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -86,7 +86,7 @@ public CardinalityInfiniteDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -96,7 +96,7 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index 10b3131..a64396f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type @@ -72,17 +72,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Long value; public CardinalityIntegerDto() { } - public CardinalityIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { + public CardinalityIntegerDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -91,7 +91,7 @@ public CardinalityIntegerDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -101,12 +101,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public CardinalityIntegerDto value(@javax.annotation.Nonnull Long value) { + public CardinalityIntegerDto value(@jakarta.annotation.Nonnull Long value) { this.value = value; return this; } @@ -116,7 +116,7 @@ public CardinalityIntegerDto value(@javax.annotation.Nonnull Long value) { * minimum: 0 * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Long getValue() { @@ -126,7 +126,7 @@ public Long getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull Long value) { + public void setValue(@jakarta.annotation.Nonnull Long value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index 85a9dd4..0f3e015 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -37,20 +37,20 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TermDto data; public Concat200ResponseDto() { } - public Concat200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Concat200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Concat200ResponseDto success(@javax.annotation.Nonnull Boolean success) { * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Concat200ResponseDto data(@javax.annotation.Nonnull TermDto data) { + public Concat200ResponseDto data(@jakarta.annotation.Nonnull TermDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Concat200ResponseDto data(@javax.annotation.Nonnull TermDto data) { * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TermDto getData() { @@ -93,7 +93,7 @@ public TermDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull TermDto data) { + public void setData(@jakarta.annotation.Nonnull TermDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index d02ff6b..e98c6b0 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -37,20 +37,20 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private StringDto data; public Dot200ResponseDto() { } - public Dot200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Dot200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Dot200ResponseDto success(@javax.annotation.Nonnull Boolean success) { * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Dot200ResponseDto data(@javax.annotation.Nonnull StringDto data) { + public Dot200ResponseDto data(@jakarta.annotation.Nonnull StringDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Dot200ResponseDto data(@javax.annotation.Nonnull StringDto data) { * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public StringDto getData() { @@ -93,7 +93,7 @@ public StringDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull StringDto data) { + public void setData(@jakarta.annotation.Nonnull StringDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index 6755e58..d10f255 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -37,20 +37,20 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private BooleanDto data; public Empty200ResponseDto() { } - public Empty200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Empty200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Empty200ResponseDto success(@javax.annotation.Nonnull Boolean success) { * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Empty200ResponseDto data(@javax.annotation.Nonnull BooleanDto data) { + public Empty200ResponseDto data(@jakarta.annotation.Nonnull BooleanDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Empty200ResponseDto data(@javax.annotation.Nonnull BooleanDto data) { * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public BooleanDto getData() { @@ -93,7 +93,7 @@ public BooleanDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull BooleanDto data) { + public void setData(@jakarta.annotation.Nonnull BooleanDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index a9a4eef..e60235f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -37,24 +37,24 @@ ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_ERROR = "error"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private String error; public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private String errorCode; public ErrorResponseDto() { } - public ErrorResponseDto success(@javax.annotation.Nonnull Boolean success) { + public ErrorResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -63,7 +63,7 @@ public ErrorResponseDto success(@javax.annotation.Nonnull Boolean success) { * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -73,12 +73,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public ErrorResponseDto error(@javax.annotation.Nonnull String error) { + public ErrorResponseDto error(@jakarta.annotation.Nonnull String error) { this.error = error; return this; } @@ -87,7 +87,7 @@ public ErrorResponseDto error(@javax.annotation.Nonnull String error) { * Human readable error message. * @return error */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getError() { @@ -97,12 +97,12 @@ public String getError() { @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setError(@javax.annotation.Nonnull String error) { + public void setError(@jakarta.annotation.Nonnull String error) { this.error = error; } - public ErrorResponseDto errorCode(@javax.annotation.Nullable String errorCode) { + public ErrorResponseDto errorCode(@jakarta.annotation.Nullable String errorCode) { this.errorCode = errorCode; return this; } @@ -111,7 +111,7 @@ public ErrorResponseDto errorCode(@javax.annotation.Nullable String errorCode) { * The error code. * @return errorCode */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public String getErrorCode() { @@ -121,7 +121,7 @@ public String getErrorCode() { @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setErrorCode(@javax.annotation.Nullable String errorCode) { + public void setErrorCode(@jakarta.annotation.Nullable String errorCode) { this.errorCode = errorCode; } diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index fb6d515..898a983 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -35,16 +35,16 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private Integer timeout; public ExecutionOptionsDto() { } - public ExecutionOptionsDto timeout(@javax.annotation.Nullable Integer timeout) { + public ExecutionOptionsDto timeout(@jakarta.annotation.Nullable Integer timeout) { this.timeout = timeout; return this; } @@ -54,7 +54,7 @@ public ExecutionOptionsDto timeout(@javax.annotation.Nullable Integer timeout) { * minimum: 1 * @return timeout */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_TIMEOUT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getTimeout() { @@ -64,7 +64,7 @@ public Integer getTimeout() { @JsonProperty(value = JSON_PROPERTY_TIMEOUT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTimeout(@javax.annotation.Nullable Integer timeout) { + public void setTimeout(@jakarta.annotation.Nullable Integer timeout) { this.timeout = timeout; } diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index e59a3e2..6228c2d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -41,32 +41,32 @@ GenerateStringsRequestDto.JSON_PROPERTY_RETURN_STABLE_TERM, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TermDto term; public static final String JSON_PROPERTY_LIMIT = "limit"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Integer limit; public static final String JSON_PROPERTY_OFFSET = "offset"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Integer offset; public static final String JSON_PROPERTY_RETURN_STABLE_TERM = "returnStableTerm"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private Boolean returnStableTerm = false; public static final String JSON_PROPERTY_OPTIONS = "options"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private RequestOptionsDto options; public GenerateStringsRequestDto() { } - public GenerateStringsRequestDto term(@javax.annotation.Nonnull TermDto term) { + public GenerateStringsRequestDto term(@jakarta.annotation.Nonnull TermDto term) { this.term = term; return this; } @@ -75,7 +75,7 @@ public GenerateStringsRequestDto term(@javax.annotation.Nonnull TermDto term) { * Source term to generate strings from. * @return term */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TermDto getTerm() { @@ -85,12 +85,12 @@ public TermDto getTerm() { @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTerm(@javax.annotation.Nonnull TermDto term) { + public void setTerm(@jakarta.annotation.Nonnull TermDto term) { this.term = term; } - public GenerateStringsRequestDto limit(@javax.annotation.Nonnull Integer limit) { + public GenerateStringsRequestDto limit(@jakarta.annotation.Nonnull Integer limit) { this.limit = limit; return this; } @@ -101,7 +101,7 @@ public GenerateStringsRequestDto limit(@javax.annotation.Nonnull Integer limit) * maximum: 100 * @return limit */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getLimit() { @@ -111,12 +111,12 @@ public Integer getLimit() { @JsonProperty(value = JSON_PROPERTY_LIMIT, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setLimit(@javax.annotation.Nonnull Integer limit) { + public void setLimit(@jakarta.annotation.Nonnull Integer limit) { this.limit = limit; } - public GenerateStringsRequestDto offset(@javax.annotation.Nonnull Integer offset) { + public GenerateStringsRequestDto offset(@jakarta.annotation.Nonnull Integer offset) { this.offset = offset; return this; } @@ -126,7 +126,7 @@ public GenerateStringsRequestDto offset(@javax.annotation.Nonnull Integer offset * minimum: 0 * @return offset */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getOffset() { @@ -136,12 +136,12 @@ public Integer getOffset() { @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setOffset(@javax.annotation.Nonnull Integer offset) { + public void setOffset(@jakarta.annotation.Nonnull Integer offset) { this.offset = offset; } - public GenerateStringsRequestDto returnStableTerm(@javax.annotation.Nullable Boolean returnStableTerm) { + public GenerateStringsRequestDto returnStableTerm(@jakarta.annotation.Nullable Boolean returnStableTerm) { this.returnStableTerm = returnStableTerm; return this; } @@ -150,7 +150,7 @@ public GenerateStringsRequestDto returnStableTerm(@javax.annotation.Nullable Boo * If set to true, a stable term is returned. This term can be reused in subsequent calls to guarantee no strings are repeated. If the provided term is already stable, it will not be returned. * @return returnStableTerm */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Boolean getReturnStableTerm() { @@ -160,12 +160,12 @@ public Boolean getReturnStableTerm() { @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReturnStableTerm(@javax.annotation.Nullable Boolean returnStableTerm) { + public void setReturnStableTerm(@jakarta.annotation.Nullable Boolean returnStableTerm) { this.returnStableTerm = returnStableTerm; } - public GenerateStringsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + public GenerateStringsRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; } @@ -174,7 +174,7 @@ public GenerateStringsRequestDto options(@javax.annotation.Nullable RequestOptio * Get options * @return options */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RequestOptionsDto getOptions() { @@ -184,7 +184,7 @@ public RequestOptionsDto getOptions() { @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + public void setOptions(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; } diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index 5aaeae9..71f98ca 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -39,7 +39,7 @@ GenerateStringsResponseDto.JSON_PROPERTY_TERM, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type @@ -75,21 +75,21 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_TERM = "term"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private TermDto term; public static final String JSON_PROPERTY_STRINGS = "strings"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private StringsDto strings; public GenerateStringsResponseDto() { } - public GenerateStringsResponseDto type(@javax.annotation.Nonnull TypeEnum type) { + public GenerateStringsResponseDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -98,7 +98,7 @@ public GenerateStringsResponseDto type(@javax.annotation.Nonnull TypeEnum type) * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -108,12 +108,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public GenerateStringsResponseDto term(@javax.annotation.Nullable TermDto term) { + public GenerateStringsResponseDto term(@jakarta.annotation.Nullable TermDto term) { this.term = term; return this; } @@ -122,7 +122,7 @@ public GenerateStringsResponseDto term(@javax.annotation.Nullable TermDto term) * A stable term to use in subsequent calls to guarantee the uniqueness of generated strings. Omitted if 'returnStableTerm' was false in the request, or if the provided term was already stable. * @return term */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_TERM, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public TermDto getTerm() { @@ -132,12 +132,12 @@ public TermDto getTerm() { @JsonProperty(value = JSON_PROPERTY_TERM, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTerm(@javax.annotation.Nullable TermDto term) { + public void setTerm(@jakarta.annotation.Nullable TermDto term) { this.term = term; } - public GenerateStringsResponseDto strings(@javax.annotation.Nonnull StringsDto strings) { + public GenerateStringsResponseDto strings(@jakarta.annotation.Nonnull StringsDto strings) { this.strings = strings; return this; } @@ -146,7 +146,7 @@ public GenerateStringsResponseDto strings(@javax.annotation.Nonnull StringsDto s * The generated distinct strings. * @return strings */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_STRINGS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public StringsDto getStrings() { @@ -156,7 +156,7 @@ public StringsDto getStrings() { @JsonProperty(value = JSON_PROPERTY_STRINGS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setStrings(@javax.annotation.Nonnull StringsDto strings) { + public void setStrings(@jakarta.annotation.Nonnull StringsDto strings) { this.strings = strings; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index 114d13a..0cc6720 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -37,20 +37,20 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private LengthDto data; public Length200ResponseDto() { } - public Length200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Length200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Length200ResponseDto success(@javax.annotation.Nonnull Boolean success) { * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Length200ResponseDto data(@javax.annotation.Nonnull LengthDto data) { + public Length200ResponseDto data(@jakarta.annotation.Nonnull LengthDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Length200ResponseDto data(@javax.annotation.Nonnull LengthDto data) { * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public LengthDto getData() { @@ -93,7 +93,7 @@ public LengthDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull LengthDto data) { + public void setData(@jakarta.annotation.Nonnull LengthDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index 4019b19..bc1f2fd 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type @@ -73,21 +73,21 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_MIN = "min"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private Integer min; public static final String JSON_PROPERTY_MAX = "max"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private Integer max; public LengthDto() { } - public LengthDto type(@javax.annotation.Nonnull TypeEnum type) { + public LengthDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -96,7 +96,7 @@ public LengthDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -106,12 +106,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public LengthDto min(@javax.annotation.Nullable Integer min) { + public LengthDto min(@jakarta.annotation.Nullable Integer min) { this.min = min; return this; } @@ -120,7 +120,7 @@ public LengthDto min(@javax.annotation.Nullable Integer min) { * Shortest possible length, or null if empty. * @return min */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_MIN, required = false) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getMin() { @@ -130,12 +130,12 @@ public Integer getMin() { @JsonProperty(value = JSON_PROPERTY_MIN, required = false) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setMin(@javax.annotation.Nullable Integer min) { + public void setMin(@jakarta.annotation.Nullable Integer min) { this.min = min; } - public LengthDto max(@javax.annotation.Nullable Integer max) { + public LengthDto max(@jakarta.annotation.Nullable Integer max) { this.max = max; return this; } @@ -144,7 +144,7 @@ public LengthDto max(@javax.annotation.Nullable Integer max) { * Longest possible length, or null if unbounded. * @return max */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_MAX, required = false) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getMax() { @@ -154,7 +154,7 @@ public Integer getMax() { @JsonProperty(value = JSON_PROPERTY_MAX, required = false) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setMax(@javax.annotation.Nullable Integer max) { + public void setMax(@jakarta.annotation.Nullable Integer max) { this.max = max; } diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index f703cee..bf40404 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -40,20 +40,20 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private List terms = new ArrayList<>(); public static final String JSON_PROPERTY_OPTIONS = "options"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private RequestOptionsDto options; public MultiTermsRequestDto() { } - public MultiTermsRequestDto terms(@javax.annotation.Nonnull List terms) { + public MultiTermsRequestDto terms(@jakarta.annotation.Nonnull List terms) { this.terms = terms; return this; } @@ -70,7 +70,7 @@ public MultiTermsRequestDto addTermsItem(TermDto termsItem) { * Terms to process. Order matters for some operations. * @return terms */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTerms() { @@ -80,12 +80,12 @@ public List getTerms() { @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTerms(@javax.annotation.Nonnull List terms) { + public void setTerms(@jakarta.annotation.Nonnull List terms) { this.terms = terms; } - public MultiTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + public MultiTermsRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; } @@ -94,7 +94,7 @@ public MultiTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto * Get options * @return options */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RequestOptionsDto getOptions() { @@ -104,7 +104,7 @@ public RequestOptionsDto getOptions() { @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + public void setOptions(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; } diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index b536a80..87e071e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -40,28 +40,28 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TermDto term; public static final String JSON_PROPERTY_MIN = "min"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Integer min; public static final String JSON_PROPERTY_MAX = "max"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private Integer max; public static final String JSON_PROPERTY_OPTIONS = "options"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private RequestOptionsDto options; public RepeatRequestDto() { } - public RepeatRequestDto term(@javax.annotation.Nonnull TermDto term) { + public RepeatRequestDto term(@jakarta.annotation.Nonnull TermDto term) { this.term = term; return this; } @@ -70,7 +70,7 @@ public RepeatRequestDto term(@javax.annotation.Nonnull TermDto term) { * Term to repeat. * @return term */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TermDto getTerm() { @@ -80,12 +80,12 @@ public TermDto getTerm() { @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTerm(@javax.annotation.Nonnull TermDto term) { + public void setTerm(@jakarta.annotation.Nonnull TermDto term) { this.term = term; } - public RepeatRequestDto min(@javax.annotation.Nonnull Integer min) { + public RepeatRequestDto min(@jakarta.annotation.Nonnull Integer min) { this.min = min; return this; } @@ -94,7 +94,7 @@ public RepeatRequestDto min(@javax.annotation.Nonnull Integer min) { * Inclusive lower bound of repetitions. * @return min */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_MIN, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getMin() { @@ -104,12 +104,12 @@ public Integer getMin() { @JsonProperty(value = JSON_PROPERTY_MIN, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setMin(@javax.annotation.Nonnull Integer min) { + public void setMin(@jakarta.annotation.Nonnull Integer min) { this.min = min; } - public RepeatRequestDto max(@javax.annotation.Nullable Integer max) { + public RepeatRequestDto max(@jakarta.annotation.Nullable Integer max) { this.max = max; return this; } @@ -118,7 +118,7 @@ public RepeatRequestDto max(@javax.annotation.Nullable Integer max) { * Inclusive upper bound. If omitted or null, the repetition is unbounded. * @return max */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_MAX, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getMax() { @@ -128,12 +128,12 @@ public Integer getMax() { @JsonProperty(value = JSON_PROPERTY_MAX, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setMax(@javax.annotation.Nullable Integer max) { + public void setMax(@jakarta.annotation.Nullable Integer max) { this.max = max; } - public RepeatRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + public RepeatRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; } @@ -142,7 +142,7 @@ public RepeatRequestDto options(@javax.annotation.Nullable RequestOptionsDto opt * Get options * @return options */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RequestOptionsDto getOptions() { @@ -152,7 +152,7 @@ public RequestOptionsDto getOptions() { @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + public void setOptions(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; } diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index 190acca..ecfef2b 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -39,24 +39,24 @@ RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Integer schemaVersion; public static final String JSON_PROPERTY_RESPONSE = "response"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private ResponseOptionsDto response; public static final String JSON_PROPERTY_EXECUTION = "execution"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private ExecutionOptionsDto execution; public RequestOptionsDto() { } - public RequestOptionsDto schemaVersion(@javax.annotation.Nonnull Integer schemaVersion) { + public RequestOptionsDto schemaVersion(@jakarta.annotation.Nonnull Integer schemaVersion) { this.schemaVersion = schemaVersion; return this; } @@ -65,7 +65,7 @@ public RequestOptionsDto schemaVersion(@javax.annotation.Nonnull Integer schemaV * Client-expected schema version. * @return schemaVersion */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SCHEMA_VERSION, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Integer getSchemaVersion() { @@ -75,12 +75,12 @@ public Integer getSchemaVersion() { @JsonProperty(value = JSON_PROPERTY_SCHEMA_VERSION, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSchemaVersion(@javax.annotation.Nonnull Integer schemaVersion) { + public void setSchemaVersion(@jakarta.annotation.Nonnull Integer schemaVersion) { this.schemaVersion = schemaVersion; } - public RequestOptionsDto response(@javax.annotation.Nullable ResponseOptionsDto response) { + public RequestOptionsDto response(@jakarta.annotation.Nullable ResponseOptionsDto response) { this.response = response; return this; } @@ -89,7 +89,7 @@ public RequestOptionsDto response(@javax.annotation.Nullable ResponseOptionsDto * Get response * @return response */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_RESPONSE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ResponseOptionsDto getResponse() { @@ -99,12 +99,12 @@ public ResponseOptionsDto getResponse() { @JsonProperty(value = JSON_PROPERTY_RESPONSE, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setResponse(@javax.annotation.Nullable ResponseOptionsDto response) { + public void setResponse(@jakarta.annotation.Nullable ResponseOptionsDto response) { this.response = response; } - public RequestOptionsDto execution(@javax.annotation.Nullable ExecutionOptionsDto execution) { + public RequestOptionsDto execution(@jakarta.annotation.Nullable ExecutionOptionsDto execution) { this.execution = execution; return this; } @@ -113,7 +113,7 @@ public RequestOptionsDto execution(@javax.annotation.Nullable ExecutionOptionsDt * Get execution * @return execution */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_EXECUTION, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public ExecutionOptionsDto getExecution() { @@ -123,7 +123,7 @@ public ExecutionOptionsDto getExecution() { @JsonProperty(value = JSON_PROPERTY_EXECUTION, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setExecution(@javax.annotation.Nullable ExecutionOptionsDto execution) { + public void setExecution(@jakarta.annotation.Nullable ExecutionOptionsDto execution) { this.execution = execution; } diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index a468e12..2717669 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ResponseOptionsDto.JSON_PROPERTY_FORMAT }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. @@ -75,13 +75,13 @@ public static FormatEnum fromValue(String value) { } public static final String JSON_PROPERTY_FORMAT = "format"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private FormatEnum format; public ResponseOptionsDto() { } - public ResponseOptionsDto format(@javax.annotation.Nullable FormatEnum format) { + public ResponseOptionsDto format(@jakarta.annotation.Nullable FormatEnum format) { this.format = format; return this; } @@ -90,7 +90,7 @@ public ResponseOptionsDto format(@javax.annotation.Nullable FormatEnum format) { * Return format of the term. * @return format */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_FORMAT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public FormatEnum getFormat() { @@ -100,7 +100,7 @@ public FormatEnum getFormat() { @JsonProperty(value = JSON_PROPERTY_FORMAT, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setFormat(@javax.annotation.Nullable FormatEnum format) { + public void setFormat(@jakarta.annotation.Nullable FormatEnum format) { this.format = format; } diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index 0f3dbdd..df61c1d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type @@ -72,17 +72,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private String value; public StringDto() { } - public StringDto type(@javax.annotation.Nonnull TypeEnum type) { + public StringDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -91,7 +91,7 @@ public StringDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -101,12 +101,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public StringDto value(@javax.annotation.Nonnull String value) { + public StringDto value(@jakarta.annotation.Nonnull String value) { this.value = value; return this; } @@ -115,7 +115,7 @@ public StringDto value(@javax.annotation.Nonnull String value) { * String value. * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getValue() { @@ -125,7 +125,7 @@ public String getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull String value) { + public void setValue(@jakarta.annotation.Nonnull String value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index bda8689..806ea89 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -37,20 +37,20 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private Boolean success; public static final String JSON_PROPERTY_DATA = "data"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private GenerateStringsResponseDto data; public Strings200ResponseDto() { } - public Strings200ResponseDto success(@javax.annotation.Nonnull Boolean success) { + public Strings200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { this.success = success; return this; } @@ -59,7 +59,7 @@ public Strings200ResponseDto success(@javax.annotation.Nonnull Boolean success) * Get success * @return success */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public Boolean getSuccess() { @@ -69,12 +69,12 @@ public Boolean getSuccess() { @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setSuccess(@javax.annotation.Nonnull Boolean success) { + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { this.success = success; } - public Strings200ResponseDto data(@javax.annotation.Nonnull GenerateStringsResponseDto data) { + public Strings200ResponseDto data(@jakarta.annotation.Nonnull GenerateStringsResponseDto data) { this.data = data; return this; } @@ -83,7 +83,7 @@ public Strings200ResponseDto data(@javax.annotation.Nonnull GenerateStringsRespo * Get data * @return data */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public GenerateStringsResponseDto getData() { @@ -93,7 +93,7 @@ public GenerateStringsResponseDto getData() { @JsonProperty(value = JSON_PROPERTY_DATA, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setData(@javax.annotation.Nonnull GenerateStringsResponseDto data) { + public void setData(@jakarta.annotation.Nonnull GenerateStringsResponseDto data) { this.data = data; } diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index d18a63b..bc5871b 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type @@ -74,17 +74,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private List value = new ArrayList<>(); public StringsDto() { } - public StringsDto type(@javax.annotation.Nonnull TypeEnum type) { + public StringsDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -93,7 +93,7 @@ public StringsDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -103,12 +103,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public StringsDto value(@javax.annotation.Nonnull List value) { + public StringsDto value(@jakarta.annotation.Nonnull List value) { this.value = value; return this; } @@ -125,7 +125,7 @@ public StringsDto addValueItem(String valueItem) { * Array of unique strings. * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getValue() { @@ -135,7 +135,7 @@ public List getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull List value) { + public void setValue(@jakarta.annotation.Nonnull List value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index 17d39ee..0b411e2 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -57,7 +57,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index 2a2f9e1..683f97a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -36,7 +36,7 @@ TermFairDto.JSON_PROPERTY_TYPE, TermFairDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type @@ -72,17 +72,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private String value; public TermFairDto() { } - public TermFairDto type(@javax.annotation.Nonnull TypeEnum type) { + public TermFairDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -91,7 +91,7 @@ public TermFairDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -101,12 +101,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public TermFairDto value(@javax.annotation.Nonnull String value) { + public TermFairDto value(@jakarta.annotation.Nonnull String value) { this.value = value; return this; } @@ -115,7 +115,7 @@ public TermFairDto value(@javax.annotation.Nonnull String value) { * FAIR payload. * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getValue() { @@ -125,7 +125,7 @@ public String getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull String value) { + public void setValue(@jakarta.annotation.Nonnull String value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index 62fe4f8..ae73e3e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type @@ -72,17 +72,17 @@ public static TypeEnum fromValue(String value) { } public static final String JSON_PROPERTY_TYPE = "type"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TypeEnum type; public static final String JSON_PROPERTY_VALUE = "value"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private String value; public TermRegexDto() { } - public TermRegexDto type(@javax.annotation.Nonnull TypeEnum type) { + public TermRegexDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; } @@ -91,7 +91,7 @@ public TermRegexDto type(@javax.annotation.Nonnull TypeEnum type) { * Get type * @return type */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TypeEnum getType() { @@ -101,12 +101,12 @@ public TypeEnum getType() { @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setType(@javax.annotation.Nonnull TypeEnum type) { + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; } - public TermRegexDto value(@javax.annotation.Nonnull String value) { + public TermRegexDto value(@jakarta.annotation.Nonnull String value) { this.value = value; return this; } @@ -115,7 +115,7 @@ public TermRegexDto value(@javax.annotation.Nonnull String value) { * Regular expression pattern. * @return value */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public String getValue() { @@ -125,7 +125,7 @@ public String getValue() { @JsonProperty(value = JSON_PROPERTY_VALUE, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setValue(@javax.annotation.Nonnull String value) { + public void setValue(@jakarta.annotation.Nonnull String value) { this.value = value; } diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index 3406468..f07d5ab 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -38,20 +38,20 @@ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private TermDto term; public static final String JSON_PROPERTY_OPTIONS = "options"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private RequestOptionsDto options; public TermRequestDto() { } - public TermRequestDto term(@javax.annotation.Nonnull TermDto term) { + public TermRequestDto term(@jakarta.annotation.Nonnull TermDto term) { this.term = term; return this; } @@ -60,7 +60,7 @@ public TermRequestDto term(@javax.annotation.Nonnull TermDto term) { * Get term * @return term */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public TermDto getTerm() { @@ -70,12 +70,12 @@ public TermDto getTerm() { @JsonProperty(value = JSON_PROPERTY_TERM, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTerm(@javax.annotation.Nonnull TermDto term) { + public void setTerm(@jakarta.annotation.Nonnull TermDto term) { this.term = term; } - public TermRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + public TermRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; } @@ -84,7 +84,7 @@ public TermRequestDto options(@javax.annotation.Nullable RequestOptionsDto optio * Get options * @return options */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RequestOptionsDto getOptions() { @@ -94,7 +94,7 @@ public RequestOptionsDto getOptions() { @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + public void setOptions(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; } diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index 92aa3d8..81d6ae4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -40,20 +40,20 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-03-28T15:29:36.647057244+01:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull private List terms = new ArrayList<>(); public static final String JSON_PROPERTY_OPTIONS = "options"; - @javax.annotation.Nullable + @jakarta.annotation.Nullable private RequestOptionsDto options; public TwoTermsRequestDto() { } - public TwoTermsRequestDto terms(@javax.annotation.Nonnull List terms) { + public TwoTermsRequestDto terms(@jakarta.annotation.Nonnull List terms) { this.terms = terms; return this; } @@ -70,7 +70,7 @@ public TwoTermsRequestDto addTermsItem(TermDto termsItem) { * Exactly 2 terms. * @return terms */ - @javax.annotation.Nonnull + @jakarta.annotation.Nonnull @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) public List getTerms() { @@ -80,12 +80,12 @@ public List getTerms() { @JsonProperty(value = JSON_PROPERTY_TERMS, required = true) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setTerms(@javax.annotation.Nonnull List terms) { + public void setTerms(@jakarta.annotation.Nonnull List terms) { this.terms = terms; } - public TwoTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto options) { + public TwoTermsRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; } @@ -94,7 +94,7 @@ public TwoTermsRequestDto options(@javax.annotation.Nullable RequestOptionsDto o * Get options * @return options */ - @javax.annotation.Nullable + @jakarta.annotation.Nullable @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public RequestOptionsDto getOptions() { @@ -104,7 +104,7 @@ public RequestOptionsDto getOptions() { @JsonProperty(value = JSON_PROPERTY_OPTIONS, required = false) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setOptions(@javax.annotation.Nullable RequestOptionsDto options) { + public void setOptions(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; } diff --git a/src/main/java/com/regexsolver/api/package-info.java b/src/main/java/com/regexsolver/api/package-info.java new file mode 100644 index 0000000..30a5a14 --- /dev/null +++ b/src/main/java/com/regexsolver/api/package-info.java @@ -0,0 +1,4 @@ +/** + * Main package for the RegexSolver Java client API. + */ +package com.regexsolver.api; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java new file mode 100644 index 0000000..c2f6ee5 --- /dev/null +++ b/src/main/java/module-info.java @@ -0,0 +1,14 @@ +module com.regexsolver.api { + exports com.regexsolver.api; + exports com.regexsolver.api.exceptions; + + requires java.net.http; + requires java.logging; + requires com.fasterxml.jackson.annotation; + requires com.fasterxml.jackson.core; + requires com.fasterxml.jackson.databind; + requires com.fasterxml.jackson.datatype.jsr310; + requires org.openapitools.jackson.nullable; + + requires static jakarta.annotation; +} From b27a89139470c5d59101ce5f4707b10e9cb8e3dd Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 12 Apr 2026 21:24:06 +0200 Subject: [PATCH 14/24] Update README --- README.md | 4 +- api/openapi.yaml | 1756 ---------------------------------------------- 2 files changed, 2 insertions(+), 1758 deletions(-) delete mode 100644 api/openapi.yaml diff --git a/README.md b/README.md index 644f94a..050da3b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ import com.regexsolver.api.Term; public class Main { public static void main(String[] args) { RegexSolverClient client = RegexSolverClient.builder() - .apiToken("YOUR_API_TOKEN") + .apiToken("REGEXSOLVER_API_TOKEN") .build(); Term term1 = Term.regex("(abc|de|fg){2,}"); @@ -64,7 +64,7 @@ import java.util.concurrent.CompletableFuture; public class Main { public static void main(String[] args) { AsyncRegexSolverClient client = AsyncRegexSolverClient.builder() - .apiToken("YOUR_API_TOKEN") + .apiToken("REGEXSOLVER_API_TOKEN") .build(); Term term1 = Term.regex("(abc|de|fg){2,}"); diff --git a/api/openapi.yaml b/api/openapi.yaml deleted file mode 100644 index 7079ddd..0000000 --- a/api/openapi.yaml +++ /dev/null @@ -1,1756 +0,0 @@ -openapi: 3.0.3 -info: - title: RegexSolver - version: 1.1.0 -servers: -- url: https://api.regexsolver.com/v1 -security: -- BearerAuth: [] -paths: - /analyze/cardinality: - post: - description: Compute how many strings the term matches. - operationId: cardinality - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: integer - value: 26 - schema: - $ref: "#/components/schemas/cardinality_200_response" - description: Cardinality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Cardinality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/dot: - post: - description: Build a Graphviz DOT representation of the term's automaton. - operationId: dot - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: string - value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ - 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ - \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ - 1\"];\n}" - schema: - $ref: "#/components/schemas/dot_200_response" - description: Graphviz DOT representation. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: GraphViz Dot - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty: - post: - description: Check if the term matches no strings. - operationId: empty - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty language result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Empty - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty_string: - post: - description: Check if the term matches only the empty string. - operationId: empty_string - requestBody: - content: - application/json: - example: - term: - type: regex - value: "" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty string only result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Empty String Only - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/total: - post: - description: Check if the term matches all the possible strings. - operationId: total - requestBody: - content: - application/json: - example: - term: - type: regex - value: .* - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Totality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Totality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/equivalent: - post: - description: Check if the two terms accept exactly the same language. - operationId: equivalent - requestBody: - content: - application/json: - example: - terms: - - type: regex - value: (abcd|abef) - - type: regex - value: ab(cd|ef) - schema: - $ref: "#/components/schemas/TwoTermsRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Language equivalence result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Equivalent - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/length: - post: - description: Compute the minimum and maximum length of strings matched by the - term. - operationId: length - requestBody: - content: - application/json: - example: - term: - type: regex - value: (abc)?d - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: length - min: 1 - max: 4 - schema: - $ref: "#/components/schemas/length_200_response" - description: Length bounds. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Bad request. The input was invalid or could not be parsed. - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Unauthorized. Missing or invalid bearer token. - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Forbidden. You do not have access to this resource. - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found. The resource does not exist. - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests. Rate limit exceeded. - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error. - summary: Length - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/pattern: - post: - description: Return a regular expression pattern that represents the term. - operationId: pattern - requestBody: - content: - application/json: - example: - term: - type: fair - value: " Date: Mon, 13 Apr 2026 21:13:14 +0200 Subject: [PATCH 15/24] Update possible exceptions --- .openapi-generator/FILES | 3 + api/openapi.yaml | 1801 +++++++++++++++++ .../api/AsyncRegexSolverClient.java | 16 + .../AutomatonTooManyStatesException.java | 10 + .../api/exceptions/RegexSyntaxException.java | 10 + .../regexsolver/api/generated/ApiClient.java | 2 +- .../api/generated/ApiException.java | 2 +- .../api/generated/ApiResponse.java | 2 +- .../api/generated/Configuration.java | 2 +- .../com/regexsolver/api/generated/JSON.java | 4 +- .../com/regexsolver/api/generated/Pair.java | 2 +- .../api/generated/RFC3339DateFormat.java | 2 +- .../generated/RFC3339InstantDeserializer.java | 2 +- .../api/generated/RFC3339JavaTimeModule.java | 2 +- .../api/generated/ServerConfiguration.java | 2 +- .../api/generated/ServerVariable.java | 2 +- .../api/generated/api/AnalyzeApi.java | 5 +- .../api/generated/api/ComputeApi.java | 5 +- .../api/generated/api/GenerateApi.java | 5 +- .../model/AbstractOpenApiSchema.java | 2 +- .../api/generated/model/BooleanDto.java | 2 +- .../model/Cardinality200ResponseDto.java | 2 +- .../model/CardinalityBigIntegerDto.java | 2 +- .../api/generated/model/CardinalityDto.java | 2 +- .../model/CardinalityInfiniteDto.java | 2 +- .../model/CardinalityIntegerDto.java | 2 +- .../generated/model/Concat200ResponseDto.java | 2 +- .../generated/model/Dot200ResponseDto.java | 2 +- .../generated/model/Empty200ResponseDto.java | 2 +- .../generated/model/ErrorResponse400Dto.java | 265 +++ .../generated/model/ErrorResponse401Dto.java | 255 +++ .../generated/model/ErrorResponse403Dto.java | 253 +++ .../api/generated/model/ErrorResponseDto.java | 4 +- .../generated/model/ExecutionOptionsDto.java | 2 +- .../model/GenerateStringsRequestDto.java | 2 +- .../model/GenerateStringsResponseDto.java | 2 +- .../generated/model/Length200ResponseDto.java | 2 +- .../api/generated/model/LengthDto.java | 2 +- .../generated/model/MultiTermsRequestDto.java | 2 +- .../api/generated/model/RepeatRequestDto.java | 2 +- .../generated/model/RequestOptionsDto.java | 2 +- .../generated/model/ResponseOptionsDto.java | 2 +- .../api/generated/model/StringDto.java | 2 +- .../model/Strings200ResponseDto.java | 2 +- .../api/generated/model/StringsDto.java | 2 +- .../api/generated/model/TermDto.java | 2 +- .../api/generated/model/TermFairDto.java | 2 +- .../api/generated/model/TermRegexDto.java | 2 +- .../api/generated/model/TermRequestDto.java | 2 +- .../generated/model/TwoTermsRequestDto.java | 2 +- 50 files changed, 2666 insertions(+), 44 deletions(-) create mode 100644 api/openapi.yaml create mode 100644 src/main/java/com/regexsolver/api/exceptions/AutomatonTooManyStatesException.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/RegexSyntaxException.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index bd78d14..360978f 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -23,6 +23,9 @@ src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java +src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java +src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..2c45269 --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,1801 @@ +openapi: 3.0.3 +info: + title: RegexSolver + version: 1.1.0 +servers: +- url: https://api.regexsolver.com/v1 +security: +- BearerAuth: [] +paths: + /analyze/cardinality: + post: + description: Compute how many strings the term matches. + operationId: cardinality + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: integer + value: 26 + schema: + $ref: "#/components/schemas/cardinality_200_response" + description: Cardinality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Cardinality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/dot: + post: + description: Build a Graphviz DOT representation of the term's automaton. + operationId: dot + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: string + value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ + 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ + \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ + 1\"];\n}" + schema: + $ref: "#/components/schemas/dot_200_response" + description: Graphviz DOT representation. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: GraphViz Dot + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty: + post: + description: Check if the term matches no strings. + operationId: empty + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty language result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Empty + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty_string: + post: + description: Check if the term matches only the empty string. + operationId: empty_string + requestBody: + content: + application/json: + example: + term: + type: regex + value: "" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty string only result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Empty String Only + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/total: + post: + description: Check if the term matches all the possible strings. + operationId: total + requestBody: + content: + application/json: + example: + term: + type: regex + value: .* + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Totality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Totality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/equivalent: + post: + description: Check if the two terms accept exactly the same language. + operationId: equivalent + requestBody: + content: + application/json: + example: + terms: + - type: regex + value: (abcd|abef) + - type: regex + value: ab(cd|ef) + schema: + $ref: "#/components/schemas/TwoTermsRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Language equivalence result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Equivalent + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/length: + post: + description: Compute the minimum and maximum length of strings matched by the + term. + operationId: length + requestBody: + content: + application/json: + example: + term: + type: regex + value: (abc)?d + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: length + min: 1 + max: 4 + schema: + $ref: "#/components/schemas/length_200_response" + description: Length bounds. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Length + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/pattern: + post: + description: Return a regular expression pattern that represents the term. + operationId: pattern + requestBody: + content: + application/json: + example: + term: + type: fair + value: "The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index 50d29c4..65fc6ad 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index d279928..74ed48f 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index e8bf0ef..544c26d 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index dd6b5b0..a74855c 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index ec2b0ef..ab47795 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index e6dd2e9..da58eaf 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index 69b2ece..ce3d203 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index 2381d9f..047fe3d 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index 5e3c41f..5487a47 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index 1513a7c..3ccf944 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index 2c74f21..a5dc7a1 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -21,6 +21,9 @@ import com.regexsolver.api.generated.model.Cardinality200ResponseDto; import com.regexsolver.api.generated.model.Dot200ResponseDto; import com.regexsolver.api.generated.model.Empty200ResponseDto; +import com.regexsolver.api.generated.model.ErrorResponse400Dto; +import com.regexsolver.api.generated.model.ErrorResponse401Dto; +import com.regexsolver.api.generated.model.ErrorResponse403Dto; import com.regexsolver.api.generated.model.ErrorResponseDto; import com.regexsolver.api.generated.model.Length200ResponseDto; import com.regexsolver.api.generated.model.TermRequestDto; @@ -53,7 +56,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index 30d0a8d..3767154 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -19,6 +19,9 @@ import com.regexsolver.api.generated.Pair; import com.regexsolver.api.generated.model.Concat200ResponseDto; +import com.regexsolver.api.generated.model.ErrorResponse400Dto; +import com.regexsolver.api.generated.model.ErrorResponse401Dto; +import com.regexsolver.api.generated.model.ErrorResponse403Dto; import com.regexsolver.api.generated.model.ErrorResponseDto; import com.regexsolver.api.generated.model.MultiTermsRequestDto; import com.regexsolver.api.generated.model.RepeatRequestDto; @@ -52,7 +55,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index 06b97f5..52a74d8 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -18,6 +18,9 @@ import com.regexsolver.api.generated.Configuration; import com.regexsolver.api.generated.Pair; +import com.regexsolver.api.generated.model.ErrorResponse400Dto; +import com.regexsolver.api.generated.model.ErrorResponse401Dto; +import com.regexsolver.api.generated.model.ErrorResponse403Dto; import com.regexsolver.api.generated.model.ErrorResponseDto; import com.regexsolver.api.generated.model.GenerateStringsRequestDto; import com.regexsolver.api.generated.model.Strings200ResponseDto; @@ -49,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index 59bab64..e05b48d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index 2b1aa26..c4cbfb7 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index c5c3cda..0fbdb4f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -37,7 +37,7 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index edcfeb0..40d7fe4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index 0312fb4..535fd0d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index aa5fe8c..c8e9f09 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index a64396f..c7068d9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index 0f3e015..47b90de 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -37,7 +37,7 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index e98c6b0..98bf895 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -37,7 +37,7 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index d10f255..5346296 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -37,7 +37,7 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java new file mode 100644 index 0000000..cb0eac2 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java @@ -0,0 +1,265 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * ErrorResponse400Dto + */ +@JsonPropertyOrder({ + ErrorResponse400Dto.JSON_PROPERTY_SUCCESS, + ErrorResponse400Dto.JSON_PROPERTY_ERROR, + ErrorResponse400Dto.JSON_PROPERTY_ERROR_CODE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ErrorResponse400Dto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_ERROR = "error"; + @jakarta.annotation.Nonnull + private String error; + + /** + * Gets or Sets errorCode + */ + public enum ErrorCodeEnum { + INVALID_JSON(String.valueOf("InvalidJson")), + + TOO_MANY_TERMS(String.valueOf("TooManyTerms")), + + TIMEOUT_TOO_LARGE(String.valueOf("TimeoutTooLarge")), + + TIMEOUT_EXCEEDED(String.valueOf("TimeoutExceeded")), + + INVALID_NUMBER_OF_STRINGS_TO_GENERATE(String.valueOf("InvalidNumberOfStringsToGenerate")), + + AUTOMATON_TOO_MANY_STATES(String.valueOf("AutomatonTooManyStates")), + + REGEX_SYNTAX_ERROR(String.valueOf("RegexSyntaxError")); + + private String value; + + ErrorCodeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ErrorCodeEnum fromValue(String value) { + for (ErrorCodeEnum b : ErrorCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; + @jakarta.annotation.Nullable + private ErrorCodeEnum errorCode; + + public ErrorResponse400Dto() { + } + + public ErrorResponse400Dto success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public ErrorResponse400Dto error(@jakarta.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Human readable error message. + * @return error + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setError(@jakarta.annotation.Nonnull String error) { + this.error = error; + } + + + public ErrorResponse400Dto errorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ErrorCodeEnum getErrorCode() { + return errorCode; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setErrorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + } + + + /** + * Return true if this ErrorResponse400 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse400Dto errorResponse400 = (ErrorResponse400Dto) o; + return Objects.equals(this.success, errorResponse400.success) && + Objects.equals(this.error, errorResponse400.error) && + Objects.equals(this.errorCode, errorResponse400.errorCode); + } + + @Override + public int hashCode() { + return Objects.hash(success, error, errorCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse400Dto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + // add `errorCode` to the URL query string + if (getErrorCode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serrorCode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getErrorCode())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java new file mode 100644 index 0000000..69439b5 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java @@ -0,0 +1,255 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * ErrorResponse401Dto + */ +@JsonPropertyOrder({ + ErrorResponse401Dto.JSON_PROPERTY_SUCCESS, + ErrorResponse401Dto.JSON_PROPERTY_ERROR, + ErrorResponse401Dto.JSON_PROPERTY_ERROR_CODE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ErrorResponse401Dto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_ERROR = "error"; + @jakarta.annotation.Nonnull + private String error; + + /** + * Gets or Sets errorCode + */ + public enum ErrorCodeEnum { + MISSING_OR_MALFORMED_TOKEN(String.valueOf("MissingOrMalformedToken")), + + INVALID_TOKEN(String.valueOf("InvalidToken")); + + private String value; + + ErrorCodeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ErrorCodeEnum fromValue(String value) { + for (ErrorCodeEnum b : ErrorCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; + @jakarta.annotation.Nullable + private ErrorCodeEnum errorCode; + + public ErrorResponse401Dto() { + } + + public ErrorResponse401Dto success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public ErrorResponse401Dto error(@jakarta.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Human readable error message. + * @return error + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setError(@jakarta.annotation.Nonnull String error) { + this.error = error; + } + + + public ErrorResponse401Dto errorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ErrorCodeEnum getErrorCode() { + return errorCode; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setErrorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + } + + + /** + * Return true if this ErrorResponse401 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse401Dto errorResponse401 = (ErrorResponse401Dto) o; + return Objects.equals(this.success, errorResponse401.success) && + Objects.equals(this.error, errorResponse401.error) && + Objects.equals(this.errorCode, errorResponse401.errorCode); + } + + @Override + public int hashCode() { + return Objects.hash(success, error, errorCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse401Dto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + // add `errorCode` to the URL query string + if (getErrorCode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serrorCode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getErrorCode())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java new file mode 100644 index 0000000..8629e7c --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java @@ -0,0 +1,253 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * ErrorResponse403Dto + */ +@JsonPropertyOrder({ + ErrorResponse403Dto.JSON_PROPERTY_SUCCESS, + ErrorResponse403Dto.JSON_PROPERTY_ERROR, + ErrorResponse403Dto.JSON_PROPERTY_ERROR_CODE +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class ErrorResponse403Dto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_ERROR = "error"; + @jakarta.annotation.Nonnull + private String error; + + /** + * Gets or Sets errorCode + */ + public enum ErrorCodeEnum { + QUOTA_EXCEEDED(String.valueOf("QuotaExceeded")); + + private String value; + + ErrorCodeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ErrorCodeEnum fromValue(String value) { + for (ErrorCodeEnum b : ErrorCodeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_ERROR_CODE = "errorCode"; + @jakarta.annotation.Nullable + private ErrorCodeEnum errorCode; + + public ErrorResponse403Dto() { + } + + public ErrorResponse403Dto success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public ErrorResponse403Dto error(@jakarta.annotation.Nonnull String error) { + this.error = error; + return this; + } + + /** + * Human readable error message. + * @return error + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getError() { + return error; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setError(@jakarta.annotation.Nonnull String error) { + this.error = error; + } + + + public ErrorResponse403Dto errorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get errorCode + * @return errorCode + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ErrorCodeEnum getErrorCode() { + return errorCode; + } + + + @JsonProperty(value = JSON_PROPERTY_ERROR_CODE, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setErrorCode(@jakarta.annotation.Nullable ErrorCodeEnum errorCode) { + this.errorCode = errorCode; + } + + + /** + * Return true if this ErrorResponse403 object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorResponse403Dto errorResponse403 = (ErrorResponse403Dto) o; + return Objects.equals(this.success, errorResponse403.success) && + Objects.equals(this.error, errorResponse403.error) && + Objects.equals(this.errorCode, errorResponse403.errorCode); + } + + @Override + public int hashCode() { + return Objects.hash(success, error, errorCode); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorResponse403Dto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `error` to the URL query string + if (getError() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serror%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getError())))); + } + + // add `errorCode` to the URL query string + if (getErrorCode() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%serrorCode%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getErrorCode())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index e60235f..24d681d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -30,14 +30,14 @@ import com.regexsolver.api.generated.ApiClient; /** - * Standard error payload returned when success is false. + * ErrorResponseDto */ @JsonPropertyOrder({ ErrorResponseDto.JSON_PROPERTY_SUCCESS, ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index 898a983..67120b7 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index 6228c2d..bf3df43 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -41,7 +41,7 @@ GenerateStringsRequestDto.JSON_PROPERTY_RETURN_STABLE_TERM, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index 71f98ca..995eaba 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -39,7 +39,7 @@ GenerateStringsResponseDto.JSON_PROPERTY_TERM, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index 0cc6720..f1c68bb 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -37,7 +37,7 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index bc1f2fd..a9e7787 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index bf40404..a68e245 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -40,7 +40,7 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index 87e071e..b2de958 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -40,7 +40,7 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index ecfef2b..456862e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -39,7 +39,7 @@ RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index 2717669..b597f37 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ResponseOptionsDto.JSON_PROPERTY_FORMAT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index df61c1d..add6f92 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index 806ea89..f1bb6d7 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -37,7 +37,7 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index bc5871b..83e08ab 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index 0b411e2..ae3a54d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -57,7 +57,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index 683f97a..bbf840c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -36,7 +36,7 @@ TermFairDto.JSON_PROPERTY_TYPE, TermFairDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index ae73e3e..794ab36 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index f07d5ab..c3a3cd9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -38,7 +38,7 @@ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index 81d6ae4..b4f3de8 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -40,7 +40,7 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-06T14:52:22.603140815+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull From 63df926eeda8add0f5765b16cfb9c2672167afdd Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sun, 14 Jun 2026 21:54:18 +0200 Subject: [PATCH 16/24] Update endpoints --- .openapi-generator/FILES | 2 + README.md | 2 + api/openapi.yaml | 1801 ----------------- .../api/AsyncRegexSolverClient.java | 127 +- .../com/regexsolver/api/OperationOptions.java | 15 + .../regexsolver/api/RegexSolverClient.java | 264 ++- src/main/java/com/regexsolver/api/Term.java | 30 +- .../regexsolver/api/generated/ApiClient.java | 2 +- .../api/generated/ApiException.java | 2 +- .../api/generated/ApiResponse.java | 2 +- .../api/generated/Configuration.java | 2 +- .../com/regexsolver/api/generated/JSON.java | 4 +- .../com/regexsolver/api/generated/Pair.java | 2 +- .../api/generated/RFC3339DateFormat.java | 2 +- .../generated/RFC3339InstantDeserializer.java | 2 +- .../api/generated/RFC3339JavaTimeModule.java | 2 +- .../api/generated/ServerConfiguration.java | 2 +- .../api/generated/ServerVariable.java | 2 +- .../api/generated/api/AnalyzeApi.java | 142 +- .../api/generated/api/ComputeApi.java | 174 +- .../api/generated/api/GenerateApi.java | 10 +- .../model/AbstractOpenApiSchema.java | 2 +- .../api/generated/model/BooleanDto.java | 2 +- .../model/Cardinality200ResponseDto.java | 2 +- .../model/CardinalityBigIntegerDto.java | 2 +- .../api/generated/model/CardinalityDto.java | 2 +- .../model/CardinalityInfiniteDto.java | 2 +- .../model/CardinalityIntegerDto.java | 2 +- .../generated/model/Concat200ResponseDto.java | 2 +- .../generated/model/Dot200ResponseDto.java | 2 +- .../generated/model/Empty200ResponseDto.java | 2 +- .../generated/model/ErrorResponse400Dto.java | 2 +- .../generated/model/ErrorResponse401Dto.java | 2 +- .../generated/model/ErrorResponse403Dto.java | 2 +- .../api/generated/model/ErrorResponseDto.java | 2 +- .../generated/model/ExecutionOptionsDto.java | 2 +- .../model/FairResponseOptionsDto.java | 148 ++ .../model/GenerateStringsRequestDto.java | 42 +- .../model/GenerateStringsResponseDto.java | 43 +- .../generated/model/Length200ResponseDto.java | 2 +- .../api/generated/model/LengthDto.java | 2 +- .../generated/model/MultiTermsRequestDto.java | 2 +- .../api/generated/model/RepeatRequestDto.java | 6 +- .../generated/model/RequestOptionsDto.java | 4 +- .../generated/model/ResponseOptionsDto.java | 45 +- .../api/generated/model/StringDto.java | 2 +- .../model/Strings200ResponseDto.java | 2 +- .../api/generated/model/StringsDto.java | 2 +- .../api/generated/model/TermDto.java | 3 +- .../api/generated/model/TermFairDto.java | 43 +- .../generated/model/TermFairMetadataDto.java | 148 ++ .../api/generated/model/TermRegexDto.java | 2 +- .../api/generated/model/TermRequestDto.java | 4 +- .../generated/model/TwoTermsRequestDto.java | 2 +- .../api/AsyncRegexSolverClientTest.java | 37 + .../java/com/regexsolver/api/ModelsTest.java | 10 +- .../api/RegexSolverClientTest.java | 29 + 57 files changed, 1176 insertions(+), 2023 deletions(-) delete mode 100644 api/openapi.yaml create mode 100644 src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 360978f..c4cd2e2 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -28,6 +28,7 @@ src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -41,6 +42,7 @@ src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/StringsDto.java src/main/java/com/regexsolver/api/generated/model/TermDto.java src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java diff --git a/README.md b/README.md index 050da3b..44e1ffe 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,7 @@ Timeout is best effort. The exact time is not guaranteed. | `client.isEmpty(term, options?)` | `boolean` | `true` if the term matches no string. | | `client.isEmptyString(term, options?)` | `boolean` | `true` if the term matches only the empty string. | | `client.isTotal(term, options?)` | `boolean` | `true` if the term matches all possible strings. | +| `client.isDeterministic(term, options?)` | `boolean` | `true` if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated `generateStrings()` calls; call `determinize()` first if this is `false`. | | `client.subset(term1, term2, options?)` | `boolean` | `true` if every string matched by `term1` is also matched by `term2`. | *Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* @@ -158,6 +159,7 @@ Timeout is best effort. The exact time is not guaranteed. | -------- | ------- | ------- | | `client.complement(term, options?)` | `Term` | Computes the complement of the given term. | | `client.concat(term1, term2, ..., options?)` | `Term` | Concatenates multiple terms in order. | +| `client.determinize(term, options?)` | `Term` | Computes a deterministic FAIR for the given term, suitable for consistent pagination with `generateStrings()`. | | `client.difference(term1, term2, options?)` | `Term` | Computes the difference `term1 - term2`. | | `client.intersection(term1, term2, ..., options?)` | `Term` | Computes the intersection of the given terms. | | `client.repeat(term, min, max, options?)` | `Term` | Computes the repetition of the term between `min` and `max` times. | diff --git a/api/openapi.yaml b/api/openapi.yaml deleted file mode 100644 index 2c45269..0000000 --- a/api/openapi.yaml +++ /dev/null @@ -1,1801 +0,0 @@ -openapi: 3.0.3 -info: - title: RegexSolver - version: 1.1.0 -servers: -- url: https://api.regexsolver.com/v1 -security: -- BearerAuth: [] -paths: - /analyze/cardinality: - post: - description: Compute how many strings the term matches. - operationId: cardinality - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: integer - value: 26 - schema: - $ref: "#/components/schemas/cardinality_200_response" - description: Cardinality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Cardinality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/dot: - post: - description: Build a Graphviz DOT representation of the term's automaton. - operationId: dot - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: string - value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ - 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ - \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ - 1\"];\n}" - schema: - $ref: "#/components/schemas/dot_200_response" - description: Graphviz DOT representation. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: GraphViz Dot - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty: - post: - description: Check if the term matches no strings. - operationId: empty - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty language result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Empty - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty_string: - post: - description: Check if the term matches only the empty string. - operationId: empty_string - requestBody: - content: - application/json: - example: - term: - type: regex - value: "" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty string only result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Empty String Only - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/total: - post: - description: Check if the term matches all the possible strings. - operationId: total - requestBody: - content: - application/json: - example: - term: - type: regex - value: .* - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Totality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Totality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/equivalent: - post: - description: Check if the two terms accept exactly the same language. - operationId: equivalent - requestBody: - content: - application/json: - example: - terms: - - type: regex - value: (abcd|abef) - - type: regex - value: ab(cd|ef) - schema: - $ref: "#/components/schemas/TwoTermsRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Language equivalence result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Equivalent - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/length: - post: - description: Compute the minimum and maximum length of strings matched by the - term. - operationId: length - requestBody: - content: - application/json: - example: - term: - type: regex - value: (abc)?d - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: length - min: 1 - max: 4 - schema: - $ref: "#/components/schemas/length_200_response" - description: Length bounds. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Length - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/pattern: - post: - description: Return a regular expression pattern that represents the term. - operationId: pattern - requestBody: - content: - application/json: - example: - term: - type: fair - value: " dto.execution(new ExecutionOptionsDto().timeout(timeout)) ); - options - .getResponseFormat() - .ifPresent(format -> - dto.response( - new ResponseOptionsDto().format(format.toDto()) - ) - ); + + Optional responseFormat = options.getResponseFormat(); + Optional deterministic = options.getDeterministic(); + + if (deterministic.isPresent() && responseFormat.isPresent()) { + if (responseFormat.get() != ResponseFormat.FAIR) { + throw new IllegalArgumentException( + "deterministic can only be used with responseFormat=ResponseFormat.FAIR, got " + + responseFormat.get() + ); + } + } + + if (responseFormat.isPresent() || deterministic.isPresent()) { + ResponseOptionsDto responseOptions = new ResponseOptionsDto(); + responseFormat.ifPresent(format -> responseOptions.format(format.toDto())); + deterministic.ifPresent(value -> { + responseOptions.fair(new FairResponseOptionsDto().deterministic(value)); + if (responseFormat.isEmpty()) { + responseOptions.format(ResponseFormat.FAIR.toDto()); + } + }); + dto.response(responseOptions); + } } return dto; } @@ -473,6 +491,49 @@ public CompletableFuture isTotal( ); } + /** + * Checks if the term's automaton is deterministic asynchronously. + * Only a deterministic FAIR guarantees consistent string ordering across paginated generateStrings() calls; call determinize() first if this is false. + * + * @param term The term to analyze. + * @return A CompletableFuture containing true if the term's automaton is deterministic. + */ + public CompletableFuture isDeterministic(Term term) { + return isDeterministic(term, (OperationOptions) null); + } + + /** + * Checks if the term's automaton is deterministic asynchronously. + * Only a deterministic FAIR guarantees consistent string ordering across paginated generateStrings() calls; call determinize() first if this is false. + * + * @param term The term to analyze. + * @param options Options for the operation. + * @return A CompletableFuture containing true if the term's automaton is deterministic. + */ + public CompletableFuture isDeterministic( + Term term, + OperationOptions options + ) { + if (!(term instanceof Term.FairTerm)) { + return CompletableFuture.completedFuture(false); + } + Term.FairTerm fairTerm = (Term.FairTerm) term; + Optional cached = fairTerm.getCachedDeterministic(); + if (cached.isPresent()) { + return CompletableFuture.completedFuture(cached.get()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(options)); + return executeWithRetry(() -> analyzeApi.deterministic(request)).thenApply( + resp -> { + boolean val = resp.getData().getValue(); + fairTerm.setCachedDeterministic(Optional.of(val)); + return val; + } + ); + } + /** * Returns a regular expression pattern that represents the term asynchronously. * @@ -831,6 +892,41 @@ public CompletableFuture repeat( ); } + /** + * Computes a deterministic FAIR automaton from the given term asynchronously. + * A deterministic FAIR guarantees consistent string ordering across paginated + * generateStrings() calls. Use this when isDeterministic() is false + * before calling generateStrings() with an offset. + * + * @param term The term to determinize. + * @return A CompletableFuture containing a deterministic FAIR. + */ + public CompletableFuture determinize(Term term) { + return determinize(term, (OperationOptions) null); + } + + /** + * Computes a deterministic FAIR automaton from the given term asynchronously. + * A deterministic FAIR guarantees consistent string ordering across paginated + * generateStrings() calls. Use this when isDeterministic() is false + * before calling generateStrings() with an offset. + * + * @param term The term to determinize. + * @param options Options for the operation. + * @return A CompletableFuture containing a deterministic FAIR. + */ + public CompletableFuture determinize( + Term term, + OperationOptions options + ) { + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(options)); + return executeWithRetry(() -> computeApi.determinize(request)).thenApply( + resp -> Term.fromDto(resp.getData()) + ); + } + // --- GENERATE OPERATIONS --- /** @@ -864,27 +960,14 @@ public CompletableFuture> generateStrings( int offset, OperationOptions options ) { - Term termToUse = - term.getCachedStableTerm() != null - ? term.getCachedStableTerm() - : term; - boolean returnStableTerm = term.getCachedStableTerm() == null; - GenerateStringsRequestDto request = new GenerateStringsRequestDto() - .term(termToUse.toDto()) + .term(term.toDto()) .limit(limit) .offset(offset) - .returnStableTerm(returnStableTerm) .options(buildOptions(options)); return executeWithRetry(() -> generateApi.strings(request)).thenApply( - resp -> { - GenerateStringsResponseDto data = resp.getData(); - if (data.getTerm() != null) { - term.setCachedStableTerm(Term.fromDto(data.getTerm())); - } - return data.getStrings().getValue(); - } + resp -> resp.getData().getStrings().getValue() ); } } diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java index df906bd..3846044 100644 --- a/src/main/java/com/regexsolver/api/OperationOptions.java +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -9,6 +9,7 @@ public class OperationOptions { private Integer executionTimeout; private ResponseFormat responseFormat; + private Boolean deterministic; public OperationOptions() {} @@ -34,6 +35,16 @@ public OperationOptions responseFormat(ResponseFormat format) { return this; } + /** + * When true, guarantees the returned FAIR encodes a deterministic automaton. + * Only valid with responseFormat = ResponseFormat.FAIR or when responseFormat is + * unset (in which case it defaults to ResponseFormat.FAIR). Throws otherwise. + */ + public OperationOptions deterministic(Boolean deterministic) { + this.deterministic = deterministic; + return this; + } + public Optional getExecutionTimeout() { return Optional.ofNullable(executionTimeout); } @@ -41,4 +52,8 @@ public Optional getExecutionTimeout() { public Optional getResponseFormat() { return Optional.ofNullable(responseFormat); } + + public Optional getDeterministic() { + return Optional.ofNullable(deterministic); + } } diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 559946f..6835d88 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -59,7 +59,15 @@ public Cardinality getCardinality(Term term) { * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public Cardinality getCardinality(Term term, OperationOptions options) { - return asyncClient.getCardinality(term, options).join(); + try { + return asyncClient.getCardinality(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -80,7 +88,15 @@ public Length getLength(Term term) { * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public Length getLength(Term term, OperationOptions options) { - return asyncClient.getLength(term, options).join(); + try { + return asyncClient.getLength(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -101,7 +117,15 @@ public boolean isEmpty(Term term) { * @return true if the language is completely empty, false otherwise. */ public boolean isEmpty(Term term, OperationOptions options) { - return asyncClient.isEmpty(term, options).join(); + try { + return asyncClient.isEmpty(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -122,7 +146,15 @@ public boolean isEmptyString(Term term) { * @return true if the term strictly matches the empty string ("") and nothing else. */ public boolean isEmptyString(Term term, OperationOptions options) { - return asyncClient.isEmptyString(term, options).join(); + try { + return asyncClient.isEmptyString(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -143,7 +175,46 @@ public boolean isTotal(Term term) { * @return true if the term matches every possible string. */ public boolean isTotal(Term term, OperationOptions options) { - return asyncClient.isTotal(term, options).join(); + try { + return asyncClient.isTotal(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } + } + + /** + * Checks if the term's automaton is deterministic. + * Only a deterministic FAIR guarantees consistent string ordering across paginated generateStrings() calls; call determinize() first if this is false. + * + * @param term The term to analyze. + * @return true if the term's automaton is deterministic. + */ + public boolean isDeterministic(Term term) { + return isDeterministic(term, (OperationOptions) null); + } + + /** + * Checks if the term's automaton is deterministic. + * Only a deterministic FAIR guarantees consistent string ordering across paginated generateStrings() calls; call determinize() first if this is false. + * + * @param term The term to analyze. + * @param options Options for the operation. + * @return true if the term's automaton is deterministic. + */ + public boolean isDeterministic(Term term, OperationOptions options) { + try { + return asyncClient.isDeterministic(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -164,7 +235,15 @@ public String getPattern(Term term) { * @return A valid regular expression string representing the language. */ public String getPattern(Term term, OperationOptions options) { - return asyncClient.getPattern(term, options).join(); + try { + return asyncClient.getPattern(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -185,7 +264,15 @@ public String getDot(Term term) { * @return The raw DOT syntax for Graphviz compilation. */ public String getDot(Term term, OperationOptions options) { - return asyncClient.getDot(term, options).join(); + try { + return asyncClient.getDot(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -207,8 +294,20 @@ public boolean equivalent(Term term1, Term term2) { * @param options Options for the operation. * @return true if they are entirely equivalent, false otherwise. */ - public boolean equivalent(Term term1, Term term2, OperationOptions options) { - return asyncClient.equivalent(term1, term2, options).join(); + public boolean equivalent( + Term term1, + Term term2, + OperationOptions options + ) { + try { + return asyncClient.equivalent(term1, term2, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -235,7 +334,15 @@ public boolean subset( Term superset, OperationOptions options ) { - return asyncClient.subset(subset, superset, options).join(); + try { + return asyncClient.subset(subset, superset, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } // --- COMPUTE OPERATIONS --- @@ -247,7 +354,15 @@ public boolean subset( * @return A newly computed concatenated term. */ public Term concat(Term... terms) { - return asyncClient.concat(terms).join(); + try { + return asyncClient.concat(terms).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -268,7 +383,15 @@ public Term concat(List terms) { * @return A newly computed concatenated term. */ public Term concat(List terms, OperationOptions options) { - return asyncClient.concat(terms, options).join(); + try { + return asyncClient.concat(terms, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -278,7 +401,15 @@ public Term concat(List terms, OperationOptions options) { * @return A term representing only strings matched by ALL provided terms. */ public Term intersection(Term... terms) { - return asyncClient.intersection(terms).join(); + try { + return asyncClient.intersection(terms).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -299,7 +430,15 @@ public Term intersection(List terms) { * @return A term representing only strings matched by ALL provided terms. */ public Term intersection(List terms, OperationOptions options) { - return asyncClient.intersection(terms, options).join(); + try { + return asyncClient.intersection(terms, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -309,7 +448,15 @@ public Term intersection(List terms, OperationOptions options) { * @return A term representing strings matched by ANY of the provided terms. */ public Term union(Term... terms) { - return asyncClient.union(terms).join(); + try { + return asyncClient.union(terms).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -330,7 +477,15 @@ public Term union(List terms) { * @return A term representing strings matched by ANY of the provided terms. */ public Term union(List terms, OperationOptions options) { - return asyncClient.union(terms, options).join(); + try { + return asyncClient.union(terms, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -353,7 +508,15 @@ public Term difference(Term base, Term excluded) { * @return A computed difference term. */ public Term difference(Term base, Term excluded, OperationOptions options) { - return asyncClient.difference(base, excluded, options).join(); + try { + return asyncClient.difference(base, excluded, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -374,7 +537,15 @@ public Term complement(Term term) { * @return The complemented term. */ public Term complement(Term term, OperationOptions options) { - return asyncClient.complement(term, options).join(); + try { + return asyncClient.complement(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } /** @@ -404,7 +575,50 @@ public Term repeat( Integer max, OperationOptions options ) { - return asyncClient.repeat(term, min, max, options).join(); + try { + return asyncClient.repeat(term, min, max, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } + } + + /** + * Computes a deterministic FAIR automaton from the given term. + * A deterministic FAIR guarantees consistent string ordering across paginated + * generateStrings() calls. Use this when isDeterministic() is false + * before calling generateStrings() with an offset. + * + * @param term The term to determinize. + * @return A deterministic FAIR. + */ + public Term determinize(Term term) { + return determinize(term, (OperationOptions) null); + } + + /** + * Computes a deterministic FAIR automaton from the given term. + * A deterministic FAIR guarantees consistent string ordering across paginated + * generateStrings() calls. Use this when isDeterministic() is false + * before calling generateStrings() with an offset. + * + * @param term The term to determinize. + * @param options Options for the operation. + * @return A deterministic FAIR. + */ + public Term determinize(Term term, OperationOptions options) { + try { + return asyncClient.determinize(term, options).join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } // --- GENERATE OPERATIONS --- @@ -436,6 +650,16 @@ public List generateStrings( int offset, OperationOptions options ) { - return asyncClient.generateStrings(term, limit, offset, options).join(); + try { + return asyncClient + .generateStrings(term, limit, offset, options) + .join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } } } diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index d3cf665..d057aaf 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -22,7 +22,6 @@ public abstract class Term { private Boolean total; protected String pattern; private String dot; - private Term stableTerm; private Pattern compiledRegex; @@ -41,7 +40,7 @@ public static Term regex(String pattern) { } public static Term fair(String payload) { - return new FairTerm(payload); + return new FairTerm(payload, Optional.empty()); } // --- Shared Behavior --- @@ -61,7 +60,7 @@ void setPropertiesMixin(TermPropertiesMixin propertiesMixin) { * @param str The string to test against the term. * @return True if matches, false if not. Throws if pattern is not set. */ - public boolean isMatch(String str) { + public boolean matches(String str) { Optional patternOpt = getPattern(); if (patternOpt.isEmpty()) { throw new IllegalStateException( @@ -160,14 +159,6 @@ void setCachedDot(String dot) { this.dot = dot; } - Term getCachedStableTerm() { - return stableTerm; - } - - void setCachedStableTerm(Term stableTerm) { - this.stableTerm = stableTerm; - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -199,9 +190,7 @@ public Optional getPattern() { @Override public Optional getFair() { - return Optional.ofNullable(getCachedStableTerm()).map(t -> - t.getFair().orElse(null) - ); + return Optional.empty(); } @Override @@ -221,8 +210,19 @@ public String serialize() { public static final class FairTerm extends Term { - FairTerm(String value) { + private Optional deterministic = Optional.empty(); + + FairTerm(String value, Optional deterministic) { super(value); + this.deterministic = deterministic; + } + + Optional getCachedDeterministic() { + return this.deterministic; + } + + void setCachedDeterministic(Optional deterministic) { + this.deterministic = deterministic; } @Override diff --git a/src/main/java/com/regexsolver/api/generated/ApiClient.java b/src/main/java/com/regexsolver/api/generated/ApiClient.java index 62d308c..90b95bd 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiClient.java +++ b/src/main/java/com/regexsolver/api/generated/ApiClient.java @@ -53,7 +53,7 @@ *

The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index 65fc6ad..7b10ee8 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index 74ed48f..a86fb76 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index 544c26d..16bcbc4 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index a74855c..04718a3 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index ab47795..701df68 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index da58eaf..57cd5e8 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index ce3d203..87114ae 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index 047fe3d..a96680d 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index 5487a47..b1620c4 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index 3ccf944..699e76e 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index a5dc7a1..1b7d276 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -307,7 +307,139 @@ private HttpRequest.Builder cardinalityRequestBuilder(@jakarta.annotation.Nonnul } /** - * GraphViz Dot + * Deterministic + * Check if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated /generate/strings requests; call /compute/determinize first if this is false. + * @param termRequestDto (required) + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deterministic(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return deterministic(termRequestDto, null); + } + + /** + * Deterministic + * Check if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated /generate/strings requests; call /compute/determinize first if this is false. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Empty200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture deterministic(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return deterministicWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Deterministic + * Check if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated /generate/strings requests; call /compute/determinize first if this is false. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deterministicWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return deterministicWithHttpInfo(termRequestDto, null); + } + + /** + * Deterministic + * Check if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated /generate/strings requests; call /compute/determinize first if this is false. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Empty200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> deterministicWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = deterministicRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("deterministic", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Empty200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder deterministicRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling deterministic"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/analyze/deterministic"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + + /** + * Graphviz DOT * Build a Graphviz DOT representation of the term's automaton. * @param termRequestDto (required) * @return CompletableFuture<Dot200ResponseDto> @@ -318,7 +450,7 @@ public CompletableFuture dot(@jakarta.annotation.Nonnull Term } /** - * GraphViz Dot + * Graphviz DOT * Build a Graphviz DOT representation of the term's automaton. * @param termRequestDto (required) * @param headers Optional headers to include in the request @@ -336,7 +468,7 @@ public CompletableFuture dot(@jakarta.annotation.Nonnull Term } /** - * GraphViz Dot + * Graphviz DOT * Build a Graphviz DOT representation of the term's automaton. * @param termRequestDto (required) * @return CompletableFuture<ApiResponse<Dot200ResponseDto>> @@ -347,7 +479,7 @@ public CompletableFuture> dotWithHttpInfo(@jakart } /** - * GraphViz Dot + * Graphviz DOT * Build a Graphviz DOT representation of the term's automaton. * @param termRequestDto (required) * @param headers Optional headers to include in the request diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index 3767154..5e5f504 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -55,7 +55,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -175,7 +175,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx /** * Complement - * Computes the complement of the given term. + * Compute the complement of the given term. * @param termRequestDto (required) * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call @@ -186,7 +186,7 @@ public CompletableFuture complement(@jakarta.annotation.No /** * Complement - * Computes the complement of the given term. + * Compute the complement of the given term. * @param termRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Concat200ResponseDto> @@ -204,7 +204,7 @@ public CompletableFuture complement(@jakarta.annotation.No /** * Complement - * Computes the complement of the given term. + * Compute the complement of the given term. * @param termRequestDto (required) * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call @@ -215,7 +215,7 @@ public CompletableFuture> complementWithHttpIn /** * Complement - * Computes the complement of the given term. + * Compute the complement of the given term. * @param termRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> @@ -437,9 +437,141 @@ private HttpRequest.Builder concatRequestBuilder(@jakarta.annotation.Nonnull Mul return localVarRequestBuilder; } + /** + * Determinize + * Compute a deterministic FAIR. + * @param termRequestDto (required) + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture determinize(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return determinize(termRequestDto, null); + } + + /** + * Determinize + * Compute a deterministic FAIR. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<Concat200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture determinize(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + return determinizeWithHttpInfo(termRequestDto, headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Determinize + * Compute a deterministic FAIR. + * @param termRequestDto (required) + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> determinizeWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto) throws ApiException { + return determinizeWithHttpInfo(termRequestDto, null); + } + + /** + * Determinize + * Compute a deterministic FAIR. + * @param termRequestDto (required) + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> determinizeWithHttpInfo(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = determinizeRequestBuilder(termRequestDto, headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("determinize", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Concat200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder determinizeRequestBuilder(@jakarta.annotation.Nonnull TermRequestDto termRequestDto, Map headers) throws ApiException { + // verify the required parameter 'termRequestDto' is set + if (termRequestDto == null) { + throw new ApiException(400, "Missing the required parameter 'termRequestDto' when calling determinize"); + } + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/compute/determinize"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Content-Type", "application/json"); + localVarRequestBuilder.header("Accept", "application/json"); + + try { + byte[] localVarPostBody = memberVarObjectMapper.writeValueAsBytes(termRequestDto); + localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.ofByteArray(localVarPostBody)); + } catch (IOException e) { + throw new ApiException(e); + } + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + /** * Difference - * Computes the difference between the two provided terms. + * Compute the difference between the two given terms. * @param twoTermsRequestDto (required) * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call @@ -450,7 +582,7 @@ public CompletableFuture difference(@jakarta.annotation.No /** * Difference - * Computes the difference between the two provided terms. + * Compute the difference between the two given terms. * @param twoTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Concat200ResponseDto> @@ -468,7 +600,7 @@ public CompletableFuture difference(@jakarta.annotation.No /** * Difference - * Computes the difference between the two provided terms. + * Compute the difference between the two given terms. * @param twoTermsRequestDto (required) * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call @@ -479,7 +611,7 @@ public CompletableFuture> differenceWithHttpIn /** * Difference - * Computes the difference between the two provided terms. + * Compute the difference between the two given terms. * @param twoTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> @@ -571,7 +703,7 @@ private HttpRequest.Builder differenceRequestBuilder(@jakarta.annotation.Nonnull /** * Intersection - * Computes the intersection of the given terms. + * Compute the intersection of the given terms. * @param multiTermsRequestDto (required) * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call @@ -582,7 +714,7 @@ public CompletableFuture intersection(@jakarta.annotation. /** * Intersection - * Computes the intersection of the given terms. + * Compute the intersection of the given terms. * @param multiTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Concat200ResponseDto> @@ -600,7 +732,7 @@ public CompletableFuture intersection(@jakarta.annotation. /** * Intersection - * Computes the intersection of the given terms. + * Compute the intersection of the given terms. * @param multiTermsRequestDto (required) * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call @@ -611,7 +743,7 @@ public CompletableFuture> intersectionWithHttp /** * Intersection - * Computes the intersection of the given terms. + * Compute the intersection of the given terms. * @param multiTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> @@ -703,7 +835,7 @@ private HttpRequest.Builder intersectionRequestBuilder(@jakarta.annotation.Nonnu /** * Repeat - * Repeat a term between 'min' and 'max' times. + * Repeat a term between `min` and `max` times. * @param repeatRequestDto (required) * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call @@ -714,7 +846,7 @@ public CompletableFuture repeat(@jakarta.annotation.Nonnul /** * Repeat - * Repeat a term between 'min' and 'max' times. + * Repeat a term between `min` and `max` times. * @param repeatRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Concat200ResponseDto> @@ -732,7 +864,7 @@ public CompletableFuture repeat(@jakarta.annotation.Nonnul /** * Repeat - * Repeat a term between 'min' and 'max' times. + * Repeat a term between `min` and `max` times. * @param repeatRequestDto (required) * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call @@ -743,7 +875,7 @@ public CompletableFuture> repeatWithHttpInfo(@ /** * Repeat - * Repeat a term between 'min' and 'max' times. + * Repeat a term between `min` and `max` times. * @param repeatRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> @@ -835,7 +967,7 @@ private HttpRequest.Builder repeatRequestBuilder(@jakarta.annotation.Nonnull Rep /** * Union - * Computes the union of the given terms. + * Compute the union of the given terms. * @param multiTermsRequestDto (required) * @return CompletableFuture<Concat200ResponseDto> * @throws ApiException if fails to make API call @@ -846,7 +978,7 @@ public CompletableFuture union(@jakarta.annotation.Nonnull /** * Union - * Computes the union of the given terms. + * Compute the union of the given terms. * @param multiTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Concat200ResponseDto> @@ -864,7 +996,7 @@ public CompletableFuture union(@jakarta.annotation.Nonnull /** * Union - * Computes the union of the given terms. + * Compute the union of the given terms. * @param multiTermsRequestDto (required) * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> * @throws ApiException if fails to make API call @@ -875,7 +1007,7 @@ public CompletableFuture> unionWithHttpInfo(@j /** * Union - * Computes the union of the given terms. + * Compute the union of the given terms. * @param multiTermsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Concat200ResponseDto>> diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index 52a74d8..b8ddcec 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -172,7 +172,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx /** * Strings - * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @return CompletableFuture<Strings200ResponseDto> * @throws ApiException if fails to make API call @@ -183,7 +183,7 @@ public CompletableFuture strings(@jakarta.annotation.Nonn /** * Strings - * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Strings200ResponseDto> @@ -201,7 +201,7 @@ public CompletableFuture strings(@jakarta.annotation.Nonn /** * Strings - * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> * @throws ApiException if fails to make API call @@ -212,7 +212,7 @@ public CompletableFuture> stringsWithHttpInfo /** * Strings - * Generates up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index e05b48d..9ddf06a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index c4cbfb7..78a1586 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index 0fbdb4f..5283fa2 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -37,7 +37,7 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index 40d7fe4..cafe6ca 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index 535fd0d..9085c55 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index c8e9f09..e6c42a5 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index c7068d9..06af9f9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index 47b90de..6a672de 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -37,7 +37,7 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index 98bf895..c461c65 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -37,7 +37,7 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index 5346296..f0237c9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -37,7 +37,7 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java index cb0eac2..7629d6f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java @@ -37,7 +37,7 @@ ErrorResponse400Dto.JSON_PROPERTY_ERROR, ErrorResponse400Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse400Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java index 69439b5..a1b84c4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java @@ -37,7 +37,7 @@ ErrorResponse401Dto.JSON_PROPERTY_ERROR, ErrorResponse401Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse401Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java index 8629e7c..0a9eaae 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java @@ -37,7 +37,7 @@ ErrorResponse403Dto.JSON_PROPERTY_ERROR, ErrorResponse403Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse403Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index 24d681d..781161f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -37,7 +37,7 @@ ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index 67120b7..e025c77 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java new file mode 100644 index 0000000..94fe7ab --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java @@ -0,0 +1,148 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Options controlling the FAIR output. Only applied when response format is \"fair\". + */ +@JsonPropertyOrder({ + FairResponseOptionsDto.JSON_PROPERTY_DETERMINISTIC +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class FairResponseOptionsDto { + public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; + @jakarta.annotation.Nullable + private Boolean deterministic; + + public FairResponseOptionsDto() { + } + + public FairResponseOptionsDto deterministic(@jakarta.annotation.Nullable Boolean deterministic) { + this.deterministic = deterministic; + return this; + } + + /** + * When true, the returned FAIR is guaranteed to be a deterministic automaton, suitable for consistent pagination with /generate/strings. + * @return deterministic + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DETERMINISTIC, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeterministic() { + return deterministic; + } + + + @JsonProperty(value = JSON_PROPERTY_DETERMINISTIC, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeterministic(@jakarta.annotation.Nullable Boolean deterministic) { + this.deterministic = deterministic; + } + + + /** + * Return true if this FairResponseOptions object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FairResponseOptionsDto fairResponseOptions = (FairResponseOptionsDto) o; + return Objects.equals(this.deterministic, fairResponseOptions.deterministic); + } + + @Override + public int hashCode() { + return Objects.hash(deterministic); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FairResponseOptionsDto {\n"); + sb.append(" deterministic: ").append(toIndentedString(deterministic)).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 `deterministic` to the URL query string + if (getDeterministic() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdeterministic%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDeterministic())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index bf3df43..5dd5b62 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -32,16 +32,15 @@ import com.regexsolver.api.generated.ApiClient; /** - * Request to generate up to 'limit' distinct strings matched by 'term', skipping the first 'offset' strings. + * Request to generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. For consistent pagination, `term` should be deterministic. */ @JsonPropertyOrder({ GenerateStringsRequestDto.JSON_PROPERTY_TERM, GenerateStringsRequestDto.JSON_PROPERTY_LIMIT, GenerateStringsRequestDto.JSON_PROPERTY_OFFSET, - GenerateStringsRequestDto.JSON_PROPERTY_RETURN_STABLE_TERM, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull @@ -55,10 +54,6 @@ public class GenerateStringsRequestDto { @jakarta.annotation.Nonnull private Integer offset; - public static final String JSON_PROPERTY_RETURN_STABLE_TERM = "returnStableTerm"; - @jakarta.annotation.Nullable - private Boolean returnStableTerm = false; - public static final String JSON_PROPERTY_OPTIONS = "options"; @jakarta.annotation.Nullable private RequestOptionsDto options; @@ -141,30 +136,6 @@ public void setOffset(@jakarta.annotation.Nonnull Integer offset) { } - public GenerateStringsRequestDto returnStableTerm(@jakarta.annotation.Nullable Boolean returnStableTerm) { - this.returnStableTerm = returnStableTerm; - return this; - } - - /** - * If set to true, a stable term is returned. This term can be reused in subsequent calls to guarantee no strings are repeated. If the provided term is already stable, it will not be returned. - * @return returnStableTerm - */ - @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public Boolean getReturnStableTerm() { - return returnStableTerm; - } - - - @JsonProperty(value = JSON_PROPERTY_RETURN_STABLE_TERM, required = false) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setReturnStableTerm(@jakarta.annotation.Nullable Boolean returnStableTerm) { - this.returnStableTerm = returnStableTerm; - } - - public GenerateStringsRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; @@ -204,13 +175,12 @@ public boolean equals(Object o) { return Objects.equals(this.term, generateStringsRequest.term) && Objects.equals(this.limit, generateStringsRequest.limit) && Objects.equals(this.offset, generateStringsRequest.offset) && - Objects.equals(this.returnStableTerm, generateStringsRequest.returnStableTerm) && Objects.equals(this.options, generateStringsRequest.options); } @Override public int hashCode() { - return Objects.hash(term, limit, offset, returnStableTerm, options); + return Objects.hash(term, limit, offset, options); } @Override @@ -220,7 +190,6 @@ public String toString() { sb.append(" term: ").append(toIndentedString(term)).append("\n"); sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); - sb.append(" returnStableTerm: ").append(toIndentedString(returnStableTerm)).append("\n"); sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append("}"); return sb.toString(); @@ -281,11 +250,6 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%soffset%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOffset())))); } - // add `returnStableTerm` to the URL query string - if (getReturnStableTerm() != null) { - joiner.add(String.format(java.util.Locale.ROOT, "%sreturnStableTerm%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getReturnStableTerm())))); - } - // add `options` to the URL query string if (getOptions() != null) { joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index 995eaba..c218ba1 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -25,21 +25,19 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import com.regexsolver.api.generated.model.StringsDto; -import com.regexsolver.api.generated.model.TermDto; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.regexsolver.api.generated.ApiClient; /** - * Response containing distinct strings generated from the requested 'term'. + * Response containing distinct strings generated from the requested `term`. */ @JsonPropertyOrder({ GenerateStringsResponseDto.JSON_PROPERTY_TYPE, - GenerateStringsResponseDto.JSON_PROPERTY_TERM, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type @@ -78,10 +76,6 @@ public static TypeEnum fromValue(String value) { @jakarta.annotation.Nonnull private TypeEnum type; - public static final String JSON_PROPERTY_TERM = "term"; - @jakarta.annotation.Nullable - private TermDto term; - public static final String JSON_PROPERTY_STRINGS = "strings"; @jakarta.annotation.Nonnull private StringsDto strings; @@ -113,30 +107,6 @@ public void setType(@jakarta.annotation.Nonnull TypeEnum type) { } - public GenerateStringsResponseDto term(@jakarta.annotation.Nullable TermDto term) { - this.term = term; - return this; - } - - /** - * A stable term to use in subsequent calls to guarantee the uniqueness of generated strings. Omitted if 'returnStableTerm' was false in the request, or if the provided term was already stable. - * @return term - */ - @jakarta.annotation.Nullable - @JsonProperty(value = JSON_PROPERTY_TERM, required = false) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public TermDto getTerm() { - return term; - } - - - @JsonProperty(value = JSON_PROPERTY_TERM, required = false) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public void setTerm(@jakarta.annotation.Nullable TermDto term) { - this.term = term; - } - - public GenerateStringsResponseDto strings(@jakarta.annotation.Nonnull StringsDto strings) { this.strings = strings; return this; @@ -174,13 +144,12 @@ public boolean equals(Object o) { } GenerateStringsResponseDto generateStringsResponse = (GenerateStringsResponseDto) o; return Objects.equals(this.type, generateStringsResponse.type) && - Objects.equals(this.term, generateStringsResponse.term) && Objects.equals(this.strings, generateStringsResponse.strings); } @Override public int hashCode() { - return Objects.hash(type, term, strings); + return Objects.hash(type, strings); } @Override @@ -188,7 +157,6 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class GenerateStringsResponseDto {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); - sb.append(" term: ").append(toIndentedString(term)).append("\n"); sb.append(" strings: ").append(toIndentedString(strings)).append("\n"); sb.append("}"); return sb.toString(); @@ -239,11 +207,6 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); } - // add `term` to the URL query string - if (getTerm() != null) { - joiner.add(getTerm().toUrlQueryString(prefix + "term" + suffix)); - } - // add `strings` to the URL query string if (getStrings() != null) { joiner.add(getStrings().toUrlQueryString(prefix + "strings" + suffix)); diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index f1c68bb..cff7bf9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -37,7 +37,7 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index a9e7787..e4a0092 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index a68e245..8806485 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -40,7 +40,7 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index b2de958..6223f97 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -32,7 +32,7 @@ import com.regexsolver.api.generated.ApiClient; /** - * Request to repeat a term between 'min' and 'max' times. + * Request to repeat a term between `min` and `max` times. */ @JsonPropertyOrder({ RepeatRequestDto.JSON_PROPERTY_TERM, @@ -40,7 +40,7 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull @@ -92,6 +92,7 @@ public RepeatRequestDto min(@jakarta.annotation.Nonnull Integer min) { /** * Inclusive lower bound of repetitions. + * minimum: 0 * @return min */ @jakarta.annotation.Nonnull @@ -116,6 +117,7 @@ public RepeatRequestDto max(@jakarta.annotation.Nullable Integer max) { /** * Inclusive upper bound. If omitted or null, the repetition is unbounded. + * minimum: 0 * @return max */ @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index 456862e..73b95f1 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -32,14 +32,14 @@ import com.regexsolver.api.generated.ApiClient; /** - * Change how the engine handle the operation. + * Change how the engine handles the operation. */ @JsonPropertyOrder({ RequestOptionsDto.JSON_PROPERTY_SCHEMA_VERSION, RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index b597f37..0aacb45 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.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.regexsolver.api.generated.model.FairResponseOptionsDto; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -33,9 +34,10 @@ * Change how the engine returns results. */ @JsonPropertyOrder({ - ResponseOptionsDto.JSON_PROPERTY_FORMAT + ResponseOptionsDto.JSON_PROPERTY_FORMAT, + ResponseOptionsDto.JSON_PROPERTY_FAIR }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. @@ -78,6 +80,10 @@ public static FormatEnum fromValue(String value) { @jakarta.annotation.Nullable private FormatEnum format; + public static final String JSON_PROPERTY_FAIR = "fair"; + @jakarta.annotation.Nullable + private FairResponseOptionsDto fair; + public ResponseOptionsDto() { } @@ -105,6 +111,30 @@ public void setFormat(@jakarta.annotation.Nullable FormatEnum format) { } + public ResponseOptionsDto fair(@jakarta.annotation.Nullable FairResponseOptionsDto fair) { + this.fair = fair; + return this; + } + + /** + * Options applied when format is \"fair\". Ignored otherwise. + * @return fair + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_FAIR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public FairResponseOptionsDto getFair() { + return fair; + } + + + @JsonProperty(value = JSON_PROPERTY_FAIR, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setFair(@jakarta.annotation.Nullable FairResponseOptionsDto fair) { + this.fair = fair; + } + + /** * Return true if this ResponseOptions object is equal to o. */ @@ -117,12 +147,13 @@ public boolean equals(Object o) { return false; } ResponseOptionsDto responseOptions = (ResponseOptionsDto) o; - return Objects.equals(this.format, responseOptions.format); + return Objects.equals(this.format, responseOptions.format) && + Objects.equals(this.fair, responseOptions.fair); } @Override public int hashCode() { - return Objects.hash(format); + return Objects.hash(format, fair); } @Override @@ -130,6 +161,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class ResponseOptionsDto {\n"); sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" fair: ").append(toIndentedString(fair)).append("\n"); sb.append("}"); return sb.toString(); } @@ -179,6 +211,11 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%sformat%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getFormat())))); } + // add `fair` to the URL query string + if (getFair() != null) { + joiner.add(getFair().toUrlQueryString(prefix + "fair" + suffix)); + } + return joiner.toString(); } } diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index add6f92..d06ac53 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index f1bb6d7..eb8d14f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -37,7 +37,7 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index 83e08ab..e0b8e51 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index ae3a54d..220d1b6 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; import com.regexsolver.api.generated.model.TermFairDto; +import com.regexsolver.api.generated.model.TermFairMetadataDto; import com.regexsolver.api.generated.model.TermRegexDto; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -57,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index bbf840c..e614f06 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.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.regexsolver.api.generated.model.TermFairMetadataDto; import java.util.Arrays; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -34,9 +35,10 @@ */ @JsonPropertyOrder({ TermFairDto.JSON_PROPERTY_TYPE, - TermFairDto.JSON_PROPERTY_VALUE + TermFairDto.JSON_PROPERTY_VALUE, + TermFairDto.JSON_PROPERTY_METADATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type @@ -79,9 +81,21 @@ public static TypeEnum fromValue(String value) { @jakarta.annotation.Nonnull private String value; + public static final String JSON_PROPERTY_METADATA = "metadata"; + @jakarta.annotation.Nullable + private TermFairMetadataDto metadata; + public TermFairDto() { } + @JsonCreator + public TermFairDto( + @JsonProperty(JSON_PROPERTY_METADATA) TermFairMetadataDto metadata + ) { + this(); + this.metadata = metadata; + } + public TermFairDto type(@jakarta.annotation.Nonnull TypeEnum type) { this.type = type; return this; @@ -130,6 +144,20 @@ public void setValue(@jakarta.annotation.Nonnull String value) { } + /** + * Get metadata + * @return metadata + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_METADATA, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public TermFairMetadataDto getMetadata() { + return metadata; + } + + + + /** * Return true if this TermFair object is equal to o. */ @@ -143,12 +171,13 @@ public boolean equals(Object o) { } TermFairDto termFair = (TermFairDto) o; return Objects.equals(this.type, termFair.type) && - Objects.equals(this.value, termFair.value); + Objects.equals(this.value, termFair.value) && + Objects.equals(this.metadata, termFair.metadata); } @Override public int hashCode() { - return Objects.hash(type, value); + return Objects.hash(type, value, metadata); } @Override @@ -157,6 +186,7 @@ public String toString() { sb.append("class TermFairDto {\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append("}"); return sb.toString(); } @@ -211,6 +241,11 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%svalue%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getValue())))); } + // add `metadata` to the URL query string + if (getMetadata() != null) { + joiner.add(getMetadata().toUrlQueryString(prefix + "metadata" + suffix)); + } + return joiner.toString(); } } diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java new file mode 100644 index 0000000..3663601 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java @@ -0,0 +1,148 @@ +/* + * RegexSolver + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Metadata describing properties of a FAIR automaton. + */ +@JsonPropertyOrder({ + TermFairMetadataDto.JSON_PROPERTY_DETERMINISTIC +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class TermFairMetadataDto { + public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; + @jakarta.annotation.Nullable + private Boolean deterministic; + + public TermFairMetadataDto() { + } + + public TermFairMetadataDto deterministic(@jakarta.annotation.Nullable Boolean deterministic) { + this.deterministic = deterministic; + return this; + } + + /** + * Whether this FAIR encodes a deterministic automaton. Only a deterministic FAIR guarantees consistent string ordering across paginated /generate/strings requests; call /compute/determinize first if this is false. + * @return deterministic + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_DETERMINISTIC, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getDeterministic() { + return deterministic; + } + + + @JsonProperty(value = JSON_PROPERTY_DETERMINISTIC, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setDeterministic(@jakarta.annotation.Nullable Boolean deterministic) { + this.deterministic = deterministic; + } + + + /** + * Return true if this TermFairMetadata object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TermFairMetadataDto termFairMetadata = (TermFairMetadataDto) o; + return Objects.equals(this.deterministic, termFairMetadata.deterministic); + } + + @Override + public int hashCode() { + return Objects.hash(deterministic); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TermFairMetadataDto {\n"); + sb.append(" deterministic: ").append(toIndentedString(deterministic)).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 `deterministic` to the URL query string + if (getDeterministic() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sdeterministic%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getDeterministic())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index 794ab36..4d22dd3 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index c3a3cd9..26ee64f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -32,13 +32,13 @@ import com.regexsolver.api.generated.ApiClient; /** - * Request a single term. + * Request carrying a single term. */ @JsonPropertyOrder({ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index b4f3de8..425ae78 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -40,7 +40,7 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-04-13T21:04:36.007610025+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java index a1e46f6..253847f 100644 --- a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java @@ -411,6 +411,28 @@ void testIsTotal() { assertThat(client.isTotal(term).join()).isTrue(); } + @Test + void testIsDeterministic() { + Term term = Term.fair("payload"); + Empty200ResponseDto responseDto = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + responseDto.setData(data); + + when(analyzeApi.deterministic(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + assertThat(client.isDeterministic(term).join()).isTrue(); + } + + @Test + void testIsDeterministicFalseForRegexTerm() { + Term term = Term.regex("a"); + + assertThat(client.isDeterministic(term).join()).isFalse(); + } + @Test void testGetPattern() { Term term = Term.regex("a"); @@ -504,6 +526,21 @@ void testRepeat() { assertThat(result.getPattern()).contains("a{2,3}"); } + @Test + void testDeterminize() { + Term term = Term.regex("a"); + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + TermDto data = new TermDto(new TermFairDto().value("fair-payload")); + responseDto.setData(data); + + when(computeApi.determinize(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + Term result = client.determinize(term).join(); + assertThat(result.getFair()).contains("fair-payload"); + } + @Test void testComplement() { Term term = Term.regex(".*a.*"); diff --git a/src/test/java/com/regexsolver/api/ModelsTest.java b/src/test/java/com/regexsolver/api/ModelsTest.java index 9a7b850..83ca486 100644 --- a/src/test/java/com/regexsolver/api/ModelsTest.java +++ b/src/test/java/com/regexsolver/api/ModelsTest.java @@ -201,13 +201,13 @@ void testTermSerializeDeserialize() { @Test void testTermIsMatch() { Term term = Term.regex("a.b"); - assertThat(term.isMatch("axb")).isTrue(); - assertThat(term.isMatch("a\nb")).isTrue(); // DOTALL behavior - assertThat(term.isMatch("ab")).isFalse(); - assertThat(term.isMatch("axxb")).isFalse(); // anchored (fullmatch) + assertThat(term.matches("axb")).isTrue(); + assertThat(term.matches("a\nb")).isTrue(); // DOTALL behavior + assertThat(term.matches("ab")).isFalse(); + assertThat(term.matches("axxb")).isFalse(); // anchored (fullmatch) Term fairTerm = Term.fair("payload"); - assertThatThrownBy(() -> fairTerm.isMatch("abc")).isInstanceOf( + assertThatThrownBy(() -> fairTerm.matches("abc")).isInstanceOf( IllegalStateException.class ); } diff --git a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java index 4fdfb00..214035b 100644 --- a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java @@ -67,6 +67,35 @@ void testSyncClientIsEmpty() { verify(asyncClient).isEmpty(term); } + @Test + void testSyncClientIsDeterministic() { + Term term = Term.fair("payload"); + + when(asyncClient.isDeterministic(any())).thenReturn( + CompletableFuture.completedFuture(true) + ); + + boolean result = client.isDeterministic(term); + + assertThat(result).isTrue(); + verify(asyncClient).isDeterministic(term); + } + + @Test + void testSyncClientDeterminize() { + Term term = Term.regex("a"); + Term mockResultTerm = Term.fair("fair-payload"); + + when(asyncClient.determinize(any())).thenReturn( + CompletableFuture.completedFuture(mockResultTerm) + ); + + Term result = client.determinize(term); + + assertThat(result.getFair()).contains("fair-payload"); + verify(asyncClient).determinize(term); + } + @Test void testSyncClientUnion() { Term term1 = Term.regex("a"); From 35a6ca786785dc07c4197ade289d6b737fad2e50 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Mon, 15 Jun 2026 21:09:34 +0200 Subject: [PATCH 17/24] Add new error --- api/openapi.yaml | 1985 +++++++++++++++++ .../api/AsyncRegexSolverClient.java | 8 + .../api/exceptions/FairSyntaxException.java | 10 + .../regexsolver/api/generated/ApiClient.java | 2 +- .../api/generated/ApiException.java | 2 +- .../api/generated/ApiResponse.java | 2 +- .../api/generated/Configuration.java | 2 +- .../com/regexsolver/api/generated/JSON.java | 4 +- .../com/regexsolver/api/generated/Pair.java | 2 +- .../api/generated/RFC3339DateFormat.java | 2 +- .../generated/RFC3339InstantDeserializer.java | 2 +- .../api/generated/RFC3339JavaTimeModule.java | 2 +- .../api/generated/ServerConfiguration.java | 2 +- .../api/generated/ServerVariable.java | 2 +- .../api/generated/api/AnalyzeApi.java | 2 +- .../api/generated/api/ComputeApi.java | 2 +- .../api/generated/api/GenerateApi.java | 2 +- .../model/AbstractOpenApiSchema.java | 2 +- .../api/generated/model/BooleanDto.java | 2 +- .../model/Cardinality200ResponseDto.java | 2 +- .../model/CardinalityBigIntegerDto.java | 2 +- .../api/generated/model/CardinalityDto.java | 2 +- .../model/CardinalityInfiniteDto.java | 2 +- .../model/CardinalityIntegerDto.java | 2 +- .../generated/model/Concat200ResponseDto.java | 2 +- .../generated/model/Dot200ResponseDto.java | 2 +- .../generated/model/Empty200ResponseDto.java | 2 +- .../generated/model/ErrorResponse400Dto.java | 6 +- .../generated/model/ErrorResponse401Dto.java | 2 +- .../generated/model/ErrorResponse403Dto.java | 2 +- .../api/generated/model/ErrorResponseDto.java | 2 +- .../generated/model/ExecutionOptionsDto.java | 2 +- .../model/FairResponseOptionsDto.java | 2 +- .../model/GenerateStringsRequestDto.java | 2 +- .../model/GenerateStringsResponseDto.java | 2 +- .../generated/model/Length200ResponseDto.java | 2 +- .../api/generated/model/LengthDto.java | 2 +- .../generated/model/MultiTermsRequestDto.java | 2 +- .../api/generated/model/RepeatRequestDto.java | 2 +- .../generated/model/RequestOptionsDto.java | 2 +- .../generated/model/ResponseOptionsDto.java | 2 +- .../api/generated/model/StringDto.java | 2 +- .../model/Strings200ResponseDto.java | 2 +- .../api/generated/model/StringsDto.java | 2 +- .../api/generated/model/TermDto.java | 2 +- .../api/generated/model/TermFairDto.java | 2 +- .../generated/model/TermFairMetadataDto.java | 2 +- .../api/generated/model/TermRegexDto.java | 2 +- .../api/generated/model/TermRequestDto.java | 2 +- .../generated/model/TwoTermsRequestDto.java | 2 +- 50 files changed, 2054 insertions(+), 49 deletions(-) create mode 100644 api/openapi.yaml create mode 100644 src/main/java/com/regexsolver/api/exceptions/FairSyntaxException.java diff --git a/api/openapi.yaml b/api/openapi.yaml new file mode 100644 index 0000000..fc4a7cf --- /dev/null +++ b/api/openapi.yaml @@ -0,0 +1,1985 @@ +openapi: 3.0.3 +info: + title: RegexSolver + version: 1.1.0 +servers: +- url: https://api.regexsolver.com/v1 +security: +- BearerAuth: [] +tags: +- description: "Inspect properties of a term, such as cardinality, length, or equivalence." + name: Analyze +- description: Derive new terms from one or more input terms. + name: Compute +- description: Produce concrete output from a term. + name: Generate +paths: + /analyze/cardinality: + post: + description: Compute how many strings the term matches. + operationId: cardinality + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: integer + value: 26 + schema: + $ref: "#/components/schemas/cardinality_200_response" + description: Cardinality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Cardinality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/dot: + post: + description: Build a Graphviz DOT representation of the term's automaton. + operationId: dot + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[a-z]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: string + value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ + 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ + \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ + 1\"];\n}" + schema: + $ref: "#/components/schemas/dot_200_response" + description: Graphviz DOT representation. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Graphviz DOT + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty: + post: + description: Check if the term matches no strings. + operationId: empty + requestBody: + content: + application/json: + example: + term: + type: regex + value: "[]" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty language result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Empty + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/empty_string: + post: + description: Check if the term matches only the empty string. + operationId: empty_string + requestBody: + content: + application/json: + example: + term: + type: regex + value: "" + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Empty string only result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Empty String Only + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/total: + post: + description: Check if the term matches all the possible strings. + operationId: total + requestBody: + content: + application/json: + example: + term: + type: regex + value: .* + schema: + $ref: "#/components/schemas/TermRequest" + required: true + responses: + "200": + content: + application/json: + example: + success: true + data: + type: boolean + value: true + schema: + $ref: "#/components/schemas/empty_200_response" + description: Totality result. + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse400" + description: Bad request + "401": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse401" + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse403" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Not found + "429": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Too many requests + headers: + Retry-After: + description: Number of seconds to wait before retrying. + explode: false + schema: + type: integer + style: simple + "500": + content: + application/json: + schema: + $ref: "#/components/schemas/ErrorResponse" + description: Internal server error + summary: Totality + tags: + - Analyze + x-content-type: application/json + x-accepts: + - application/json + /analyze/deterministic: + post: + description: Check if the term's automaton is deterministic. Only a deterministic + FAIR guarantees consistent string ordering across paginated /generate/strings + requests; call /compute/determinize first if this is false. + operationId: deterministic + requestBody: + content: + application/json: + example: + term: + type: fair + value: "The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index 7b10ee8..6807b4c 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index a86fb76..e943349 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index 16bcbc4..42bfcc9 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index 04718a3..6f98405 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index 701df68..6329e4f 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index 57cd5e8..bac6c87 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index 87114ae..4fba647 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index a96680d..9002b00 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index b1620c4..bb7db43 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index 699e76e..b4b0690 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index 1b7d276..1f4e6bc 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index 5e5f504..ed4c09d 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -55,7 +55,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index b8ddcec..24df984 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index 9ddf06a..7d594f9 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index 78a1586..f772b81 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index 5283fa2..3acbf43 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -37,7 +37,7 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index cafe6ca..134304a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index 9085c55..dd0d159 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index e6c42a5..c966a21 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index 06af9f9..e8ce31d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index 6a672de..c57b2f8 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -37,7 +37,7 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index c461c65..daa1728 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -37,7 +37,7 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index f0237c9..b284882 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -37,7 +37,7 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java index 7629d6f..631ec48 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java @@ -37,7 +37,7 @@ ErrorResponse400Dto.JSON_PROPERTY_ERROR, ErrorResponse400Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse400Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull @@ -63,7 +63,9 @@ public enum ErrorCodeEnum { AUTOMATON_TOO_MANY_STATES(String.valueOf("AutomatonTooManyStates")), - REGEX_SYNTAX_ERROR(String.valueOf("RegexSyntaxError")); + REGEX_SYNTAX_ERROR(String.valueOf("RegexSyntaxError")), + + FAIR_SYNTAX_ERROR(String.valueOf("FairSyntaxError")); private String value; diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java index a1b84c4..7bb5abf 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java @@ -37,7 +37,7 @@ ErrorResponse401Dto.JSON_PROPERTY_ERROR, ErrorResponse401Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse401Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java index 0a9eaae..19f5a23 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java @@ -37,7 +37,7 @@ ErrorResponse403Dto.JSON_PROPERTY_ERROR, ErrorResponse403Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse403Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index 781161f..930d6be 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -37,7 +37,7 @@ ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index e025c77..a6d9668 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java index 94fe7ab..21df3b7 100644 --- a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ FairResponseOptionsDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class FairResponseOptionsDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index 5dd5b62..0ad496c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -40,7 +40,7 @@ GenerateStringsRequestDto.JSON_PROPERTY_OFFSET, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index c218ba1..630bc4e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -37,7 +37,7 @@ GenerateStringsResponseDto.JSON_PROPERTY_TYPE, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index cff7bf9..691aefb 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -37,7 +37,7 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index e4a0092..3b71d7e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index 8806485..5c0ea62 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -40,7 +40,7 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index 6223f97..045786e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -40,7 +40,7 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index 73b95f1..bb33ae0 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -39,7 +39,7 @@ RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index 0aacb45..cb89855 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -37,7 +37,7 @@ ResponseOptionsDto.JSON_PROPERTY_FORMAT, ResponseOptionsDto.JSON_PROPERTY_FAIR }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index d06ac53..806aa02 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index eb8d14f..dc25f2a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -37,7 +37,7 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index e0b8e51..128537a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index 220d1b6..3e81e8b 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index e614f06..15b5814 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -38,7 +38,7 @@ TermFairDto.JSON_PROPERTY_VALUE, TermFairDto.JSON_PROPERTY_METADATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java index 3663601..67af299 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ TermFairMetadataDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairMetadataDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index 4d22dd3..907f734 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index 26ee64f..a2e7a6a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -38,7 +38,7 @@ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index 425ae78..b591c0f 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -40,7 +40,7 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-14T20:33:08.283718579+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull From 362dcf38ca55a401a9ceb3a1cca3aa229fde978e Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 25 Jul 2026 17:49:58 +0200 Subject: [PATCH 18/24] Fix some issues --- README.md | 2 +- api/openapi.yaml | 1 + .../api/AsyncRegexSolverClient.java | 92 +++++++++++-------- .../com/regexsolver/api/ExecutionOptions.java | 36 ++++++++ src/main/java/com/regexsolver/api/Length.java | 10 +- .../regexsolver/api/RegexSolverClient.java | 44 ++++----- src/main/java/com/regexsolver/api/Term.java | 28 +++++- .../api/exceptions/TooFewTermsException.java | 14 +++ .../regexsolver/api/generated/ApiClient.java | 2 +- .../api/generated/ApiException.java | 2 +- .../api/generated/ApiResponse.java | 2 +- .../api/generated/Configuration.java | 2 +- .../com/regexsolver/api/generated/JSON.java | 4 +- .../com/regexsolver/api/generated/Pair.java | 2 +- .../api/generated/RFC3339DateFormat.java | 2 +- .../generated/RFC3339InstantDeserializer.java | 2 +- .../api/generated/RFC3339JavaTimeModule.java | 2 +- .../api/generated/ServerConfiguration.java | 2 +- .../api/generated/ServerVariable.java | 2 +- .../api/generated/api/AnalyzeApi.java | 2 +- .../api/generated/api/ComputeApi.java | 2 +- .../api/generated/api/GenerateApi.java | 2 +- .../model/AbstractOpenApiSchema.java | 2 +- .../api/generated/model/BooleanDto.java | 2 +- .../model/Cardinality200ResponseDto.java | 2 +- .../model/CardinalityBigIntegerDto.java | 2 +- .../api/generated/model/CardinalityDto.java | 2 +- .../model/CardinalityInfiniteDto.java | 2 +- .../model/CardinalityIntegerDto.java | 2 +- .../generated/model/Concat200ResponseDto.java | 2 +- .../generated/model/Dot200ResponseDto.java | 2 +- .../generated/model/Empty200ResponseDto.java | 2 +- .../generated/model/ErrorResponse400Dto.java | 4 +- .../generated/model/ErrorResponse401Dto.java | 2 +- .../generated/model/ErrorResponse403Dto.java | 2 +- .../api/generated/model/ErrorResponseDto.java | 2 +- .../generated/model/ExecutionOptionsDto.java | 2 +- .../model/FairResponseOptionsDto.java | 2 +- .../model/GenerateStringsRequestDto.java | 2 +- .../model/GenerateStringsResponseDto.java | 2 +- .../generated/model/Length200ResponseDto.java | 2 +- .../api/generated/model/LengthDto.java | 2 +- .../generated/model/MultiTermsRequestDto.java | 2 +- .../api/generated/model/RepeatRequestDto.java | 2 +- .../generated/model/RequestOptionsDto.java | 2 +- .../generated/model/ResponseOptionsDto.java | 2 +- .../api/generated/model/StringDto.java | 2 +- .../model/Strings200ResponseDto.java | 2 +- .../api/generated/model/StringsDto.java | 2 +- .../api/generated/model/TermDto.java | 2 +- .../api/generated/model/TermFairDto.java | 2 +- .../generated/model/TermFairMetadataDto.java | 2 +- .../api/generated/model/TermRegexDto.java | 2 +- .../api/generated/model/TermRequestDto.java | 2 +- .../generated/model/TwoTermsRequestDto.java | 2 +- 55 files changed, 212 insertions(+), 113 deletions(-) create mode 100644 src/main/java/com/regexsolver/api/ExecutionOptions.java create mode 100644 src/main/java/com/regexsolver/api/exceptions/TooFewTermsException.java diff --git a/README.md b/README.md index 44e1ffe..20b0271 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,7 @@ Timeout is best effort. The exact time is not guaranteed. ## API Overview -`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. All methods accept an optional `OperationOptions` object as the last parameter. +`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. Every method accepts an optional options object as its last parameter: operations that return a term take `OperationOptions` (`responseFormat`, `deterministic`, `executionTimeout`), while analyze operations and `determinize()` take `ExecutionOptions` (`executionTimeout` only) — the response format is not theirs to choose. ### Analyze diff --git a/api/openapi.yaml b/api/openapi.yaml index fc4a7cf..85ca9ec 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -1574,6 +1574,7 @@ components: enum: - InvalidJson - TooManyTerms + - TooFewTerms - TimeoutTooLarge - TimeoutExceeded - InvalidNumberOfStringsToGenerate diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index d23f19a..63f0eca 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -82,6 +82,18 @@ public AsyncRegexSolverClient build() { // --- INTERNAL HELPERS --- + private RequestOptionsDto buildOptions(ExecutionOptions options) { + RequestOptionsDto dto = new RequestOptionsDto().schemaVersion(1); + if (options != null) { + options + .getExecutionTimeout() + .ifPresent(timeout -> + dto.execution(new ExecutionOptionsDto().timeout(timeout)) + ); + } + return dto; + } + private RequestOptionsDto buildOptions(OperationOptions options) { RequestOptionsDto dto = new RequestOptionsDto().schemaVersion(1); if (options != null) { @@ -191,6 +203,14 @@ private RegexSolverException mapException(ApiException ex) { errorCode, body ); + if ( + "TooFewTerms".equals(errorCode) + ) return new TooFewTermsException( + message, + code, + errorCode, + body + ); if ( "TimeoutTooLarge".equals(errorCode) ) return new TimeoutTooLargeException( @@ -308,7 +328,7 @@ private RegexSolverException mapException(ApiException ex) { * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public CompletableFuture getCardinality(Term term) { - return getCardinality(term, (OperationOptions) null); + return getCardinality(term, (ExecutionOptions) null); } /** @@ -320,7 +340,7 @@ public CompletableFuture getCardinality(Term term) { */ public CompletableFuture getCardinality( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedCardinality() != null) { return CompletableFuture.completedFuture( @@ -346,7 +366,7 @@ public CompletableFuture getCardinality( * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public CompletableFuture getLength(Term term) { - return getLength(term, (OperationOptions) null); + return getLength(term, (ExecutionOptions) null); } /** @@ -358,7 +378,7 @@ public CompletableFuture getLength(Term term) { */ public CompletableFuture getLength( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedLength() != null) { return CompletableFuture.completedFuture(term.getCachedLength()); @@ -382,7 +402,7 @@ public CompletableFuture getLength( * @return A CompletableFuture containing true if the language is completely empty, false otherwise. */ public CompletableFuture isEmpty(Term term) { - return isEmpty(term, (OperationOptions) null); + return isEmpty(term, (ExecutionOptions) null); } /** @@ -394,7 +414,7 @@ public CompletableFuture isEmpty(Term term) { */ public CompletableFuture isEmpty( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedEmpty() != null) { return CompletableFuture.completedFuture(term.getCachedEmpty()); @@ -422,7 +442,7 @@ public CompletableFuture isEmpty( * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. */ public CompletableFuture isEmptyString(Term term) { - return isEmptyString(term, (OperationOptions) null); + return isEmptyString(term, (ExecutionOptions) null); } /** @@ -434,7 +454,7 @@ public CompletableFuture isEmptyString(Term term) { */ public CompletableFuture isEmptyString( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedEmptyString() != null) { return CompletableFuture.completedFuture( @@ -465,7 +485,7 @@ public CompletableFuture isEmptyString( * @return A CompletableFuture containing true if the term matches every possible string. */ public CompletableFuture isTotal(Term term) { - return isTotal(term, (OperationOptions) null); + return isTotal(term, (ExecutionOptions) null); } /** @@ -477,7 +497,7 @@ public CompletableFuture isTotal(Term term) { */ public CompletableFuture isTotal( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedTotal() != null) { return CompletableFuture.completedFuture(term.getCachedTotal()); @@ -507,7 +527,7 @@ public CompletableFuture isTotal( * @return A CompletableFuture containing true if the term's automaton is deterministic. */ public CompletableFuture isDeterministic(Term term) { - return isDeterministic(term, (OperationOptions) null); + return isDeterministic(term, (ExecutionOptions) null); } /** @@ -520,7 +540,7 @@ public CompletableFuture isDeterministic(Term term) { */ public CompletableFuture isDeterministic( Term term, - OperationOptions options + ExecutionOptions options ) { if (!(term instanceof Term.FairTerm)) { return CompletableFuture.completedFuture(false); @@ -549,7 +569,7 @@ public CompletableFuture isDeterministic( * @return A CompletableFuture containing a valid regular expression string representing the language. */ public CompletableFuture getPattern(Term term) { - return getPattern(term, (OperationOptions) null); + return getPattern(term, (ExecutionOptions) null); } /** @@ -561,23 +581,21 @@ public CompletableFuture getPattern(Term term) { */ public CompletableFuture getPattern( Term term, - OperationOptions options + ExecutionOptions options ) { - return term - .getPattern() - .map(CompletableFuture::completedFuture) - .orElseGet(() -> { - TermRequestDto request = new TermRequestDto() - .term(term.toDto()) - .options(buildOptions(options)); - return executeWithRetry(() -> - analyzeApi.pattern(request) - ).thenApply(resp -> { - String val = resp.getData().getValue(); - term.setCachedPattern(val); - return val; - }); - }); + if (term.getCachedPattern() != null) { + return CompletableFuture.completedFuture(term.getCachedPattern()); + } + TermRequestDto request = new TermRequestDto() + .term(term.toDto()) + .options(buildOptions(options)); + return executeWithRetry(() -> + analyzeApi.pattern(request) + ).thenApply(resp -> { + String val = resp.getData().getValue(); + term.setCachedPattern(val); + return val; + }); } /** @@ -587,7 +605,7 @@ public CompletableFuture getPattern( * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. */ public CompletableFuture getDot(Term term) { - return getDot(term, (OperationOptions) null); + return getDot(term, (ExecutionOptions) null); } /** @@ -599,7 +617,7 @@ public CompletableFuture getDot(Term term) { */ public CompletableFuture getDot( Term term, - OperationOptions options + ExecutionOptions options ) { if (term.getCachedDot() != null) { return CompletableFuture.completedFuture(term.getCachedDot()); @@ -624,7 +642,7 @@ public CompletableFuture getDot( * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. */ public CompletableFuture equivalent(Term term1, Term term2) { - return equivalent(term1, term2, (OperationOptions) null); + return equivalent(term1, term2, (ExecutionOptions) null); } /** @@ -638,7 +656,7 @@ public CompletableFuture equivalent(Term term1, Term term2) { public CompletableFuture equivalent( Term term1, Term term2, - OperationOptions options + ExecutionOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(term1.toDto()) @@ -657,7 +675,7 @@ public CompletableFuture equivalent( * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. */ public CompletableFuture subset(Term subset, Term superset) { - return subset(subset, superset, (OperationOptions) null); + return subset(subset, superset, (ExecutionOptions) null); } /** @@ -671,7 +689,7 @@ public CompletableFuture subset(Term subset, Term superset) { public CompletableFuture subset( Term subset, Term superset, - OperationOptions options + ExecutionOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(subset.toDto()) @@ -910,7 +928,7 @@ public CompletableFuture repeat( * @return A CompletableFuture containing a deterministic FAIR. */ public CompletableFuture determinize(Term term) { - return determinize(term, (OperationOptions) null); + return determinize(term, (ExecutionOptions) null); } /** @@ -925,7 +943,7 @@ public CompletableFuture determinize(Term term) { */ public CompletableFuture determinize( Term term, - OperationOptions options + ExecutionOptions options ) { TermRequestDto request = new TermRequestDto() .term(term.toDto()) diff --git a/src/main/java/com/regexsolver/api/ExecutionOptions.java b/src/main/java/com/regexsolver/api/ExecutionOptions.java new file mode 100644 index 0000000..66de26b --- /dev/null +++ b/src/main/java/com/regexsolver/api/ExecutionOptions.java @@ -0,0 +1,36 @@ +package com.regexsolver.api; + +import java.util.Optional; + +/** + * Options accepted by every RegexSolver operation. + * + *

Analyze operations and {@code determinize()} take this type rather than + * {@link OperationOptions}: they do not return a caller-shaped term, so + * {@code responseFormat} and {@code deterministic} would have no effect there. + * The two types are deliberately unrelated so that passing the wrong one is a + * compile error instead of a silently ignored field.

+ */ +public class ExecutionOptions { + + private Integer executionTimeout; + + public ExecutionOptions() {} + + public ExecutionOptions(Integer executionTimeout) { + this.executionTimeout = executionTimeout; + } + + public static ExecutionOptions builder() { + return new ExecutionOptions(); + } + + public ExecutionOptions executionTimeout(Integer timeout) { + this.executionTimeout = timeout; + return this; + } + + public Optional getExecutionTimeout() { + return Optional.ofNullable(executionTimeout); + } +} diff --git a/src/main/java/com/regexsolver/api/Length.java b/src/main/java/com/regexsolver/api/Length.java index 0d0ba5f..3d68d28 100644 --- a/src/main/java/com/regexsolver/api/Length.java +++ b/src/main/java/com/regexsolver/api/Length.java @@ -38,18 +38,24 @@ public Optional isEmpty() { @Override public Optional isEmptyString() { - return Optional.of(this.min == 0 && this.max == 0); + // min/max are null for the empty language and max is null when the length + // is unbounded, so these comparisons must not unbox. + return Optional.of(isZero(this.min) && isZero(this.max)); } @Override public Optional isTotal() { - if (this.min != 0 || this.max != null) { + if (!isZero(this.min) || this.max != null) { return Optional.of(false); } else { return Optional.empty(); } } + private static boolean isZero(Integer value) { + return value != null && value.intValue() == 0; + } + @Override public boolean equals(Object o) { if (this == o) return true; diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 6835d88..7d4873b 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -48,7 +48,7 @@ public RegexSolverClient build() { * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public Cardinality getCardinality(Term term) { - return getCardinality(term, (OperationOptions) null); + return getCardinality(term, (ExecutionOptions) null); } /** @@ -58,7 +58,7 @@ public Cardinality getCardinality(Term term) { * @param options Options for the operation. * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ - public Cardinality getCardinality(Term term, OperationOptions options) { + public Cardinality getCardinality(Term term, ExecutionOptions options) { try { return asyncClient.getCardinality(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -77,7 +77,7 @@ public Cardinality getCardinality(Term term, OperationOptions options) { * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public Length getLength(Term term) { - return getLength(term, (OperationOptions) null); + return getLength(term, (ExecutionOptions) null); } /** @@ -87,7 +87,7 @@ public Length getLength(Term term) { * @param options Options for the operation. * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ - public Length getLength(Term term, OperationOptions options) { + public Length getLength(Term term, ExecutionOptions options) { try { return asyncClient.getLength(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -106,7 +106,7 @@ public Length getLength(Term term, OperationOptions options) { * @return true if the language is completely empty, false otherwise. */ public boolean isEmpty(Term term) { - return isEmpty(term, (OperationOptions) null); + return isEmpty(term, (ExecutionOptions) null); } /** @@ -116,7 +116,7 @@ public boolean isEmpty(Term term) { * @param options Options for the operation. * @return true if the language is completely empty, false otherwise. */ - public boolean isEmpty(Term term, OperationOptions options) { + public boolean isEmpty(Term term, ExecutionOptions options) { try { return asyncClient.isEmpty(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -135,7 +135,7 @@ public boolean isEmpty(Term term, OperationOptions options) { * @return true if the term strictly matches the empty string ("") and nothing else. */ public boolean isEmptyString(Term term) { - return isEmptyString(term, (OperationOptions) null); + return isEmptyString(term, (ExecutionOptions) null); } /** @@ -145,7 +145,7 @@ public boolean isEmptyString(Term term) { * @param options Options for the operation. * @return true if the term strictly matches the empty string ("") and nothing else. */ - public boolean isEmptyString(Term term, OperationOptions options) { + public boolean isEmptyString(Term term, ExecutionOptions options) { try { return asyncClient.isEmptyString(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -164,7 +164,7 @@ public boolean isEmptyString(Term term, OperationOptions options) { * @return true if the term matches every possible string. */ public boolean isTotal(Term term) { - return isTotal(term, (OperationOptions) null); + return isTotal(term, (ExecutionOptions) null); } /** @@ -174,7 +174,7 @@ public boolean isTotal(Term term) { * @param options Options for the operation. * @return true if the term matches every possible string. */ - public boolean isTotal(Term term, OperationOptions options) { + public boolean isTotal(Term term, ExecutionOptions options) { try { return asyncClient.isTotal(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -194,7 +194,7 @@ public boolean isTotal(Term term, OperationOptions options) { * @return true if the term's automaton is deterministic. */ public boolean isDeterministic(Term term) { - return isDeterministic(term, (OperationOptions) null); + return isDeterministic(term, (ExecutionOptions) null); } /** @@ -205,7 +205,7 @@ public boolean isDeterministic(Term term) { * @param options Options for the operation. * @return true if the term's automaton is deterministic. */ - public boolean isDeterministic(Term term, OperationOptions options) { + public boolean isDeterministic(Term term, ExecutionOptions options) { try { return asyncClient.isDeterministic(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -224,7 +224,7 @@ public boolean isDeterministic(Term term, OperationOptions options) { * @return A valid regular expression string representing the language. */ public String getPattern(Term term) { - return getPattern(term, (OperationOptions) null); + return getPattern(term, (ExecutionOptions) null); } /** @@ -234,7 +234,7 @@ public String getPattern(Term term) { * @param options Options for the operation. * @return A valid regular expression string representing the language. */ - public String getPattern(Term term, OperationOptions options) { + public String getPattern(Term term, ExecutionOptions options) { try { return asyncClient.getPattern(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -253,7 +253,7 @@ public String getPattern(Term term, OperationOptions options) { * @return The raw DOT syntax for Graphviz compilation. */ public String getDot(Term term) { - return getDot(term, (OperationOptions) null); + return getDot(term, (ExecutionOptions) null); } /** @@ -263,7 +263,7 @@ public String getDot(Term term) { * @param options Options for the operation. * @return The raw DOT syntax for Graphviz compilation. */ - public String getDot(Term term, OperationOptions options) { + public String getDot(Term term, ExecutionOptions options) { try { return asyncClient.getDot(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -283,7 +283,7 @@ public String getDot(Term term, OperationOptions options) { * @return true if they are entirely equivalent, false otherwise. */ public boolean equivalent(Term term1, Term term2) { - return equivalent(term1, term2, (OperationOptions) null); + return equivalent(term1, term2, (ExecutionOptions) null); } /** @@ -297,7 +297,7 @@ public boolean equivalent(Term term1, Term term2) { public boolean equivalent( Term term1, Term term2, - OperationOptions options + ExecutionOptions options ) { try { return asyncClient.equivalent(term1, term2, options).join(); @@ -318,7 +318,7 @@ public boolean equivalent( * @return true if every string matched by subset is also matched by superset. */ public boolean subset(Term subset, Term superset) { - return subset(subset, superset, (OperationOptions) null); + return subset(subset, superset, (ExecutionOptions) null); } /** @@ -332,7 +332,7 @@ public boolean subset(Term subset, Term superset) { public boolean subset( Term subset, Term superset, - OperationOptions options + ExecutionOptions options ) { try { return asyncClient.subset(subset, superset, options).join(); @@ -596,7 +596,7 @@ public Term repeat( * @return A deterministic FAIR. */ public Term determinize(Term term) { - return determinize(term, (OperationOptions) null); + return determinize(term, (ExecutionOptions) null); } /** @@ -609,7 +609,7 @@ public Term determinize(Term term) { * @param options Options for the operation. * @return A deterministic FAIR. */ - public Term determinize(Term term, OperationOptions options) { + public Term determinize(Term term, ExecutionOptions options) { try { return asyncClient.determinize(term, options).join(); } catch (java.util.concurrent.CompletionException e) { diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index d057aaf..6e33908 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -2,6 +2,7 @@ import com.regexsolver.api.generated.model.TermDto; import com.regexsolver.api.generated.model.TermFairDto; +import com.regexsolver.api.generated.model.TermFairMetadataDto; import com.regexsolver.api.generated.model.TermRegexDto; import java.util.Objects; import java.util.Optional; @@ -12,6 +13,9 @@ */ public abstract class Term { + /** How the engine renders a language that matches no string at all. */ + private static final String EMPTY_LANGUAGE_PATTERN = "[]"; + private final String value; // Shared Cache (Internal) @@ -68,6 +72,12 @@ public boolean matches(String str) { ); } + // The engine renders the empty language as "[]", which java.util.regex + // rejects. By definition it matches nothing. + if (EMPTY_LANGUAGE_PATTERN.equals(patternOpt.get())) { + return false; + } + if (compiledRegex == null) { compiledRegex = Pattern.compile(patternOpt.get(), Pattern.DOTALL); } @@ -98,9 +108,13 @@ static Term fromDto(TermDto dto) { Object instance = dto.getActualInstance(); if (instance instanceof TermRegexDto) { return Term.regex(((TermRegexDto) instance).getValue()); - } else { - return Term.fair(((TermFairDto) instance).getValue()); } + TermFairDto fairDto = (TermFairDto) instance; + // Keep metadata.deterministic so isDeterministic() does not need a second + // round trip for a FAIR the server already told us about. + Optional deterministic = Optional.ofNullable(fairDto.getMetadata()) + .map(TermFairMetadataDto::getDeterministic); + return new FairTerm(fairDto.getValue(), deterministic); } // --- Shared Getters/Setters --- @@ -151,6 +165,10 @@ void setCachedPattern(String pattern) { this.pattern = pattern; } + String getCachedPattern() { + return this.pattern; + } + String getCachedDot() { return dot; } @@ -217,7 +235,11 @@ public static final class FairTerm extends Term { this.deterministic = deterministic; } - Optional getCachedDeterministic() { + /** + * Whether this FAIR encodes a deterministic automaton, or + * {@link java.util.Optional#empty()} if it is not known yet. + */ + public Optional getCachedDeterministic() { return this.deterministic; } diff --git a/src/main/java/com/regexsolver/api/exceptions/TooFewTermsException.java b/src/main/java/com/regexsolver/api/exceptions/TooFewTermsException.java new file mode 100644 index 0000000..be05235 --- /dev/null +++ b/src/main/java/com/regexsolver/api/exceptions/TooFewTermsException.java @@ -0,0 +1,14 @@ +package com.regexsolver.api.exceptions; + +/** Raised when fewer terms are provided than the operation requires. */ +public class TooFewTermsException extends BadRequestException { + + public TooFewTermsException( + String message, + int statusCode, + String errorCode, + String body + ) { + super(message, statusCode, errorCode, body); + } +} diff --git a/src/main/java/com/regexsolver/api/generated/ApiClient.java b/src/main/java/com/regexsolver/api/generated/ApiClient.java index bf92496..4bbd80e 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiClient.java +++ b/src/main/java/com/regexsolver/api/generated/ApiClient.java @@ -53,7 +53,7 @@ *

The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index 6807b4c..fff69ce 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index e943349..745c52c 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index 42bfcc9..a16c11c 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index 6f98405..8a28910 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index 6329e4f..7b3ffc0 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index bac6c87..cd765b3 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index 4fba647..857b8d0 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index 9002b00..b28b4a1 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index bb7db43..76a7e3d 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index b4b0690..36f61c2 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index 1f4e6bc..8f66df0 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index ed4c09d..7142e3d 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -55,7 +55,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index 24df984..ac0a75f 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index 7d594f9..c4c0b00 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index f772b81..6f9adee 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index 3acbf43..f6ae702 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -37,7 +37,7 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index 134304a..24e502d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index dd0d159..b71253e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index c966a21..0cf4fc5 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index e8ce31d..ce3f3a5 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index c57b2f8..7abca61 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -37,7 +37,7 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index daa1728..282f131 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -37,7 +37,7 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index b284882..376bc6c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -37,7 +37,7 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java index 631ec48..7d62606 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java @@ -37,7 +37,7 @@ ErrorResponse400Dto.JSON_PROPERTY_ERROR, ErrorResponse400Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse400Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull @@ -55,6 +55,8 @@ public enum ErrorCodeEnum { TOO_MANY_TERMS(String.valueOf("TooManyTerms")), + TOO_FEW_TERMS(String.valueOf("TooFewTerms")), + TIMEOUT_TOO_LARGE(String.valueOf("TimeoutTooLarge")), TIMEOUT_EXCEEDED(String.valueOf("TimeoutExceeded")), diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java index 7bb5abf..6ed9c94 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java @@ -37,7 +37,7 @@ ErrorResponse401Dto.JSON_PROPERTY_ERROR, ErrorResponse401Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse401Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java index 19f5a23..44136e4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java @@ -37,7 +37,7 @@ ErrorResponse403Dto.JSON_PROPERTY_ERROR, ErrorResponse403Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse403Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index 930d6be..e3156c1 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -37,7 +37,7 @@ ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index a6d9668..039ac10 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java index 21df3b7..98ef8c2 100644 --- a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ FairResponseOptionsDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class FairResponseOptionsDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index 0ad496c..8f1a368 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -40,7 +40,7 @@ GenerateStringsRequestDto.JSON_PROPERTY_OFFSET, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index 630bc4e..4845a48 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -37,7 +37,7 @@ GenerateStringsResponseDto.JSON_PROPERTY_TYPE, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index 691aefb..3d64fd3 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -37,7 +37,7 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index 3b71d7e..1f8b08c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index 5c0ea62..103ee69 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -40,7 +40,7 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index 045786e..941d457 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -40,7 +40,7 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index bb33ae0..cce0199 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -39,7 +39,7 @@ RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index cb89855..cca138b 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -37,7 +37,7 @@ ResponseOptionsDto.JSON_PROPERTY_FORMAT, ResponseOptionsDto.JSON_PROPERTY_FAIR }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index 806aa02..18a997d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index dc25f2a..f2af373 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -37,7 +37,7 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index 128537a..975bb88 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index 3e81e8b..d0f7d8a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index 15b5814..9a8856c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -38,7 +38,7 @@ TermFairDto.JSON_PROPERTY_VALUE, TermFairDto.JSON_PROPERTY_METADATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java index 67af299..35ced67 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java @@ -35,7 +35,7 @@ @JsonPropertyOrder({ TermFairMetadataDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairMetadataDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index 907f734..668c601 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index a2e7a6a..a8c62ad 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -38,7 +38,7 @@ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index b591c0f..5bb42ca 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -40,7 +40,7 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-06-15T20:59:02.334941156+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull From 2e7d46c6a58a4f7828efd7ebafdba3824b4f8c03 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 25 Jul 2026 21:36:18 +0200 Subject: [PATCH 19/24] Revert some changes --- .../api/AsyncRegexSolverClient.java | 56 ++++++++----------- .../com/regexsolver/api/ExecutionOptions.java | 36 ------------ .../regexsolver/api/RegexSolverClient.java | 44 +++++++-------- .../com/regexsolver/api/ResponseFormat.java | 2 +- 4 files changed, 45 insertions(+), 93 deletions(-) delete mode 100644 src/main/java/com/regexsolver/api/ExecutionOptions.java diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index 63f0eca..24b9a84 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -82,18 +82,6 @@ public AsyncRegexSolverClient build() { // --- INTERNAL HELPERS --- - private RequestOptionsDto buildOptions(ExecutionOptions options) { - RequestOptionsDto dto = new RequestOptionsDto().schemaVersion(1); - if (options != null) { - options - .getExecutionTimeout() - .ifPresent(timeout -> - dto.execution(new ExecutionOptionsDto().timeout(timeout)) - ); - } - return dto; - } - private RequestOptionsDto buildOptions(OperationOptions options) { RequestOptionsDto dto = new RequestOptionsDto().schemaVersion(1); if (options != null) { @@ -328,7 +316,7 @@ private RegexSolverException mapException(ApiException ex) { * @return A CompletableFuture containing a Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public CompletableFuture getCardinality(Term term) { - return getCardinality(term, (ExecutionOptions) null); + return getCardinality(term, (OperationOptions) null); } /** @@ -340,7 +328,7 @@ public CompletableFuture getCardinality(Term term) { */ public CompletableFuture getCardinality( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedCardinality() != null) { return CompletableFuture.completedFuture( @@ -366,7 +354,7 @@ public CompletableFuture getCardinality( * @return A CompletableFuture containing a Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public CompletableFuture getLength(Term term) { - return getLength(term, (ExecutionOptions) null); + return getLength(term, (OperationOptions) null); } /** @@ -378,7 +366,7 @@ public CompletableFuture getLength(Term term) { */ public CompletableFuture getLength( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedLength() != null) { return CompletableFuture.completedFuture(term.getCachedLength()); @@ -402,7 +390,7 @@ public CompletableFuture getLength( * @return A CompletableFuture containing true if the language is completely empty, false otherwise. */ public CompletableFuture isEmpty(Term term) { - return isEmpty(term, (ExecutionOptions) null); + return isEmpty(term, (OperationOptions) null); } /** @@ -414,7 +402,7 @@ public CompletableFuture isEmpty(Term term) { */ public CompletableFuture isEmpty( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedEmpty() != null) { return CompletableFuture.completedFuture(term.getCachedEmpty()); @@ -442,7 +430,7 @@ public CompletableFuture isEmpty( * @return A CompletableFuture containing true if the term strictly matches the empty string ("") and nothing else. */ public CompletableFuture isEmptyString(Term term) { - return isEmptyString(term, (ExecutionOptions) null); + return isEmptyString(term, (OperationOptions) null); } /** @@ -454,7 +442,7 @@ public CompletableFuture isEmptyString(Term term) { */ public CompletableFuture isEmptyString( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedEmptyString() != null) { return CompletableFuture.completedFuture( @@ -485,7 +473,7 @@ public CompletableFuture isEmptyString( * @return A CompletableFuture containing true if the term matches every possible string. */ public CompletableFuture isTotal(Term term) { - return isTotal(term, (ExecutionOptions) null); + return isTotal(term, (OperationOptions) null); } /** @@ -497,7 +485,7 @@ public CompletableFuture isTotal(Term term) { */ public CompletableFuture isTotal( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedTotal() != null) { return CompletableFuture.completedFuture(term.getCachedTotal()); @@ -527,7 +515,7 @@ public CompletableFuture isTotal( * @return A CompletableFuture containing true if the term's automaton is deterministic. */ public CompletableFuture isDeterministic(Term term) { - return isDeterministic(term, (ExecutionOptions) null); + return isDeterministic(term, (OperationOptions) null); } /** @@ -540,7 +528,7 @@ public CompletableFuture isDeterministic(Term term) { */ public CompletableFuture isDeterministic( Term term, - ExecutionOptions options + OperationOptions options ) { if (!(term instanceof Term.FairTerm)) { return CompletableFuture.completedFuture(false); @@ -569,7 +557,7 @@ public CompletableFuture isDeterministic( * @return A CompletableFuture containing a valid regular expression string representing the language. */ public CompletableFuture getPattern(Term term) { - return getPattern(term, (ExecutionOptions) null); + return getPattern(term, (OperationOptions) null); } /** @@ -581,7 +569,7 @@ public CompletableFuture getPattern(Term term) { */ public CompletableFuture getPattern( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedPattern() != null) { return CompletableFuture.completedFuture(term.getCachedPattern()); @@ -605,7 +593,7 @@ public CompletableFuture getPattern( * @return A CompletableFuture containing the raw DOT syntax for Graphviz compilation. */ public CompletableFuture getDot(Term term) { - return getDot(term, (ExecutionOptions) null); + return getDot(term, (OperationOptions) null); } /** @@ -617,7 +605,7 @@ public CompletableFuture getDot(Term term) { */ public CompletableFuture getDot( Term term, - ExecutionOptions options + OperationOptions options ) { if (term.getCachedDot() != null) { return CompletableFuture.completedFuture(term.getCachedDot()); @@ -642,7 +630,7 @@ public CompletableFuture getDot( * @return A CompletableFuture containing true if they are entirely equivalent, false otherwise. */ public CompletableFuture equivalent(Term term1, Term term2) { - return equivalent(term1, term2, (ExecutionOptions) null); + return equivalent(term1, term2, (OperationOptions) null); } /** @@ -656,7 +644,7 @@ public CompletableFuture equivalent(Term term1, Term term2) { public CompletableFuture equivalent( Term term1, Term term2, - ExecutionOptions options + OperationOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(term1.toDto()) @@ -675,7 +663,7 @@ public CompletableFuture equivalent( * @return A CompletableFuture containing true if every string matched by subset is also matched by superset. */ public CompletableFuture subset(Term subset, Term superset) { - return subset(subset, superset, (ExecutionOptions) null); + return subset(subset, superset, (OperationOptions) null); } /** @@ -689,7 +677,7 @@ public CompletableFuture subset(Term subset, Term superset) { public CompletableFuture subset( Term subset, Term superset, - ExecutionOptions options + OperationOptions options ) { TwoTermsRequestDto request = new TwoTermsRequestDto() .addTermsItem(subset.toDto()) @@ -928,7 +916,7 @@ public CompletableFuture repeat( * @return A CompletableFuture containing a deterministic FAIR. */ public CompletableFuture determinize(Term term) { - return determinize(term, (ExecutionOptions) null); + return determinize(term, (OperationOptions) null); } /** @@ -943,7 +931,7 @@ public CompletableFuture determinize(Term term) { */ public CompletableFuture determinize( Term term, - ExecutionOptions options + OperationOptions options ) { TermRequestDto request = new TermRequestDto() .term(term.toDto()) diff --git a/src/main/java/com/regexsolver/api/ExecutionOptions.java b/src/main/java/com/regexsolver/api/ExecutionOptions.java deleted file mode 100644 index 66de26b..0000000 --- a/src/main/java/com/regexsolver/api/ExecutionOptions.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.regexsolver.api; - -import java.util.Optional; - -/** - * Options accepted by every RegexSolver operation. - * - *

Analyze operations and {@code determinize()} take this type rather than - * {@link OperationOptions}: they do not return a caller-shaped term, so - * {@code responseFormat} and {@code deterministic} would have no effect there. - * The two types are deliberately unrelated so that passing the wrong one is a - * compile error instead of a silently ignored field.

- */ -public class ExecutionOptions { - - private Integer executionTimeout; - - public ExecutionOptions() {} - - public ExecutionOptions(Integer executionTimeout) { - this.executionTimeout = executionTimeout; - } - - public static ExecutionOptions builder() { - return new ExecutionOptions(); - } - - public ExecutionOptions executionTimeout(Integer timeout) { - this.executionTimeout = timeout; - return this; - } - - public Optional getExecutionTimeout() { - return Optional.ofNullable(executionTimeout); - } -} diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 7d4873b..6835d88 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -48,7 +48,7 @@ public RegexSolverClient build() { * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ public Cardinality getCardinality(Term term) { - return getCardinality(term, (ExecutionOptions) null); + return getCardinality(term, (OperationOptions) null); } /** @@ -58,7 +58,7 @@ public Cardinality getCardinality(Term term) { * @param options Options for the operation. * @return Cardinality object representing either an exact Integer, a BigInteger, or Infinite cardinality. */ - public Cardinality getCardinality(Term term, ExecutionOptions options) { + public Cardinality getCardinality(Term term, OperationOptions options) { try { return asyncClient.getCardinality(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -77,7 +77,7 @@ public Cardinality getCardinality(Term term, ExecutionOptions options) { * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ public Length getLength(Term term) { - return getLength(term, (ExecutionOptions) null); + return getLength(term, (OperationOptions) null); } /** @@ -87,7 +87,7 @@ public Length getLength(Term term) { * @param options Options for the operation. * @return Length object with `min` and `max` integers. Limits are null if unbounded or undefined. */ - public Length getLength(Term term, ExecutionOptions options) { + public Length getLength(Term term, OperationOptions options) { try { return asyncClient.getLength(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -106,7 +106,7 @@ public Length getLength(Term term, ExecutionOptions options) { * @return true if the language is completely empty, false otherwise. */ public boolean isEmpty(Term term) { - return isEmpty(term, (ExecutionOptions) null); + return isEmpty(term, (OperationOptions) null); } /** @@ -116,7 +116,7 @@ public boolean isEmpty(Term term) { * @param options Options for the operation. * @return true if the language is completely empty, false otherwise. */ - public boolean isEmpty(Term term, ExecutionOptions options) { + public boolean isEmpty(Term term, OperationOptions options) { try { return asyncClient.isEmpty(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -135,7 +135,7 @@ public boolean isEmpty(Term term, ExecutionOptions options) { * @return true if the term strictly matches the empty string ("") and nothing else. */ public boolean isEmptyString(Term term) { - return isEmptyString(term, (ExecutionOptions) null); + return isEmptyString(term, (OperationOptions) null); } /** @@ -145,7 +145,7 @@ public boolean isEmptyString(Term term) { * @param options Options for the operation. * @return true if the term strictly matches the empty string ("") and nothing else. */ - public boolean isEmptyString(Term term, ExecutionOptions options) { + public boolean isEmptyString(Term term, OperationOptions options) { try { return asyncClient.isEmptyString(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -164,7 +164,7 @@ public boolean isEmptyString(Term term, ExecutionOptions options) { * @return true if the term matches every possible string. */ public boolean isTotal(Term term) { - return isTotal(term, (ExecutionOptions) null); + return isTotal(term, (OperationOptions) null); } /** @@ -174,7 +174,7 @@ public boolean isTotal(Term term) { * @param options Options for the operation. * @return true if the term matches every possible string. */ - public boolean isTotal(Term term, ExecutionOptions options) { + public boolean isTotal(Term term, OperationOptions options) { try { return asyncClient.isTotal(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -194,7 +194,7 @@ public boolean isTotal(Term term, ExecutionOptions options) { * @return true if the term's automaton is deterministic. */ public boolean isDeterministic(Term term) { - return isDeterministic(term, (ExecutionOptions) null); + return isDeterministic(term, (OperationOptions) null); } /** @@ -205,7 +205,7 @@ public boolean isDeterministic(Term term) { * @param options Options for the operation. * @return true if the term's automaton is deterministic. */ - public boolean isDeterministic(Term term, ExecutionOptions options) { + public boolean isDeterministic(Term term, OperationOptions options) { try { return asyncClient.isDeterministic(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -224,7 +224,7 @@ public boolean isDeterministic(Term term, ExecutionOptions options) { * @return A valid regular expression string representing the language. */ public String getPattern(Term term) { - return getPattern(term, (ExecutionOptions) null); + return getPattern(term, (OperationOptions) null); } /** @@ -234,7 +234,7 @@ public String getPattern(Term term) { * @param options Options for the operation. * @return A valid regular expression string representing the language. */ - public String getPattern(Term term, ExecutionOptions options) { + public String getPattern(Term term, OperationOptions options) { try { return asyncClient.getPattern(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -253,7 +253,7 @@ public String getPattern(Term term, ExecutionOptions options) { * @return The raw DOT syntax for Graphviz compilation. */ public String getDot(Term term) { - return getDot(term, (ExecutionOptions) null); + return getDot(term, (OperationOptions) null); } /** @@ -263,7 +263,7 @@ public String getDot(Term term) { * @param options Options for the operation. * @return The raw DOT syntax for Graphviz compilation. */ - public String getDot(Term term, ExecutionOptions options) { + public String getDot(Term term, OperationOptions options) { try { return asyncClient.getDot(term, options).join(); } catch (java.util.concurrent.CompletionException e) { @@ -283,7 +283,7 @@ public String getDot(Term term, ExecutionOptions options) { * @return true if they are entirely equivalent, false otherwise. */ public boolean equivalent(Term term1, Term term2) { - return equivalent(term1, term2, (ExecutionOptions) null); + return equivalent(term1, term2, (OperationOptions) null); } /** @@ -297,7 +297,7 @@ public boolean equivalent(Term term1, Term term2) { public boolean equivalent( Term term1, Term term2, - ExecutionOptions options + OperationOptions options ) { try { return asyncClient.equivalent(term1, term2, options).join(); @@ -318,7 +318,7 @@ public boolean equivalent( * @return true if every string matched by subset is also matched by superset. */ public boolean subset(Term subset, Term superset) { - return subset(subset, superset, (ExecutionOptions) null); + return subset(subset, superset, (OperationOptions) null); } /** @@ -332,7 +332,7 @@ public boolean subset(Term subset, Term superset) { public boolean subset( Term subset, Term superset, - ExecutionOptions options + OperationOptions options ) { try { return asyncClient.subset(subset, superset, options).join(); @@ -596,7 +596,7 @@ public Term repeat( * @return A deterministic FAIR. */ public Term determinize(Term term) { - return determinize(term, (ExecutionOptions) null); + return determinize(term, (OperationOptions) null); } /** @@ -609,7 +609,7 @@ public Term determinize(Term term) { * @param options Options for the operation. * @return A deterministic FAIR. */ - public Term determinize(Term term, ExecutionOptions options) { + public Term determinize(Term term, OperationOptions options) { try { return asyncClient.determinize(term, options).join(); } catch (java.util.concurrent.CompletionException e) { diff --git a/src/main/java/com/regexsolver/api/ResponseFormat.java b/src/main/java/com/regexsolver/api/ResponseFormat.java index 6398689..5e189d5 100644 --- a/src/main/java/com/regexsolver/api/ResponseFormat.java +++ b/src/main/java/com/regexsolver/api/ResponseFormat.java @@ -10,7 +10,7 @@ public enum ResponseFormat { REGEX, FAIR; - public FormatEnum toDto() { + FormatEnum toDto() { switch (this) { case ANY: return FormatEnum.ANY; From 3ef7a5a6a8fa6c4684a9dba56cdfae88e8b717f7 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 25 Jul 2026 21:54:18 +0200 Subject: [PATCH 20/24] Update OperationOptions.java --- .../java/com/regexsolver/api/OperationOptions.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java index 3846044..157d39f 100644 --- a/src/main/java/com/regexsolver/api/OperationOptions.java +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -4,6 +4,10 @@ /** * Options for RegexSolver operations. + * + *

Not every option is relevant to every operation: an option is ignored by any operation + * it does not apply to. For instance the options describing the returned term have no effect + * on an operation that does not return one. */ public class OperationOptions { @@ -25,11 +29,17 @@ public static OperationOptions builder() { return new OperationOptions(); } + /** + * Maximum time, in seconds, the engine may spend on the operation before aborting it. + */ public OperationOptions executionTimeout(Integer timeout) { this.executionTimeout = timeout; return this; } + /** + * Format of the term returned by the operation. + */ public OperationOptions responseFormat(ResponseFormat format) { this.responseFormat = format; return this; From ee50a7c633f0ee2c99ce9f08a9075928288c7c0d Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 25 Jul 2026 22:14:57 +0200 Subject: [PATCH 21/24] Align repo with the JS and Python SDKs, and fix the test suite The pom did not pin maven-surefire-plugin, so Maven's default 2.12.4 ran zero tests: the JUnit 5 suite had never executed in CI. Pinning surefire 3.2.5 exposed 20 broken tests, which in turn surfaced a real bug. module-info.java did not open the generated DTO package to Jackson, so on the module path every readValue() threw InaccessibleObjectException. That exception is swallowed in mapException(), collapsing every API error into a generic BadRequestException instead of InvalidJsonException, TooManyTermsException, QuotaExceededException and friends. The remaining failures were stale assertions: Optional-returning getters compared with isEqualTo, a Python-style Term repr, and Mockito stubs on overloads the client no longer calls. Mockito is bumped to 5.20 so the build also works on current JDKs. Consistency with the other two SDKs: - maven.yml -> ci.yml, named CI, triggered on main, Java matrix now includes 11 (the documented and published minimum) - publish.yml runs tests before deploying, imports the GPG key with GPG_PASSPHRASE (GPG_SIGNING_PASSPHRASE was never defined), uses setup-java@v4 and drops the -P release profile absent from the pom - README: options paragraph now describes OperationOptions, the only options type this SDK has; installation layout, ResponseFormat.ANY note and typo fix aligned with the JS and Python READMEs - executionTimeout javadoc said seconds; the API takes milliseconds - dropped the unused generated copy of openapi.yaml and rewrote .gitignore in the shared layout Co-Authored-By: Claude Opus 5 --- .github/workflows/ci.yml | 29 + .github/workflows/maven.yml | 30 - .github/workflows/publish.yml | 30 +- .gitignore | 43 +- .openapi-generator-ignore | 2 +- .openapi-generator/FILES | 1 - README.md | 10 +- api/openapi.yaml | 1986 ----------------- pom.xml | 8 +- .../com/regexsolver/api/OperationOptions.java | 2 +- src/main/java/module-info.java | 5 + .../api/AsyncRegexSolverClientTest.java | 4 +- .../java/com/regexsolver/api/ModelsTest.java | 16 +- .../api/RegexSolverClientTest.java | 44 +- 14 files changed, 116 insertions(+), 2094 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/maven.yml delete mode 100644 api/openapi.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c27c9cc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Test (Java ${{ matrix.java-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java-version: ["11", "17", "21"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK ${{ matrix.java-version }} + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: "temurin" + cache: "maven" + + - name: Build and test with Maven + run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index abff5a2..0000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven -# -# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech) - -name: Java CI with Maven - -on: - push: - branches: [ main, master ] - pull_request: - branches: [ main, master ] - -jobs: - build: - name: Build RegexSolver - runs-on: ubuntu-latest - strategy: - matrix: - java: [ 17, 21 ] - steps: - - uses: actions/checkout@v4 - - name: Set up JDK - uses: actions/setup-java@v4 - with: - java-version: ${{ matrix.java }} - distribution: 'temurin' - cache: maven - - name: Build with Maven - run: mvn -B package --no-transfer-progress --file pom.xml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 85067f9..84a1a75 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,25 +3,33 @@ name: Publish to Maven Central on: push: tags: - - 'v*' + - "v*" jobs: - build: + publish: + name: Publish to Maven Central runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 + - name: Set up JDK 11 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: - java-version: '11' - distribution: 'temurin' - cache: maven - - name: Build and Deploy + java-version: "11" + distribution: "temurin" + cache: "maven" + + - name: Import GPG signing key env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} run: | - echo $GPG_PRIVATE_KEY | base64 --decode | gpg --import --batch --yes --pinentry-mode loopback --passphrase "$GPG_SIGNING_PASSPHRASE" - mvn clean deploy -P release --settings .github/settings.xml + echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --import --batch --yes --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" + + - name: Build, test and deploy + env: + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: mvn -B clean deploy --no-transfer-progress --settings .github/settings.xml diff --git a/.gitignore b/.gitignore index 2f11247..cf5010c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,37 +1,28 @@ +# Build output target/ -!.mvn/wrapper/maven-wrapper.jar +build/ !**/src/main/**/target/ !**/src/test/**/target/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +# Dependencies +!.mvn/wrapper/maven-wrapper.jar -### IntelliJ IDEA ### +# Environment +.env + +# IDE .idea/ -*.iws +.vscode/ *.iml +*.iws *.ipr - -### Eclipse ### -.apt_generated .classpath -.factorypath .project -.settings -.springBeans -.sts4-cache - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ +.settings/ +.factorypath +.apt_generated -### Mac OS ### +# OS .DS_Store - -.env \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 63474a0..546eb45 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -5,8 +5,8 @@ pom.xml git_push.sh .travis.yml .gitlab-ci.yml -pyproject.toml .github/ +api/ docs/ test/ README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index c4cd2e2..95a1ddb 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,4 +1,3 @@ -api/openapi.yaml src/main/java/com/regexsolver/api/generated/ApiClient.java src/main/java/com/regexsolver/api/generated/ApiException.java src/main/java/com/regexsolver/api/generated/ApiResponse.java diff --git a/README.md b/README.md index 20b0271..d990de4 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,6 @@ ## Installation -Requirements: **Java >= 11** - ### Maven ```xml @@ -23,6 +21,8 @@ Requirements: **Java >= 11** implementation "com.regexsolver.api:RegexSolver:1.1.0" ``` +Requirements: **Java >= 11** + ## Quick Start 1. Create an API token in the [Developer Console](https://console.regexsolver.com/). @@ -93,7 +93,7 @@ The API can handle terms in two formats: - `regex`: a regular expression pattern - `fair`: FAIR (Fast Automaton Internal Representation), a stable, signed format used internally by the engine -By default, the engine returns whatever the operation produces, with no extra convertion. Override with `OperationOptions`: +By default, the engine returns whatever the operation produces, with no extra conversion. Override with `OperationOptions`, accepted by the operations that return a term: ```java import com.regexsolver.api.ResponseFormat; @@ -109,6 +109,8 @@ Term result2 = client.union(term1, term2, new OperationOptions().responseFormat( System.out.println(result2); // fair=... ``` +If the format does not matter, omit `responseFormat` or set it to `ResponseFormat.ANY`. + Regardless of the format, you can always call `getPattern()` to obtain the regex pattern of a term. ## Bounding execution time @@ -134,7 +136,7 @@ Timeout is best effort. The exact time is not guaranteed. ## API Overview -`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. Every method accepts an optional options object as its last parameter: operations that return a term take `OperationOptions` (`responseFormat`, `deterministic`, `executionTimeout`), while analyze operations and `determinize()` take `ExecutionOptions` (`executionTimeout` only) — the response format is not theirs to choose. +`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. Every method accepts an optional `OperationOptions` as its last parameter (`responseFormat`, `deterministic`, `executionTimeout`). An option that does not apply to an operation is ignored: analyze operations and `determinize()` only honour `executionTimeout` — the response format is not theirs to choose. ### Analyze diff --git a/api/openapi.yaml b/api/openapi.yaml deleted file mode 100644 index 85ca9ec..0000000 --- a/api/openapi.yaml +++ /dev/null @@ -1,1986 +0,0 @@ -openapi: 3.0.3 -info: - title: RegexSolver - version: 1.1.0 -servers: -- url: https://api.regexsolver.com/v1 -security: -- BearerAuth: [] -tags: -- description: "Inspect properties of a term, such as cardinality, length, or equivalence." - name: Analyze -- description: Derive new terms from one or more input terms. - name: Compute -- description: Produce concrete output from a term. - name: Generate -paths: - /analyze/cardinality: - post: - description: Compute how many strings the term matches. - operationId: cardinality - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: integer - value: 26 - schema: - $ref: "#/components/schemas/cardinality_200_response" - description: Cardinality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Cardinality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/dot: - post: - description: Build a Graphviz DOT representation of the term's automaton. - operationId: dot - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[a-z]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: string - value: "digraph Automaton {\n\trankdir = LR;\n\t0\t[shape=circle,label=\"\ - 0\"];\n\tinitial [shape=plaintext,label=\"\"];\n\tinitial -> 0\n\ - \t0 -> 1 [label=\"[a-z]\"]\n\t1\t[shape=doublecircle,label=\"\ - 1\"];\n}" - schema: - $ref: "#/components/schemas/dot_200_response" - description: Graphviz DOT representation. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Graphviz DOT - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty: - post: - description: Check if the term matches no strings. - operationId: empty - requestBody: - content: - application/json: - example: - term: - type: regex - value: "[]" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty language result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Empty - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/empty_string: - post: - description: Check if the term matches only the empty string. - operationId: empty_string - requestBody: - content: - application/json: - example: - term: - type: regex - value: "" - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Empty string only result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Empty String Only - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/total: - post: - description: Check if the term matches all the possible strings. - operationId: total - requestBody: - content: - application/json: - example: - term: - type: regex - value: .* - schema: - $ref: "#/components/schemas/TermRequest" - required: true - responses: - "200": - content: - application/json: - example: - success: true - data: - type: boolean - value: true - schema: - $ref: "#/components/schemas/empty_200_response" - description: Totality result. - "400": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse400" - description: Bad request - "401": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse401" - description: Unauthorized - "403": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse403" - description: Forbidden - "404": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Not found - "429": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Too many requests - headers: - Retry-After: - description: Number of seconds to wait before retrying. - explode: false - schema: - type: integer - style: simple - "500": - content: - application/json: - schema: - $ref: "#/components/schemas/ErrorResponse" - description: Internal server error - summary: Totality - tags: - - Analyze - x-content-type: application/json - x-accepts: - - application/json - /analyze/deterministic: - post: - description: Check if the term's automaton is deterministic. Only a deterministic - FAIR guarantees consistent string ordering across paginated /generate/strings - requests; call /compute/determinize first if this is false. - operationId: deterministic - requestBody: - content: - application/json: - example: - term: - type: fair - value: "2.21 2.1.1 5.10.2 - 5.11.0 + 3.2.5 + 5.20.0 3.25.3 @@ -131,6 +132,11 @@ 11 + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + org.apache.maven.plugins maven-source-plugin diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java index 157d39f..56105be 100644 --- a/src/main/java/com/regexsolver/api/OperationOptions.java +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -30,7 +30,7 @@ public static OperationOptions builder() { } /** - * Maximum time, in seconds, the engine may spend on the operation before aborting it. + * Maximum time, in milliseconds, the engine may spend on the operation before aborting it. */ public OperationOptions executionTimeout(Integer timeout) { this.executionTimeout = timeout; diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index c2f6ee5..2def0e9 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -2,6 +2,11 @@ exports com.regexsolver.api; exports com.regexsolver.api.exceptions; + // Jackson reflects over the generated DTOs to (de)serialize request and + // response bodies; without this the package stays closed on the module path. + opens com.regexsolver.api.generated.model to + com.fasterxml.jackson.databind; + requires java.net.http; requires java.logging; requires com.fasterxml.jackson.annotation; diff --git a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java index 253847f..4e8eedc 100644 --- a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java @@ -110,8 +110,8 @@ void testGetLength() { Length result = client.getLength(term).join(); - assertThat(result.getMin()).isEqualTo(3); - assertThat(result.getMax()).isEqualTo(3); + assertThat(result.getMin()).contains(3); + assertThat(result.getMax()).contains(3); } @Test diff --git a/src/test/java/com/regexsolver/api/ModelsTest.java b/src/test/java/com/regexsolver/api/ModelsTest.java index 83ca486..5a12757 100644 --- a/src/test/java/com/regexsolver/api/ModelsTest.java +++ b/src/test/java/com/regexsolver/api/ModelsTest.java @@ -112,8 +112,8 @@ void testCardinalityInfinite() { @Test void testLength() { Length length = new Length(1, 5); - assertThat(length.getMin()).isEqualTo(1); - assertThat(length.getMax()).isEqualTo(5); + assertThat(length.getMin()).contains(1); + assertThat(length.getMax()).contains(5); assertThat(length.isEmpty()).contains(false); assertThat(length.isEmptyString()).contains(false); assertThat(length.isTotal()).contains(false); @@ -127,8 +127,8 @@ void testLengthFromDto() { genLen.setMax(5); Length lengthObj = Length.fromDto(genLen); - assertThat(lengthObj.getMin()).isEqualTo(1); - assertThat(lengthObj.getMax()).isEqualTo(5); + assertThat(lengthObj.getMin()).contains(1); + assertThat(lengthObj.getMax()).contains(5); } @Test @@ -192,10 +192,10 @@ void testTermSerializeDeserialize() { assertThat(deserialized.hashCode()).isEqualTo(term.hashCode()); Term fairTerm = Term.fair("payload"); - assertThat(Term.deserialize(fairTerm.serialize())).isEqualTo(fairTerm); + assertThat(Term.deserialize(fairTerm.serialize())).contains(fairTerm); - assertThat(Term.deserialize("invalid")).isNull(); - assertThat(Term.deserialize("unknown=value")).isNull(); + assertThat(Term.deserialize("invalid")).isEmpty(); + assertThat(Term.deserialize("unknown=value")).isEmpty(); } @Test @@ -215,6 +215,6 @@ void testTermIsMatch() { @Test void testTermRepr() { Term term = Term.regex("abc"); - assertThat(term.toString()).isEqualTo(""); + assertThat(term.toString()).isEqualTo("regex=abc"); } } diff --git a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java index 214035b..bea61aa 100644 --- a/src/test/java/com/regexsolver/api/RegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/RegexSolverClientTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.verify; @@ -40,7 +41,7 @@ void testSyncClientGetCardinality() { Term term = Term.regex("abc"); Cardinality.Integer mockResult = new Cardinality.Integer(42L); - when(asyncClient.getCardinality(any())).thenReturn( + when(asyncClient.getCardinality(any(), isNull())).thenReturn( CompletableFuture.completedFuture(mockResult) ); @@ -50,35 +51,35 @@ void testSyncClientGetCardinality() { assertThat(((Cardinality.Integer) result).getValue()).isEqualTo(42L); // Verify the async client was called - verify(asyncClient).getCardinality(term); + verify(asyncClient).getCardinality(term, null); } @Test void testSyncClientIsEmpty() { Term term = Term.regex("abc"); - when(asyncClient.isEmpty(any())).thenReturn( + when(asyncClient.isEmpty(any(), isNull())).thenReturn( CompletableFuture.completedFuture(false) ); boolean result = client.isEmpty(term); assertThat(result).isFalse(); - verify(asyncClient).isEmpty(term); + verify(asyncClient).isEmpty(term, null); } @Test void testSyncClientIsDeterministic() { Term term = Term.fair("payload"); - when(asyncClient.isDeterministic(any())).thenReturn( + when(asyncClient.isDeterministic(any(), isNull())).thenReturn( CompletableFuture.completedFuture(true) ); boolean result = client.isDeterministic(term); assertThat(result).isTrue(); - verify(asyncClient).isDeterministic(term); + verify(asyncClient).isDeterministic(term, null); } @Test @@ -86,14 +87,14 @@ void testSyncClientDeterminize() { Term term = Term.regex("a"); Term mockResultTerm = Term.fair("fair-payload"); - when(asyncClient.determinize(any())).thenReturn( + when(asyncClient.determinize(any(), isNull())).thenReturn( CompletableFuture.completedFuture(mockResultTerm) ); Term result = client.determinize(term); assertThat(result.getFair()).contains("fair-payload"); - verify(asyncClient).determinize(term); + verify(asyncClient).determinize(term, null); } @Test @@ -103,17 +104,14 @@ void testSyncClientUnion() { Term mockResultTerm = Term.regex("a|b"); List termList = List.of(term1, term2); - // We mock the format and timeout overloaded method since the base - // concat/union/intersection methods in AsyncClient pass 'null' down. - when(asyncClient.union(any(), isNull(), isNull())).thenReturn( + when(asyncClient.union(anyList(), isNull())).thenReturn( CompletableFuture.completedFuture(mockResultTerm) ); - // Let's assume the sync client passes down to the async client's 3-arg method Term result = client.union(termList); assertThat(result.getPattern()).contains("a|b"); - verify(asyncClient).union(termList); + verify(asyncClient).union(termList, null); } @Test @@ -121,14 +119,14 @@ void testSyncClientComplement() { Term term = Term.regex(".*a.*"); Term mockResultTerm = Term.regex("[^a].*"); - when(asyncClient.complement(any())).thenReturn( + when(asyncClient.complement(any(), isNull())).thenReturn( CompletableFuture.completedFuture(mockResultTerm) ); Term result = client.complement(term); assertThat(result.getPattern()).contains("[^a].*"); - verify(asyncClient).complement(term); + verify(asyncClient).complement(term, null); } @Test @@ -136,15 +134,15 @@ void testSyncClientGetLength() { Term term = Term.regex("(abc)?d"); Length mockLength = new Length(1, 4); - when(asyncClient.getLength(any())).thenReturn( + when(asyncClient.getLength(any(), isNull())).thenReturn( CompletableFuture.completedFuture(mockLength) ); Length result = client.getLength(term); - assertThat(result.getMin()).isEqualTo(1); - assertThat(result.getMax()).isEqualTo(4); - verify(asyncClient).getLength(term); + assertThat(result.getMin()).contains(1); + assertThat(result.getMax()).contains(4); + verify(asyncClient).getLength(term, null); } @Test @@ -154,14 +152,14 @@ void testSyncClientIntersection() { Term mockResultTerm = Term.regex("a"); List termList = List.of(term1, term2); - when(asyncClient.intersection(any(), isNull(), isNull())).thenReturn( + when(asyncClient.intersection(anyList(), isNull())).thenReturn( CompletableFuture.completedFuture(mockResultTerm) ); Term result = client.intersection(termList); assertThat(result.getPattern()).contains("a"); - verify(asyncClient).intersection(termList); + verify(asyncClient).intersection(termList, null); } @Test @@ -169,13 +167,13 @@ void testSyncClientGenerateStrings() { Term term = Term.regex("a*"); List mockStrings = List.of("", "a", "aa"); - when(asyncClient.generateStrings(any(), eq(3), eq(0))).thenReturn( + when(asyncClient.generateStrings(any(), eq(3), eq(0), isNull())).thenReturn( CompletableFuture.completedFuture(mockStrings) ); List result = client.generateStrings(term, 3, 0); assertThat(result).containsExactly("", "a", "aa"); - verify(asyncClient).generateStrings(term, 3, 0); + verify(asyncClient).generateStrings(term, 3, 0, null); } } From 174ddeb4c4ceeb73feb4daf90081e0baa949b151 Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Tue, 4 Aug 2026 20:55:43 +0200 Subject: [PATCH 22/24] Update library --- .openapi-generator/FILES | 5 + README.md | 8 +- .../com/regexsolver/api/AccountLimits.java | 107 ++++++ .../api/AsyncRegexSolverClient.java | 310 +++++++++++++-- .../com/regexsolver/api/CharacterOrder.java | 34 ++ .../api/GenerateStringsOptions.java | 107 ++++++ .../java/com/regexsolver/api/PathOrder.java | 41 ++ .../java/com/regexsolver/api/RateLimiter.java | 25 +- .../regexsolver/api/RegexSolverClient.java | 43 +++ .../regexsolver/api/generated/ApiClient.java | 4 +- .../api/generated/ApiException.java | 4 +- .../api/generated/ApiResponse.java | 4 +- .../api/generated/Configuration.java | 4 +- .../com/regexsolver/api/generated/JSON.java | 6 +- .../com/regexsolver/api/generated/Pair.java | 4 +- .../api/generated/RFC3339DateFormat.java | 4 +- .../generated/RFC3339InstantDeserializer.java | 4 +- .../api/generated/RFC3339JavaTimeModule.java | 4 +- .../api/generated/ServerConfiguration.java | 4 +- .../api/generated/ServerVariable.java | 4 +- .../api/generated/api/AccountApi.java | 288 ++++++++++++++ .../api/generated/api/AnalyzeApi.java | 4 +- .../api/generated/api/ComputeApi.java | 4 +- .../api/generated/api/GenerateApi.java | 12 +- .../model/AbstractOpenApiSchema.java | 4 +- .../api/generated/model/AccountLimitsDto.java | 361 ++++++++++++++++++ .../api/generated/model/BooleanDto.java | 4 +- .../model/Cardinality200ResponseDto.java | 4 +- .../model/CardinalityBigIntegerDto.java | 4 +- .../api/generated/model/CardinalityDto.java | 4 +- .../model/CardinalityInfiniteDto.java | 4 +- .../model/CardinalityIntegerDto.java | 4 +- .../generated/model/Concat200ResponseDto.java | 4 +- .../generated/model/Dot200ResponseDto.java | 4 +- .../generated/model/Empty200ResponseDto.java | 4 +- .../generated/model/ErrorResponse400Dto.java | 4 +- .../generated/model/ErrorResponse401Dto.java | 4 +- .../generated/model/ErrorResponse403Dto.java | 4 +- .../api/generated/model/ErrorResponseDto.java | 4 +- .../generated/model/ExecutionOptionsDto.java | 4 +- .../model/FairResponseOptionsDto.java | 4 +- .../GenerateStringsCharacterOrderDto.java | 78 ++++ .../model/GenerateStringsPathOrderDto.java | 80 ++++ .../model/GenerateStringsRequestDto.java | 248 +++++++++++- .../model/GenerateStringsResponseDto.java | 4 +- .../generated/model/Length200ResponseDto.java | 4 +- .../api/generated/model/LengthDto.java | 4 +- .../generated/model/Limits200ResponseDto.java | 185 +++++++++ .../generated/model/MultiTermsRequestDto.java | 4 +- .../api/generated/model/RepeatRequestDto.java | 4 +- .../generated/model/RequestOptionsDto.java | 4 +- .../generated/model/ResponseOptionsDto.java | 4 +- .../api/generated/model/StringDto.java | 4 +- .../model/Strings200ResponseDto.java | 4 +- .../api/generated/model/StringsDto.java | 4 +- .../api/generated/model/TermDto.java | 4 +- .../api/generated/model/TermFairDto.java | 4 +- .../generated/model/TermFairMetadataDto.java | 4 +- .../api/generated/model/TermRegexDto.java | 4 +- .../api/generated/model/TermRequestDto.java | 4 +- .../generated/model/TwoTermsRequestDto.java | 4 +- .../api/AsyncRegexSolverClientTest.java | 338 +++++++++++++++- .../com/regexsolver/api/RateLimiterTest.java | 39 ++ 63 files changed, 2333 insertions(+), 158 deletions(-) create mode 100644 src/main/java/com/regexsolver/api/AccountLimits.java create mode 100644 src/main/java/com/regexsolver/api/CharacterOrder.java create mode 100644 src/main/java/com/regexsolver/api/GenerateStringsOptions.java create mode 100644 src/main/java/com/regexsolver/api/PathOrder.java create mode 100644 src/main/java/com/regexsolver/api/generated/api/AccountApi.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/AccountLimitsDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/GenerateStringsCharacterOrderDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/GenerateStringsPathOrderDto.java create mode 100644 src/main/java/com/regexsolver/api/generated/model/Limits200ResponseDto.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 95a1ddb..776575b 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -9,10 +9,12 @@ src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java src/main/java/com/regexsolver/api/generated/ServerConfiguration.java src/main/java/com/regexsolver/api/generated/ServerVariable.java +src/main/java/com/regexsolver/api/generated/api/AccountApi.java src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java src/main/java/com/regexsolver/api/generated/api/ComputeApi.java src/main/java/com/regexsolver/api/generated/api/GenerateApi.java src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +src/main/java/com/regexsolver/api/generated/model/AccountLimitsDto.java src/main/java/com/regexsolver/api/generated/model/BooleanDto.java src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -28,10 +30,13 @@ src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java +src/main/java/com/regexsolver/api/generated/model/GenerateStringsCharacterOrderDto.java +src/main/java/com/regexsolver/api/generated/model/GenerateStringsPathOrderDto.java src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/LengthDto.java +src/main/java/com/regexsolver/api/generated/model/Limits200ResponseDto.java src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java diff --git a/README.md b/README.md index d990de4..24e9b05 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ Timeout is best effort. The exact time is not guaranteed. ## API Overview -`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. Every method accepts an optional `OperationOptions` as its last parameter (`responseFormat`, `deterministic`, `executionTimeout`). An option that does not apply to an operation is ignored: analyze operations and `determinize()` only honour `executionTimeout` — the response format is not theirs to choose. +`RegexSolverClient` and `AsyncRegexSolverClient` expose the following methods. Every method accepts an optional `OperationOptions` as its last parameter (`responseFormat`, `deterministic`, `executionTimeout`). An option that does not apply to an operation is ignored: analyze operations and `determinize()` only honour `executionTimeout`; the response format is not theirs to choose. `generateStrings()` additionally accepts a `GenerateStringsOptions` carrying its ordering, seed, length and charset options. ### Analyze @@ -151,7 +151,7 @@ Timeout is best effort. The exact time is not guaranteed. | `client.isEmptyString(term, options?)` | `boolean` | `true` if the term matches only the empty string. | | `client.isTotal(term, options?)` | `boolean` | `true` if the term matches all possible strings. | | `client.isDeterministic(term, options?)` | `boolean` | `true` if the term's automaton is deterministic. Only a deterministic FAIR guarantees consistent string ordering across paginated `generateStrings()` calls; call `determinize()` first if this is `false`. | -| `client.subset(term1, term2, options?)` | `boolean` | `true` if every string matched by `term1` is also matched by `term2`. | +| `client.subset(subset, superset, options?)` | `boolean` | `true` if every string matched by `subset` is also matched by `superset`. | *Note: For `AsyncRegexSolverClient`, these methods return `CompletableFuture`.* @@ -162,7 +162,7 @@ Timeout is best effort. The exact time is not guaranteed. | `client.complement(term, options?)` | `Term` | Computes the complement of the given term. | | `client.concat(term1, term2, ..., options?)` | `Term` | Concatenates multiple terms in order. | | `client.determinize(term, options?)` | `Term` | Computes a deterministic FAIR for the given term, suitable for consistent pagination with `generateStrings()`. | -| `client.difference(term1, term2, options?)` | `Term` | Computes the difference `term1 - term2`. | +| `client.difference(base, excluded, options?)` | `Term` | Computes the difference `base - excluded`. | | `client.intersection(term1, term2, ..., options?)` | `Term` | Computes the intersection of the given terms. | | `client.repeat(term, min, max, options?)` | `Term` | Computes the repetition of the term between `min` and `max` times. | | `client.union(term1, term2, ..., options?)` | `Term` | Computes the union of the given terms. | @@ -173,7 +173,7 @@ Timeout is best effort. The exact time is not guaranteed. | Method | Return | Description | | -------- | ------- | ------- | -| `client.generateStrings(term, limit, offset, options?)` | `List` | Generates up to `limit` unique strings matched by `term`, skipping the first `offset` strings. | +| `client.generateStrings(term, limit, offset, options?)` | `List` | Generates up to `limit` unique strings matched by `term`, skipping the first `offset` strings. Pass a `GenerateStringsOptions` to control `pathOrder`, `characterOrder`, `seed`, `minLength`, `maxLength` and `charset`. | *Note: For `AsyncRegexSolverClient`, this method returns `CompletableFuture>`.* diff --git a/src/main/java/com/regexsolver/api/AccountLimits.java b/src/main/java/com/regexsolver/api/AccountLimits.java new file mode 100644 index 0000000..8ba5f90 --- /dev/null +++ b/src/main/java/com/regexsolver/api/AccountLimits.java @@ -0,0 +1,107 @@ +package com.regexsolver.api; + +import com.regexsolver.api.generated.model.AccountLimitsDto; +import java.util.Objects; + +/** + * The plan limits currently applying to the account. + */ +public final class AccountLimits { + + private final long maxRequestsCount; + private final long maxRequestsRate; + private final long maxTermsCount; + private final long maxTimeout; + private final long maxStatesCount; + + AccountLimits( + long maxRequestsCount, + long maxRequestsRate, + long maxTermsCount, + long maxTimeout, + long maxStatesCount + ) { + this.maxRequestsCount = maxRequestsCount; + this.maxRequestsRate = maxRequestsRate; + this.maxTermsCount = maxTermsCount; + this.maxTimeout = maxTimeout; + this.maxStatesCount = maxStatesCount; + } + + static AccountLimits fromDto(AccountLimitsDto dto) { + return new AccountLimits( + dto.getMaxRequestsCount(), + dto.getMaxRequestsRate(), + dto.getMaxTermsCount(), + dto.getMaxTimeout(), + dto.getMaxStatesCount() + ); + } + + /** Maximum number of requests allowed per billing period. */ + public long getMaxRequestsCount() { + return maxRequestsCount; + } + + /** Maximum number of requests allowed per second. 0 means no rate limit is enforced. */ + public long getMaxRequestsRate() { + return maxRequestsRate; + } + + /** Maximum number of terms accepted in a single request. */ + public long getMaxTermsCount() { + return maxTermsCount; + } + + /** Maximum execution timeout per request, in milliseconds. */ + public long getMaxTimeout() { + return maxTimeout; + } + + /** Maximum number of automaton states an operation may build. */ + public long getMaxStatesCount() { + return maxStatesCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof AccountLimits)) return false; + AccountLimits that = (AccountLimits) o; + return ( + maxRequestsCount == that.maxRequestsCount && + maxRequestsRate == that.maxRequestsRate && + maxTermsCount == that.maxTermsCount && + maxTimeout == that.maxTimeout && + maxStatesCount == that.maxStatesCount + ); + } + + @Override + public int hashCode() { + return Objects.hash( + maxRequestsCount, + maxRequestsRate, + maxTermsCount, + maxTimeout, + maxStatesCount + ); + } + + @Override + public String toString() { + return ( + "" + ); + } +} diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index 24b9a84..f399d8a 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -4,15 +4,20 @@ import com.regexsolver.api.exceptions.*; import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.api.AccountApi; import com.regexsolver.api.generated.api.AnalyzeApi; import com.regexsolver.api.generated.api.ComputeApi; import com.regexsolver.api.generated.api.GenerateApi; import com.regexsolver.api.generated.model.*; import java.net.http.HttpHeaders; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -24,18 +29,36 @@ public final class AsyncRegexSolverClient { private static final String VERSION = "1.1.0"; + + // Retry policy for 429 responses: retry as long as the total wait stays + // within the budget, adding full jitter on top of `Retry-After` so + // concurrent waiters do not re-collide as a single burst. The values are + // shared across all the official clients — change them together. + private static final long RETRY_BUDGET_MS = 300_000; + private static final double JITTER_BASE_S = 0.25; + private static final double JITTER_CAP_S = 2.0; + private static final double DEFAULT_RETRY_AFTER_S = 1.0; + private final String apiToken; private final String baseUrl; private final RateLimiter rateLimiter; + private final AccountApi accountApi; private final AnalyzeApi analyzeApi; private final ComputeApi computeApi; private final GenerateApi generateApi; private final ObjectMapper objectMapper; + private final boolean autoBatch; + private final Integer maxTermsPerRequest; + private final AtomicReference> limitsFuture = + new AtomicReference<>(); + private volatile Integer serverMaxTerms; private AsyncRegexSolverClient(Builder builder) { this.apiToken = builder.apiToken; this.baseUrl = builder.baseUrl; this.rateLimiter = RateLimiter.getInstance(this.apiToken); + this.autoBatch = builder.autoBatch; + this.maxTermsPerRequest = builder.maxTermsPerRequest; ApiClient apiClient = new ApiClient(); apiClient.updateBaseUri(this.baseUrl); @@ -47,6 +70,7 @@ private AsyncRegexSolverClient(Builder builder) { requestBuilder.header("Authorization", "Bearer " + this.apiToken); }); + this.accountApi = new AccountApi(apiClient); this.analyzeApi = new AnalyzeApi(apiClient); this.computeApi = new ComputeApi(apiClient); this.generateApi = new GenerateApi(apiClient); @@ -61,6 +85,8 @@ public static final class Builder { private String apiToken; private String baseUrl = "https://api.regexsolver.com/v1"; + private boolean autoBatch = true; + private Integer maxTermsPerRequest; public Builder apiToken(String apiToken) { this.apiToken = apiToken; @@ -72,10 +98,35 @@ public Builder baseUrl(String baseUrl) { return this; } + /** + * When true (the default), calls to concat/intersection/union + * carrying more terms than the account's per-request limit are + * transparently split into several requests and folded back into one + * result. Each constituent request counts against the monthly quota. + */ + public Builder autoBatch(boolean autoBatch) { + this.autoBatch = autoBatch; + return this; + } + + /** + * Upper bound (>= 2) on the number of terms sent in a single request, + * overriding the limit fetched from the API when smaller. + */ + public Builder maxTermsPerRequest(Integer maxTermsPerRequest) { + this.maxTermsPerRequest = maxTermsPerRequest; + return this; + } + public AsyncRegexSolverClient build() { if (apiToken == null || apiToken.isEmpty()) { throw new IllegalArgumentException("apiToken is required"); } + if (maxTermsPerRequest != null && maxTermsPerRequest < 2) { + throw new IllegalArgumentException( + "maxTermsPerRequest must be at least 2" + ); + } return new AsyncRegexSolverClient(this); } } @@ -121,31 +172,63 @@ private RequestOptionsDto buildOptions(OperationOptions options) { private CompletableFuture executeWithRetry( Supplier> apiCall ) { - return executeWithRetry(apiCall, 0); + return executeWithRetry(apiCall, 0, null); } private CompletableFuture executeWithRetry( Supplier> apiCall, - int attempt + int attempt, + Long firstFailureAtMillis ) { - return rateLimiter - .waitIfNecessary() + CompletableFuture gate = rateLimiter.waitIfNecessary(); + if (attempt > 0) { + long jitterMillis = (long) (ThreadLocalRandom.current().nextDouble() * + Math.min(JITTER_BASE_S * Math.pow(2, attempt), JITTER_CAP_S) * + 1000); + gate = gate.thenCompose(v -> + CompletableFuture.runAsync( + () -> {}, + CompletableFuture.delayedExecutor( + Math.max(jitterMillis, 1), + java.util.concurrent.TimeUnit.MILLISECONDS + ) + ) + ); + } + return gate .thenCompose(v -> apiCall.get()) .exceptionallyCompose(ex -> { Throwable cause = ex.getCause() != null ? ex.getCause() : ex; if (cause instanceof ApiException) { ApiException apiEx = (ApiException) cause; - if (apiEx.getCode() == 429 && attempt < 5) { - double retryAfter = 1.0; + if (apiEx.getCode() == 429) { + double retryAfter = DEFAULT_RETRY_AFTER_S; HttpHeaders headers = apiEx.getResponseHeaders(); if (headers != null) { - retryAfter = headers - .firstValue("Retry-After") - .map(Double::parseDouble) - .orElse(1.0); + try { + retryAfter = headers + .firstValue("Retry-After") + .map(Double::parseDouble) + .orElse(DEFAULT_RETRY_AFTER_S); + } catch (NumberFormatException ignored) {} + } + long now = System.currentTimeMillis(); + long firstFailureAt = firstFailureAtMillis != null + ? firstFailureAtMillis + : now; + if ( + now - + firstFailureAt + + (long) (retryAfter * 1000) <= + RETRY_BUDGET_MS + ) { + rateLimiter.trigger(retryAfter); + return executeWithRetry( + apiCall, + attempt + 1, + firstFailureAt + ); } - rateLimiter.trigger(retryAfter); - return executeWithRetry(apiCall, attempt + 1); } throw mapException(apiEx); } @@ -307,6 +390,162 @@ private RegexSolverException mapException(ApiException ex) { } } + // --- ACCOUNT OPERATIONS --- + + /** + * Fetches the plan limits applying to the account asynchronously. + * + * The call never consumes request quota (it is only rate-limited) and the + * result is cached on the client, so calling it again is free. The cached + * maxTermsCount also drives auto-batching. + * + * @return A CompletableFuture containing the five plan limits. + */ + public CompletableFuture getAccountLimits() { + CompletableFuture existing = limitsFuture.get(); + if (existing != null) { + return existing; + } + CompletableFuture created = executeWithRetry(() -> + accountApi.limits() + ).thenApply(resp -> { + AccountLimits limits = AccountLimits.fromDto(resp.getData()); + serverMaxTerms = (int) Math.min( + limits.getMaxTermsCount(), + Integer.MAX_VALUE + ); + return limits; + }); + if (!limitsFuture.compareAndSet(null, created)) { + return limitsFuture.get(); + } + created.whenComplete((limits, error) -> { + if (error != null) { + // Cleared on failure so a later call can retry the fetch. + limitsFuture.compareAndSet(created, null); + } + }); + return created; + } + + // --- AUTO-BATCHING --- + + /** The largest term count to send in one request, when known. */ + private Integer effectiveMaxTerms() { + Integer serverMax = serverMaxTerms; + if (maxTermsPerRequest != null) { + return serverMax != null + ? Math.min(maxTermsPerRequest, serverMax) + : maxTermsPerRequest; + } + return serverMax; + } + + /** + * Run an n-ary operation (concat/intersection/union), transparently + * splitting the terms into several requests when they exceed the + * account's terms-per-request limit (auto-batching). + */ + private CompletableFuture runNary( + List terms, + OperationOptions options, + Function> op + ) { + Integer maxTerms = autoBatch ? effectiveMaxTerms() : null; + if (maxTerms != null && terms.size() > maxTerms) { + return fold(op, terms, options, maxTerms); + } + boolean limitWasKnown = maxTerms != null; + return naryCall(op, terms, options, true).exceptionallyCompose(ex -> { + Throwable cause = ex.getCause() != null ? ex.getCause() : ex; + if ( + !autoBatch || + limitWasKnown || + !(cause instanceof TooManyTermsException) + ) { + return CompletableFuture.failedFuture(cause); + } + return getAccountLimits() + .handle((limits, fetchError) -> + // A failed fetch falls back to surfacing the original + // TooManyTerms, never worse than without batching. + fetchError != null ? null : effectiveMaxTerms() + ) + .thenCompose(newMax -> { + if ( + newMax == null || newMax < 2 || terms.size() <= newMax + ) { + return CompletableFuture.failedFuture(cause); + } + return fold(op, terms, options, newMax); + }); + }); + } + + private CompletableFuture naryCall( + Function> op, + List batch, + OperationOptions options, + boolean isFinal + ) { + // Intermediate results are fed straight back into the next request, + // so only the final call carries the caller's response options; + // executionTimeout bounds every constituent request. + OperationOptions effective = isFinal + ? options + : intermediateOptions(options); + MultiTermsRequestDto request = new MultiTermsRequestDto() + .terms(batch.stream().map(Term::toDto).collect(Collectors.toList())) + .options(buildOptions(effective)); + return op.apply(request).thenApply(Term::fromDto); + } + + private static OperationOptions intermediateOptions( + OperationOptions options + ) { + if (options == null) { + return null; + } + return options + .getExecutionTimeout() + .map(timeout -> OperationOptions.builder().executionTimeout(timeout)) + .orElse(null); + } + + /** + * Left fold: combine the first {@code maxTerms} terms, then keep feeding + * the accumulated result back with the next {@code maxTerms - 1} terms. + * Left-associative, so concat order is preserved; union and intersection + * are commutative and unaffected. + */ + private CompletableFuture fold( + Function> op, + List terms, + OperationOptions options, + int maxTerms + ) { + CompletableFuture acc = naryCall( + op, + terms.subList(0, maxTerms), + options, + false + ); + int index = maxTerms; + while (index < terms.size()) { + int end = Math.min(index + maxTerms - 1, terms.size()); + final List chunk = terms.subList(index, end); + final boolean isFinal = end >= terms.size(); + acc = acc.thenCompose(accTerm -> { + List batch = new ArrayList<>(); + batch.add(accTerm); + batch.addAll(chunk); + return naryCall(op, batch, options, isFinal); + }); + index = end; + } + return acc; + } + // --- ANALYZE OPERATIONS --- /** @@ -721,11 +960,10 @@ public CompletableFuture concat( List terms, OperationOptions options ) { - MultiTermsRequestDto request = new MultiTermsRequestDto() - .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(options)); - return executeWithRetry(() -> computeApi.concat(request)).thenApply( - resp -> Term.fromDto(resp.getData()) + return runNary(terms, options, request -> + executeWithRetry(() -> computeApi.concat(request)).thenApply( + Concat200ResponseDto::getData + ) ); } @@ -760,12 +998,11 @@ public CompletableFuture intersection( List terms, OperationOptions options ) { - MultiTermsRequestDto request = new MultiTermsRequestDto() - .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(options)); - return executeWithRetry(() -> - computeApi.intersection(request) - ).thenApply(resp -> Term.fromDto(resp.getData())); + return runNary(terms, options, request -> + executeWithRetry(() -> computeApi.intersection(request)).thenApply( + Concat200ResponseDto::getData + ) + ); } /** @@ -799,11 +1036,10 @@ public CompletableFuture union( List terms, OperationOptions options ) { - MultiTermsRequestDto request = new MultiTermsRequestDto() - .terms(terms.stream().map(Term::toDto).collect(Collectors.toList())) - .options(buildOptions(options)); - return executeWithRetry(() -> computeApi.union(request)).thenApply( - resp -> Term.fromDto(resp.getData()) + return runNary(terms, options, request -> + executeWithRetry(() -> computeApi.union(request)).thenApply( + Concat200ResponseDto::getData + ) ); } @@ -965,7 +1201,8 @@ public CompletableFuture> generateStrings( * @param term The term to sample generated strings from. * @param limit The maximum number of unique strings to return. * @param offset Number of matched strings to skip before starting to collect the results. Used for pagination. - * @param options Options for the operation. + * @param options Options for the operation. Pass a {@link GenerateStringsOptions} + * to control ordering, seed, length bounds and charset. * @return A CompletableFuture containing a list of strings that match the term. */ public CompletableFuture> generateStrings( @@ -980,6 +1217,21 @@ public CompletableFuture> generateStrings( .offset(offset) .options(buildOptions(options)); + if (options instanceof GenerateStringsOptions) { + GenerateStringsOptions generateOptions = + (GenerateStringsOptions) options; + generateOptions + .getPathOrder() + .ifPresent(value -> request.pathOrder(value.toDto())); + generateOptions + .getCharacterOrder() + .ifPresent(value -> request.characterOrder(value.toDto())); + generateOptions.getSeed().ifPresent(request::seed); + generateOptions.getMinLength().ifPresent(request::minLength); + generateOptions.getMaxLength().ifPresent(request::maxLength); + generateOptions.getCharset().ifPresent(request::charset); + } + return executeWithRetry(() -> generateApi.strings(request)).thenApply( resp -> resp.getData().getStrings().getValue() ); diff --git a/src/main/java/com/regexsolver/api/CharacterOrder.java b/src/main/java/com/regexsolver/api/CharacterOrder.java new file mode 100644 index 0000000..c4c4051 --- /dev/null +++ b/src/main/java/com/regexsolver/api/CharacterOrder.java @@ -0,0 +1,34 @@ +package com.regexsolver.api; + +import com.regexsolver.api.generated.model.GenerateStringsCharacterOrderDto; + +/** + * Order in which the strings within each path are produced when generating + * strings. Orthogonal to {@link PathOrder}: it does not change what + * can be generated, only which strings are reached first. + */ +public enum CharacterOrder { + /** + * Expand each position from the low end of its character range first — a + * stable order returning the smallest witnesses of a path first. + */ + ASCENDING, + /** + * A permutation drawn from the seed, so the strings look like real + * inputs. Random in look only — generation stays reproducible. + */ + SHUFFLED; + + GenerateStringsCharacterOrderDto toDto() { + switch (this) { + case ASCENDING: + return GenerateStringsCharacterOrderDto.ASCENDING; + case SHUFFLED: + return GenerateStringsCharacterOrderDto.SHUFFLED; + default: + throw new IllegalArgumentException( + String.format("Unsupported CharacterOrder %s.", this) + ); + } + } +} diff --git a/src/main/java/com/regexsolver/api/GenerateStringsOptions.java b/src/main/java/com/regexsolver/api/GenerateStringsOptions.java new file mode 100644 index 0000000..65e267d --- /dev/null +++ b/src/main/java/com/regexsolver/api/GenerateStringsOptions.java @@ -0,0 +1,107 @@ +package com.regexsolver.api; + +import java.util.Optional; + +/** + * Options for generateStrings(), extending {@link OperationOptions} so it is + * accepted wherever an options object is. + */ +public final class GenerateStringsOptions extends OperationOptions { + + private PathOrder pathOrder; + private CharacterOrder characterOrder; + private Long seed; + private Integer minLength; + private Integer maxLength; + private String charset; + + public GenerateStringsOptions() {} + + public static GenerateStringsOptions builder() { + return new GenerateStringsOptions(); + } + + @Override + public GenerateStringsOptions executionTimeout(Integer timeout) { + super.executionTimeout(timeout); + return this; + } + + /** + * Order in which the paths (shapes) of the language are scheduled. + * Defaults to {@link PathOrder#SWEEP}. + */ + public GenerateStringsOptions pathOrder(PathOrder pathOrder) { + this.pathOrder = pathOrder; + return this; + } + + /** + * Order in which the strings within each path are produced. Defaults to + * {@link CharacterOrder#ASCENDING}. + */ + public GenerateStringsOptions characterOrder(CharacterOrder characterOrder) { + this.characterOrder = characterOrder; + return this; + } + + /** + * Seed behind the shuffled modes. The default seed is fixed, so two calls + * sharing a seed generate the same strings and {@code offset} pages + * through them consistently. + */ + public GenerateStringsOptions seed(Long seed) { + this.seed = seed; + return this; + } + + /** + * Shortest string to generate. Shorter strings are left out of the + * enumeration entirely, {@code offset} never counting them. + */ + public GenerateStringsOptions minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * Longest string to generate. + */ + public GenerateStringsOptions maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * Restricts generation to the given characters, e.g. {@code [a-z]}. Paths + * requiring a character outside it are dropped. + */ + public GenerateStringsOptions charset(String charset) { + this.charset = charset; + return this; + } + + public Optional getPathOrder() { + return Optional.ofNullable(pathOrder); + } + + public Optional getCharacterOrder() { + return Optional.ofNullable(characterOrder); + } + + public Optional getSeed() { + return Optional.ofNullable(seed); + } + + public Optional getMinLength() { + return Optional.ofNullable(minLength); + } + + public Optional getMaxLength() { + return Optional.ofNullable(maxLength); + } + + public Optional getCharset() { + return Optional.ofNullable(charset); + } +} diff --git a/src/main/java/com/regexsolver/api/PathOrder.java b/src/main/java/com/regexsolver/api/PathOrder.java new file mode 100644 index 0000000..ca88a81 --- /dev/null +++ b/src/main/java/com/regexsolver/api/PathOrder.java @@ -0,0 +1,41 @@ +package com.regexsolver.api; + +import com.regexsolver.api.generated.model.GenerateStringsPathOrderDto; + +/** + * Order in which the paths of the language are scheduled when generating + * strings — the shapes the term allows, as opposed to the characters + * filling them. + */ +public enum PathOrder { + /** + * Expand one path in full, shortest first, before moving to the next one. + * The cheapest way to page through a whole language. + */ + SWEEP, + /** + * Cover every path once before any path yields a second string. Best + * suited to deriving test cases. + */ + INTERLEAVE, + /** + * Interleave with same-length paths visited in an order drawn from the + * seed. + */ + SHUFFLED; + + GenerateStringsPathOrderDto toDto() { + switch (this) { + case SWEEP: + return GenerateStringsPathOrderDto.SWEEP; + case INTERLEAVE: + return GenerateStringsPathOrderDto.INTERLEAVE; + case SHUFFLED: + return GenerateStringsPathOrderDto.SHUFFLED; + default: + throw new IllegalArgumentException( + String.format("Unsupported PathOrder %s.", this) + ); + } + } +} diff --git a/src/main/java/com/regexsolver/api/RateLimiter.java b/src/main/java/com/regexsolver/api/RateLimiter.java index 6ad1f24..a40ff63 100644 --- a/src/main/java/com/regexsolver/api/RateLimiter.java +++ b/src/main/java/com/regexsolver/api/RateLimiter.java @@ -4,10 +4,16 @@ import java.time.Instant; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; /** * Global rate limiter shared by apiToken. + * + * Holds a single deadline. {@code trigger} keeps the later of the current and + * the new deadline; {@code waitIfNecessary} schedules a non-blocking delay + * (no thread is ever parked) and re-checks the deadline after every wake, so + * a deadline extended by a concurrent 429 is honored. */ class RateLimiter { @@ -28,19 +34,14 @@ public CompletableFuture waitIfNecessary() { Instant now = Instant.now(); Instant retryAt = retryAfter.get(); - if (retryAt.isAfter(now)) { - long delay = Duration.between(now, retryAt).toMillis(); - if (delay > 0) { - return CompletableFuture.runAsync(() -> { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - }); - } + if (!retryAt.isAfter(now)) { + return CompletableFuture.completedFuture(null); } - return CompletableFuture.completedFuture(null); + long delay = Math.max(Duration.between(now, retryAt).toMillis(), 1); + return CompletableFuture.runAsync( + () -> {}, + CompletableFuture.delayedExecutor(delay, TimeUnit.MILLISECONDS) + ).thenCompose(v -> waitIfNecessary()); } public void trigger(double seconds) { diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 6835d88..9ddaa05 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -34,11 +34,54 @@ public Builder baseUrl(String baseUrl) { return this; } + /** + * When true (the default), calls to concat/intersection/union + * carrying more terms than the account's per-request limit are + * transparently split into several requests and folded back into one + * result. Each constituent request counts against the monthly quota. + */ + public Builder autoBatch(boolean autoBatch) { + asyncBuilder.autoBatch(autoBatch); + return this; + } + + /** + * Upper bound (>= 2) on the number of terms sent in a single request, + * overriding the limit fetched from the API when smaller. + */ + public Builder maxTermsPerRequest(Integer maxTermsPerRequest) { + asyncBuilder.maxTermsPerRequest(maxTermsPerRequest); + return this; + } + public RegexSolverClient build() { return new RegexSolverClient(this); } } + // --- ACCOUNT OPERATIONS --- + + /** + * Fetches the plan limits applying to the account. + * + * The call never consumes request quota (it is only rate-limited) and the + * result is cached on the client, so calling it again is free. The cached + * maxTermsCount also drives auto-batching. + * + * @return The five plan limits. + */ + public AccountLimits getAccountLimits() { + try { + return asyncClient.getAccountLimits().join(); + } catch (java.util.concurrent.CompletionException e) { + if (e.getCause() instanceof RuntimeException) { + throw (RuntimeException) e.getCause(); + } + + throw e; + } + } + // --- ANALYZE OPERATIONS --- /** diff --git a/src/main/java/com/regexsolver/api/generated/ApiClient.java b/src/main/java/com/regexsolver/api/generated/ApiClient.java index 4bbd80e..e36d17b 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiClient.java +++ b/src/main/java/com/regexsolver/api/generated/ApiClient.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -53,7 +53,7 @@ *

The setter methods of this class return the current object to facilitate * a fluent style of configuration.

*/ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiClient { protected HttpClient.Builder builder; diff --git a/src/main/java/com/regexsolver/api/generated/ApiException.java b/src/main/java/com/regexsolver/api/generated/ApiException.java index fff69ce..ce86146 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiException.java +++ b/src/main/java/com/regexsolver/api/generated/ApiException.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -15,7 +15,7 @@ import java.net.http.HttpHeaders; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiException extends RuntimeException { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ApiResponse.java b/src/main/java/com/regexsolver/api/generated/ApiResponse.java index 745c52c..435f51e 100644 --- a/src/main/java/com/regexsolver/api/generated/ApiResponse.java +++ b/src/main/java/com/regexsolver/api/generated/ApiResponse.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -21,7 +21,7 @@ * * @param The type of data that is deserialized from response body */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ApiResponse { final private int statusCode; final private Map> headers; diff --git a/src/main/java/com/regexsolver/api/generated/Configuration.java b/src/main/java/com/regexsolver/api/generated/Configuration.java index a16c11c..47d3997 100644 --- a/src/main/java/com/regexsolver/api/generated/Configuration.java +++ b/src/main/java/com/regexsolver/api/generated/Configuration.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -17,7 +17,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Configuration { public static final String VERSION = "1.1.0"; diff --git a/src/main/java/com/regexsolver/api/generated/JSON.java b/src/main/java/com/regexsolver/api/generated/JSON.java index 8a28910..87e6757 100644 --- a/src/main/java/com/regexsolver/api/generated/JSON.java +++ b/src/main/java/com/regexsolver/api/generated/JSON.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Set; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class JSON { private ObjectMapper mapper; @@ -79,7 +79,7 @@ public static Class getClassForElement(JsonNode node, Class modelClass) { /** * Helper class to register the discriminator mappings. */ - @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") + @jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") private static class ClassDiscriminatorMapping { // The model class name. Class modelClass; diff --git a/src/main/java/com/regexsolver/api/generated/Pair.java b/src/main/java/com/regexsolver/api/generated/Pair.java index 7b3ffc0..021d2db 100644 --- a/src/main/java/com/regexsolver/api/generated/Pair.java +++ b/src/main/java/com/regexsolver/api/generated/Pair.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -13,7 +13,7 @@ package com.regexsolver.api.generated; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Pair { private final String name; private final String value; diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java index cd765b3..ad89cfe 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339DateFormat.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -21,7 +21,7 @@ import java.util.TimeZone; import com.fasterxml.jackson.databind.util.StdDateFormat; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339DateFormat extends DateFormat { private static final long serialVersionUID = 1L; private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC"); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java index 857b8d0..7b9f9ce 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339InstantDeserializer.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -28,7 +28,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeFeature; import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339InstantDeserializer extends InstantDeserializer { private static final long serialVersionUID = 1L; private final static boolean DEFAULT_NORMALIZE_ZONE_ID = JavaTimeFeature.NORMALIZE_DESERIALIZED_ZONE_ID.enabledByDefault(); diff --git a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java index b28b4a1..aa14b1e 100644 --- a/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java +++ b/src/main/java/com/regexsolver/api/generated/RFC3339JavaTimeModule.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -19,7 +19,7 @@ import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.Module.SetupContext; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RFC3339JavaTimeModule extends SimpleModule { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java index 76a7e3d..86872b4 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java +++ b/src/main/java/com/regexsolver/api/generated/ServerConfiguration.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -18,7 +18,7 @@ /** * Representing a Server configuration. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerConfiguration { public String URL; public String description; diff --git a/src/main/java/com/regexsolver/api/generated/ServerVariable.java b/src/main/java/com/regexsolver/api/generated/ServerVariable.java index 36f61c2..43b8681 100644 --- a/src/main/java/com/regexsolver/api/generated/ServerVariable.java +++ b/src/main/java/com/regexsolver/api/generated/ServerVariable.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -18,7 +18,7 @@ /** * Representing a Server Variable for server URL template substitution. */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ServerVariable { public String description; public String defaultValue; diff --git a/src/main/java/com/regexsolver/api/generated/api/AccountApi.java b/src/main/java/com/regexsolver/api/generated/api/AccountApi.java new file mode 100644 index 0000000..e396454 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/api/AccountApi.java @@ -0,0 +1,288 @@ +/* + * RegexSolver API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.regexsolver.api.generated.api; + +import com.regexsolver.api.generated.ApiClient; +import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.ApiResponse; +import com.regexsolver.api.generated.Configuration; +import com.regexsolver.api.generated.Pair; + +import com.regexsolver.api.generated.model.ErrorResponse401Dto; +import com.regexsolver.api.generated.model.ErrorResponseDto; +import com.regexsolver.api.generated.model.Limits200ResponseDto; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.io.InputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.net.http.HttpRequest; +import java.nio.channels.Channels; +import java.nio.channels.Pipe; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; + +import java.util.ArrayList; +import java.util.StringJoiner; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Consumer; + +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class AccountApi { + /** + * Utility class for extending HttpRequest.Builder functionality. + */ + private static class HttpRequestBuilderExtensions { + /** + * Adds additional headers to the provided HttpRequest.Builder. Useful for adding method/endpoint specific headers. + * + * @param builder the HttpRequest.Builder to which headers will be added + * @param headers a map of header names and values to add; may be null + * @return the same HttpRequest.Builder instance with the additional headers set + */ + static HttpRequest.Builder withAdditionalHeaders(HttpRequest.Builder builder, Map headers) { + if (headers != null) { + for (Map.Entry entry : headers.entrySet()) { + builder.header(entry.getKey(), entry.getValue()); + } + } + return builder; + } + } + private final HttpClient memberVarHttpClient; + private final ObjectMapper memberVarObjectMapper; + private final String memberVarBaseUri; + private final Consumer memberVarInterceptor; + private final Duration memberVarReadTimeout; + private final Consumer> memberVarResponseInterceptor; + private final Consumer> memberVarAsyncResponseInterceptor; + + public AccountApi() { + this(Configuration.getDefaultApiClient()); + } + + public AccountApi(ApiClient apiClient) { + memberVarHttpClient = apiClient.getHttpClient(); + memberVarObjectMapper = apiClient.getObjectMapper(); + memberVarBaseUri = apiClient.getBaseUri(); + memberVarInterceptor = apiClient.getRequestInterceptor(); + memberVarReadTimeout = apiClient.getReadTimeout(); + memberVarResponseInterceptor = apiClient.getResponseInterceptor(); + memberVarAsyncResponseInterceptor = apiClient.getAsyncResponseInterceptor(); + } + + + private ApiException getApiException(String operationId, HttpResponse response) { + try { + InputStream responseBody = ApiClient.getResponseBody(response); + String body = null; + if (responseBody != null) { + body = new String(responseBody.readAllBytes()); + responseBody.close(); + } + String message = formatExceptionMessage(operationId, response.statusCode(), body); + return new ApiException(response.statusCode(), message, response.headers(), body); + } catch (IOException e) { + return new ApiException(e); + } + } + + private String formatExceptionMessage(String operationId, int statusCode, String body) { + if (body == null || body.isEmpty()) { + body = "[no body]"; + } + return operationId + " call failed with: " + statusCode + " - " + body; + } + + /** + * Download file from the given response. + * + * @param response Response + * @return File + * @throws ApiException If fail to read file content from response and write to disk + */ + public File downloadFileFromResponse(HttpResponse response, InputStream responseBody) throws ApiException { + if (responseBody == null) { + throw new ApiException(new IOException("Response body is empty")); + } + try { + File file = prepareDownloadFile(response); + java.nio.file.Files.copy(responseBody, file.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + *

Prepare the file for download from the response.

+ * + * @param response a {@link java.net.http.HttpResponse} object. + * @return a {@link java.io.File} object. + * @throws java.io.IOException if any. + */ + private File prepareDownloadFile(HttpResponse response) throws IOException { + String filename = null; + java.util.Optional contentDisposition = response.headers().firstValue("Content-Disposition"); + if (contentDisposition.isPresent() && !"".equals(contentDisposition.get())) { + // Get filename from the Content-Disposition header. + java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + java.util.regex.Matcher matcher = pattern.matcher(contentDisposition.get()); + if (matcher.find()) + filename = matcher.group(1); + } + File file = null; + if (filename != null) { + java.nio.file.Path tempDir = java.nio.file.Files.createTempDirectory("swagger-gen-native"); + java.nio.file.Path filePath = java.nio.file.Files.createFile(tempDir.resolve(filename)); + file = filePath.toFile(); + tempDir.toFile().deleteOnExit(); // best effort cleanup + file.deleteOnExit(); // best effort cleanup + } else { + file = java.nio.file.Files.createTempFile("download-", "").toFile(); + file.deleteOnExit(); // best effort cleanup + } + return file; + } + + /** + * Limits + * Return the plan limits applying to the account. + * @return CompletableFuture<Limits200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture limits() throws ApiException { + return limits(null); + } + + /** + * Limits + * Return the plan limits applying to the account. + * @param headers Optional headers to include in the request + * @return CompletableFuture<Limits200ResponseDto> + * @throws ApiException if fails to make API call + */ + public CompletableFuture limits(Map headers) throws ApiException { + try { + return limitsWithHttpInfo(headers) + .thenApply(ApiResponse::getData); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + /** + * Limits + * Return the plan limits applying to the account. + * @return CompletableFuture<ApiResponse<Limits200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> limitsWithHttpInfo() throws ApiException { + return limitsWithHttpInfo(null); + } + + /** + * Limits + * Return the plan limits applying to the account. + * @param headers Optional headers to include in the request + * @return CompletableFuture<ApiResponse<Limits200ResponseDto>> + * @throws ApiException if fails to make API call + */ + public CompletableFuture> limitsWithHttpInfo(Map headers) throws ApiException { + try { + HttpRequest.Builder localVarRequestBuilder = limitsRequestBuilder(headers); + return memberVarHttpClient.sendAsync( + localVarRequestBuilder.build(), + HttpResponse.BodyHandlers.ofInputStream()).thenComposeAsync(localVarResponse -> { + if (memberVarAsyncResponseInterceptor != null) { + memberVarAsyncResponseInterceptor.accept(localVarResponse); + } + if (localVarResponse.statusCode()/ 100 != 2) { + return CompletableFuture.failedFuture(getApiException("limits", localVarResponse)); + } + try { + InputStream localVarResponseBody = ApiClient.getResponseBody(localVarResponse); + try { + if (localVarResponseBody == null) { + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + null + ) + ); + } + + + String responseBody = new String(localVarResponseBody.readAllBytes()); + Limits200ResponseDto responseValue = responseBody.isBlank()? null: memberVarObjectMapper.readValue(responseBody, new TypeReference() {}); + + return CompletableFuture.completedFuture( + new ApiResponse( + localVarResponse.statusCode(), + localVarResponse.headers().map(), + responseValue + ) + ); + } finally { + if (localVarResponseBody != null) { + localVarResponseBody.close(); + } + } + } catch (IOException e) { + return CompletableFuture.failedFuture(new ApiException(e)); + } + } + ); + } + catch (ApiException e) { + return CompletableFuture.failedFuture(e); + } + } + + private HttpRequest.Builder limitsRequestBuilder(Map headers) throws ApiException { + + HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder(); + + String localVarPath = "/account/limits"; + + localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath)); + + localVarRequestBuilder.header("Accept", "application/json"); + + localVarRequestBuilder.method("GET", HttpRequest.BodyPublishers.noBody()); + if (memberVarReadTimeout != null) { + localVarRequestBuilder.timeout(memberVarReadTimeout); + } + // Add custom headers if provided + localVarRequestBuilder = HttpRequestBuilderExtensions.withAdditionalHeaders(localVarRequestBuilder, headers); + if (memberVarInterceptor != null) { + memberVarInterceptor.accept(localVarRequestBuilder); + } + return localVarRequestBuilder; + } + +} diff --git a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java index 8f66df0..ee7f989 100644 --- a/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/AnalyzeApi.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -56,7 +56,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class AnalyzeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java index 7142e3d..8cb6303 100644 --- a/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/ComputeApi.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -55,7 +55,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ComputeApi { /** * Utility class for extending HttpRequest.Builder functionality. diff --git a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java index ac0a75f..b204531 100644 --- a/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java +++ b/src/main/java/com/regexsolver/api/generated/api/GenerateApi.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -52,7 +52,7 @@ import java.util.concurrent.CompletableFuture; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateApi { /** * Utility class for extending HttpRequest.Builder functionality. @@ -172,7 +172,7 @@ private File prepareDownloadFile(HttpResponse response) throws IOEx /** * Strings - * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings, scheduling the paths of the language in `pathOrder`, producing the strings within each path in `characterOrder`, confined to lengths between `minLength` and `maxLength` and to the characters of `charset`. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @return CompletableFuture<Strings200ResponseDto> * @throws ApiException if fails to make API call @@ -183,7 +183,7 @@ public CompletableFuture strings(@jakarta.annotation.Nonn /** * Strings - * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings, scheduling the paths of the language in `pathOrder`, producing the strings within each path in `characterOrder`, confined to lengths between `minLength` and `maxLength` and to the characters of `charset`. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<Strings200ResponseDto> @@ -201,7 +201,7 @@ public CompletableFuture strings(@jakarta.annotation.Nonn /** * Strings - * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings, scheduling the paths of the language in `pathOrder`, producing the strings within each path in `characterOrder`, confined to lengths between `minLength` and `maxLength` and to the characters of `charset`. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> * @throws ApiException if fails to make API call @@ -212,7 +212,7 @@ public CompletableFuture> stringsWithHttpInfo /** * Strings - * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. + * Generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings, scheduling the paths of the language in `pathOrder`, producing the strings within each path in `characterOrder`, confined to lengths between `minLength` and `maxLength` and to the characters of `charset`. Strings are only guaranteed to be distinct within a single call; pagination across calls is only consistent (no repeats or gaps) if `term` is deterministic. Call `/analyze/deterministic` to check, and `/compute/determinize` first if needed. * @param generateStringsRequestDto (required) * @param headers Optional headers to include in the request * @return CompletableFuture<ApiResponse<Strings200ResponseDto>> diff --git a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java index c4c0b00..6b195a3 100644 --- a/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java +++ b/src/main/java/com/regexsolver/api/generated/model/AbstractOpenApiSchema.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -22,7 +22,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/com/regexsolver/api/generated/model/AccountLimitsDto.java b/src/main/java/com/regexsolver/api/generated/model/AccountLimitsDto.java new file mode 100644 index 0000000..672d1fe --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/AccountLimitsDto.java @@ -0,0 +1,361 @@ +/* + * RegexSolver API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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 java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * The plan limits currently applying to the account. + */ +@JsonPropertyOrder({ + AccountLimitsDto.JSON_PROPERTY_TYPE, + AccountLimitsDto.JSON_PROPERTY_MAX_REQUESTS_COUNT, + AccountLimitsDto.JSON_PROPERTY_MAX_REQUESTS_RATE, + AccountLimitsDto.JSON_PROPERTY_MAX_TERMS_COUNT, + AccountLimitsDto.JSON_PROPERTY_MAX_TIMEOUT, + AccountLimitsDto.JSON_PROPERTY_MAX_STATES_COUNT +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class AccountLimitsDto { + /** + * Gets or Sets type + */ + public enum TypeEnum { + ACCOUNT_LIMITS(String.valueOf("accountLimits")); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static TypeEnum fromValue(String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + } + + public static final String JSON_PROPERTY_TYPE = "type"; + @jakarta.annotation.Nonnull + private TypeEnum type; + + public static final String JSON_PROPERTY_MAX_REQUESTS_COUNT = "maxRequestsCount"; + @jakarta.annotation.Nonnull + private Long maxRequestsCount; + + public static final String JSON_PROPERTY_MAX_REQUESTS_RATE = "maxRequestsRate"; + @jakarta.annotation.Nonnull + private Long maxRequestsRate; + + public static final String JSON_PROPERTY_MAX_TERMS_COUNT = "maxTermsCount"; + @jakarta.annotation.Nonnull + private Long maxTermsCount; + + public static final String JSON_PROPERTY_MAX_TIMEOUT = "maxTimeout"; + @jakarta.annotation.Nonnull + private Long maxTimeout; + + public static final String JSON_PROPERTY_MAX_STATES_COUNT = "maxStatesCount"; + @jakarta.annotation.Nonnull + private Long maxStatesCount; + + public AccountLimitsDto() { + } + + public AccountLimitsDto type(@jakarta.annotation.Nonnull TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public TypeEnum getType() { + return type; + } + + + @JsonProperty(value = JSON_PROPERTY_TYPE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setType(@jakarta.annotation.Nonnull TypeEnum type) { + this.type = type; + } + + + public AccountLimitsDto maxRequestsCount(@jakarta.annotation.Nonnull Long maxRequestsCount) { + this.maxRequestsCount = maxRequestsCount; + return this; + } + + /** + * Maximum number of requests allowed per billing period. + * @return maxRequestsCount + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MAX_REQUESTS_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxRequestsCount() { + return maxRequestsCount; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_REQUESTS_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMaxRequestsCount(@jakarta.annotation.Nonnull Long maxRequestsCount) { + this.maxRequestsCount = maxRequestsCount; + } + + + public AccountLimitsDto maxRequestsRate(@jakarta.annotation.Nonnull Long maxRequestsRate) { + this.maxRequestsRate = maxRequestsRate; + return this; + } + + /** + * Maximum number of requests allowed per second. `0` means no rate limit is enforced. + * @return maxRequestsRate + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MAX_REQUESTS_RATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxRequestsRate() { + return maxRequestsRate; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_REQUESTS_RATE, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMaxRequestsRate(@jakarta.annotation.Nonnull Long maxRequestsRate) { + this.maxRequestsRate = maxRequestsRate; + } + + + public AccountLimitsDto maxTermsCount(@jakarta.annotation.Nonnull Long maxTermsCount) { + this.maxTermsCount = maxTermsCount; + return this; + } + + /** + * Maximum number of terms accepted in a single request. + * @return maxTermsCount + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MAX_TERMS_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxTermsCount() { + return maxTermsCount; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_TERMS_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMaxTermsCount(@jakarta.annotation.Nonnull Long maxTermsCount) { + this.maxTermsCount = maxTermsCount; + } + + + public AccountLimitsDto maxTimeout(@jakarta.annotation.Nonnull Long maxTimeout) { + this.maxTimeout = maxTimeout; + return this; + } + + /** + * Maximum execution timeout per request, in milliseconds. + * @return maxTimeout + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MAX_TIMEOUT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxTimeout() { + return maxTimeout; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_TIMEOUT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMaxTimeout(@jakarta.annotation.Nonnull Long maxTimeout) { + this.maxTimeout = maxTimeout; + } + + + public AccountLimitsDto maxStatesCount(@jakarta.annotation.Nonnull Long maxStatesCount) { + this.maxStatesCount = maxStatesCount; + return this; + } + + /** + * Maximum number of automaton states an operation may build. + * @return maxStatesCount + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_MAX_STATES_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getMaxStatesCount() { + return maxStatesCount; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_STATES_COUNT, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setMaxStatesCount(@jakarta.annotation.Nonnull Long maxStatesCount) { + this.maxStatesCount = maxStatesCount; + } + + + /** + * Return true if this AccountLimits object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountLimitsDto accountLimits = (AccountLimitsDto) o; + return Objects.equals(this.type, accountLimits.type) && + Objects.equals(this.maxRequestsCount, accountLimits.maxRequestsCount) && + Objects.equals(this.maxRequestsRate, accountLimits.maxRequestsRate) && + Objects.equals(this.maxTermsCount, accountLimits.maxTermsCount) && + Objects.equals(this.maxTimeout, accountLimits.maxTimeout) && + Objects.equals(this.maxStatesCount, accountLimits.maxStatesCount); + } + + @Override + public int hashCode() { + return Objects.hash(type, maxRequestsCount, maxRequestsRate, maxTermsCount, maxTimeout, maxStatesCount); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AccountLimitsDto {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" maxRequestsCount: ").append(toIndentedString(maxRequestsCount)).append("\n"); + sb.append(" maxRequestsRate: ").append(toIndentedString(maxRequestsRate)).append("\n"); + sb.append(" maxTermsCount: ").append(toIndentedString(maxTermsCount)).append("\n"); + sb.append(" maxTimeout: ").append(toIndentedString(maxTimeout)).append("\n"); + sb.append(" maxStatesCount: ").append(toIndentedString(maxStatesCount)).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 `type` to the URL query string + if (getType() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%stype%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getType())))); + } + + // add `maxRequestsCount` to the URL query string + if (getMaxRequestsCount() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxRequestsCount%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxRequestsCount())))); + } + + // add `maxRequestsRate` to the URL query string + if (getMaxRequestsRate() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxRequestsRate%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxRequestsRate())))); + } + + // add `maxTermsCount` to the URL query string + if (getMaxTermsCount() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxTermsCount%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxTermsCount())))); + } + + // add `maxTimeout` to the URL query string + if (getMaxTimeout() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxTimeout%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxTimeout())))); + } + + // add `maxStatesCount` to the URL query string + if (getMaxStatesCount() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxStatesCount%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxStatesCount())))); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java index 6f9adee..a6f6b9e 100644 --- a/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/BooleanDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -36,7 +36,7 @@ BooleanDto.JSON_PROPERTY_TYPE, BooleanDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class BooleanDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java index f6ae702..c1925cd 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Cardinality200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Cardinality200ResponseDto.JSON_PROPERTY_SUCCESS, Cardinality200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Cardinality200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java index 24e502d..e325454 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityBigIntegerDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityBigIntegerDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityBigIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java index b71253e..67d7435 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = CardinalityDto.CardinalityDtoDeserializer.class) @JsonSerialize(using = CardinalityDto.CardinalityDtoSerializer.class) public class CardinalityDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java index 0cf4fc5..2d74e69 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityInfiniteDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -35,7 +35,7 @@ @JsonPropertyOrder({ CardinalityInfiniteDto.JSON_PROPERTY_TYPE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityInfiniteDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java index ce3f3a5..32bc491 100644 --- a/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/CardinalityIntegerDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -36,7 +36,7 @@ CardinalityIntegerDto.JSON_PROPERTY_TYPE, CardinalityIntegerDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class CardinalityIntegerDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java index 7abca61..79991ef 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Concat200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Concat200ResponseDto.JSON_PROPERTY_SUCCESS, Concat200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Concat200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java index 282f131..7f2c65a 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Dot200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Dot200ResponseDto.JSON_PROPERTY_SUCCESS, Dot200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Dot200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java index 376bc6c..a920228 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Empty200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Empty200ResponseDto.JSON_PROPERTY_SUCCESS, Empty200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Empty200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java index 7d62606..c474de2 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse400Dto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ ErrorResponse400Dto.JSON_PROPERTY_ERROR, ErrorResponse400Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse400Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java index 6ed9c94..08e39a2 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse401Dto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ ErrorResponse401Dto.JSON_PROPERTY_ERROR, ErrorResponse401Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse401Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java index 44136e4..acb9d9c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponse403Dto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ ErrorResponse403Dto.JSON_PROPERTY_ERROR, ErrorResponse403Dto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponse403Dto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java index e3156c1..acd377d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ErrorResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ ErrorResponseDto.JSON_PROPERTY_ERROR, ErrorResponseDto.JSON_PROPERTY_ERROR_CODE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ErrorResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java index 039ac10..07cf8d6 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ExecutionOptionsDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -35,7 +35,7 @@ @JsonPropertyOrder({ ExecutionOptionsDto.JSON_PROPERTY_TIMEOUT }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ExecutionOptionsDto { public static final String JSON_PROPERTY_TIMEOUT = "timeout"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java index 98ef8c2..a67160b 100644 --- a/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/FairResponseOptionsDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -35,7 +35,7 @@ @JsonPropertyOrder({ FairResponseOptionsDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class FairResponseOptionsDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsCharacterOrderDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsCharacterOrderDto.java new file mode 100644 index 0000000..5d29a7d --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsCharacterOrderDto.java @@ -0,0 +1,78 @@ +/* + * RegexSolver API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.JsonPropertyOrder; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Order in which the strings within each path are produced. Orthogonal to `pathOrder`: it does not change *what* can be generated, only which strings are reached first. `ascending` expands each position from the low end of its character range first, so `[a-z]{8}` yields `aaaaaaaa`, `aaaaaaab`, ... — a stable, spec-defined order returning the smallest witnesses of a path first. `shuffled` applies a permutation drawn from `seed`, so `[a-z]{8}` yields something like `sjtwsive` instead: the strings look like real inputs. Random in look only — generation stays reproducible and pages with `offset`, though offsets are only consistent between calls sharing the same `seed`, and the exact sequence may change between releases. Use `charset` to restrict generation to specific characters. + */ +public enum GenerateStringsCharacterOrderDto { + + ASCENDING("ascending"), + + SHUFFLED("shuffled"); + + private String value; + + GenerateStringsCharacterOrderDto(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static GenerateStringsCharacterOrderDto fromValue(String value) { + for (GenerateStringsCharacterOrderDto b : GenerateStringsCharacterOrderDto.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format(java.util.Locale.ROOT, "%s=%s", prefix, this.toString()); + } + +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsPathOrderDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsPathOrderDto.java new file mode 100644 index 0000000..d1568dc --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsPathOrderDto.java @@ -0,0 +1,80 @@ +/* + * RegexSolver API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.JsonPropertyOrder; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Order in which the paths of the language are scheduled — the *shapes* the term allows, as opposed to the characters filling them (`characterOrder`). `sweep` expands one path in full, shortest first, before moving to the next one: the cheapest way to page through a whole language with `offset`. `interleave` covers every path the term holds before any path is asked for a second string, so a `limit` smaller than the number of shapes is spent entirely on distinct shapes; slower than `sweep`, but better suited to deriving test cases. `shuffled` is `interleave` with same-length paths visited in an order drawn by `seed`. Shorter paths still come first, so the seed only draws among paths of equal length. All three are deterministic and page with `offset`; for `shuffled`, offsets are only consistent between calls sharing the same `seed`. + */ +public enum GenerateStringsPathOrderDto { + + SWEEP("sweep"), + + INTERLEAVE("interleave"), + + SHUFFLED("shuffled"); + + private String value; + + GenerateStringsPathOrderDto(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static GenerateStringsPathOrderDto fromValue(String value) { + for (GenerateStringsPathOrderDto b : GenerateStringsPathOrderDto.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + /** + * Convert the instance into URL query string. + * + * @param prefix prefix of the query string + * @return URL query string + */ + public String toUrlQueryString(String prefix) { + if (prefix == null) { + prefix = ""; + } + + return String.format(java.util.Locale.ROOT, "%s=%s", prefix, this.toString()); + } + +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java index 8f1a368..8af2777 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsRequestDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -24,6 +24,8 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonValue; +import com.regexsolver.api.generated.model.GenerateStringsCharacterOrderDto; +import com.regexsolver.api.generated.model.GenerateStringsPathOrderDto; import com.regexsolver.api.generated.model.RequestOptionsDto; import com.regexsolver.api.generated.model.TermDto; import java.util.Arrays; @@ -32,15 +34,21 @@ import com.regexsolver.api.generated.ApiClient; /** - * Request to generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings. For consistent pagination, `term` should be deterministic. + * Request to generate up to `limit` distinct strings matched by `term`, skipping the first `offset` strings and confined to lengths between `minLength` and `maxLength`. For consistent pagination, `term` should be deterministic. */ @JsonPropertyOrder({ GenerateStringsRequestDto.JSON_PROPERTY_TERM, GenerateStringsRequestDto.JSON_PROPERTY_LIMIT, GenerateStringsRequestDto.JSON_PROPERTY_OFFSET, + GenerateStringsRequestDto.JSON_PROPERTY_MIN_LENGTH, + GenerateStringsRequestDto.JSON_PROPERTY_MAX_LENGTH, + GenerateStringsRequestDto.JSON_PROPERTY_PATH_ORDER, + GenerateStringsRequestDto.JSON_PROPERTY_CHARACTER_ORDER, + GenerateStringsRequestDto.JSON_PROPERTY_SEED, + GenerateStringsRequestDto.JSON_PROPERTY_CHARSET, GenerateStringsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull @@ -51,8 +59,32 @@ public class GenerateStringsRequestDto { private Integer limit; public static final String JSON_PROPERTY_OFFSET = "offset"; - @jakarta.annotation.Nonnull - private Integer offset; + @jakarta.annotation.Nullable + private Integer offset = 0; + + public static final String JSON_PROPERTY_MIN_LENGTH = "minLength"; + @jakarta.annotation.Nullable + private Integer minLength = 0; + + public static final String JSON_PROPERTY_MAX_LENGTH = "maxLength"; + @jakarta.annotation.Nullable + private Integer maxLength = 100; + + public static final String JSON_PROPERTY_PATH_ORDER = "pathOrder"; + @jakarta.annotation.Nullable + private GenerateStringsPathOrderDto pathOrder; + + public static final String JSON_PROPERTY_CHARACTER_ORDER = "characterOrder"; + @jakarta.annotation.Nullable + private GenerateStringsCharacterOrderDto characterOrder; + + public static final String JSON_PROPERTY_SEED = "seed"; + @jakarta.annotation.Nullable + private Long seed = 0l; + + public static final String JSON_PROPERTY_CHARSET = "charset"; + @jakarta.annotation.Nullable + private String charset; public static final String JSON_PROPERTY_OPTIONS = "options"; @jakarta.annotation.Nullable @@ -111,7 +143,7 @@ public void setLimit(@jakarta.annotation.Nonnull Integer limit) { } - public GenerateStringsRequestDto offset(@jakarta.annotation.Nonnull Integer offset) { + public GenerateStringsRequestDto offset(@jakarta.annotation.Nullable Integer offset) { this.offset = offset; return this; } @@ -121,21 +153,169 @@ public GenerateStringsRequestDto offset(@jakarta.annotation.Nonnull Integer offs * minimum: 0 * @return offset */ - @jakarta.annotation.Nonnull - @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) - @JsonInclude(value = JsonInclude.Include.ALWAYS) + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_OFFSET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) public Integer getOffset() { return offset; } - @JsonProperty(value = JSON_PROPERTY_OFFSET, required = true) - @JsonInclude(value = JsonInclude.Include.ALWAYS) - public void setOffset(@jakarta.annotation.Nonnull Integer offset) { + @JsonProperty(value = JSON_PROPERTY_OFFSET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setOffset(@jakarta.annotation.Nullable Integer offset) { this.offset = offset; } + public GenerateStringsRequestDto minLength(@jakarta.annotation.Nullable Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * Shortest string to generate. Strings shorter than this are left out of the enumeration entirely, `offset` never counting them. + * minimum: 0 + * @return minLength + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MIN_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getMinLength() { + return minLength; + } + + + @JsonProperty(value = JSON_PROPERTY_MIN_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMinLength(@jakarta.annotation.Nullable Integer minLength) { + this.minLength = minLength; + } + + + public GenerateStringsRequestDto maxLength(@jakarta.annotation.Nullable Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * Longest string to generate. Strings longer than this are left out of the enumeration entirely, `offset` never counting them. A value below `minLength` leaves nothing to generate. + * minimum: 1 + * maximum: 100 + * @return maxLength + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_MAX_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Integer getMaxLength() { + return maxLength; + } + + + @JsonProperty(value = JSON_PROPERTY_MAX_LENGTH, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setMaxLength(@jakarta.annotation.Nullable Integer maxLength) { + this.maxLength = maxLength; + } + + + public GenerateStringsRequestDto pathOrder(@jakarta.annotation.Nullable GenerateStringsPathOrderDto pathOrder) { + this.pathOrder = pathOrder; + return this; + } + + /** + * Order in which the paths of the language are scheduled. Defaults to `sweep`. + * @return pathOrder + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_PATH_ORDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GenerateStringsPathOrderDto getPathOrder() { + return pathOrder; + } + + + @JsonProperty(value = JSON_PROPERTY_PATH_ORDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setPathOrder(@jakarta.annotation.Nullable GenerateStringsPathOrderDto pathOrder) { + this.pathOrder = pathOrder; + } + + + public GenerateStringsRequestDto characterOrder(@jakarta.annotation.Nullable GenerateStringsCharacterOrderDto characterOrder) { + this.characterOrder = characterOrder; + return this; + } + + /** + * Order in which the strings within each path are produced. Defaults to `ascending`. + * @return characterOrder + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CHARACTER_ORDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public GenerateStringsCharacterOrderDto getCharacterOrder() { + return characterOrder; + } + + + @JsonProperty(value = JSON_PROPERTY_CHARACTER_ORDER, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCharacterOrder(@jakarta.annotation.Nullable GenerateStringsCharacterOrderDto characterOrder) { + this.characterOrder = characterOrder; + } + + + public GenerateStringsRequestDto seed(@jakarta.annotation.Nullable Long seed) { + this.seed = seed; + return this; + } + + /** + * Seed behind the `shuffled` modes of `pathOrder` and `characterOrder`; ignored when neither is used. The default seed is fixed rather than random, so two calls sharing a seed generate the same strings and `offset` pages through them consistently. Change it to draw a different sequence from the same term. + * minimum: 0 + * @return seed + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_SEED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getSeed() { + return seed; + } + + + @JsonProperty(value = JSON_PROPERTY_SEED, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setSeed(@jakarta.annotation.Nullable Long seed) { + this.seed = seed; + } + + + public GenerateStringsRequestDto charset(@jakarta.annotation.Nullable String charset) { + this.charset = charset; + return this; + } + + /** + * Character class the generated strings are restricted to, such as `[a-z]` or `\\P{C}`. Paths needing a character outside of it are dropped entirely. If omitted, every character the term allows is used. + * @return charset + */ + @jakarta.annotation.Nullable + @JsonProperty(value = JSON_PROPERTY_CHARSET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getCharset() { + return charset; + } + + + @JsonProperty(value = JSON_PROPERTY_CHARSET, required = false) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public void setCharset(@jakarta.annotation.Nullable String charset) { + this.charset = charset; + } + + public GenerateStringsRequestDto options(@jakarta.annotation.Nullable RequestOptionsDto options) { this.options = options; return this; @@ -175,12 +355,18 @@ public boolean equals(Object o) { return Objects.equals(this.term, generateStringsRequest.term) && Objects.equals(this.limit, generateStringsRequest.limit) && Objects.equals(this.offset, generateStringsRequest.offset) && + Objects.equals(this.minLength, generateStringsRequest.minLength) && + Objects.equals(this.maxLength, generateStringsRequest.maxLength) && + Objects.equals(this.pathOrder, generateStringsRequest.pathOrder) && + Objects.equals(this.characterOrder, generateStringsRequest.characterOrder) && + Objects.equals(this.seed, generateStringsRequest.seed) && + Objects.equals(this.charset, generateStringsRequest.charset) && Objects.equals(this.options, generateStringsRequest.options); } @Override public int hashCode() { - return Objects.hash(term, limit, offset, options); + return Objects.hash(term, limit, offset, minLength, maxLength, pathOrder, characterOrder, seed, charset, options); } @Override @@ -190,6 +376,12 @@ public String toString() { sb.append(" term: ").append(toIndentedString(term)).append("\n"); sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); + sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); + sb.append(" pathOrder: ").append(toIndentedString(pathOrder)).append("\n"); + sb.append(" characterOrder: ").append(toIndentedString(characterOrder)).append("\n"); + sb.append(" seed: ").append(toIndentedString(seed)).append("\n"); + sb.append(" charset: ").append(toIndentedString(charset)).append("\n"); sb.append(" options: ").append(toIndentedString(options)).append("\n"); sb.append("}"); return sb.toString(); @@ -250,6 +442,36 @@ public String toUrlQueryString(String prefix) { joiner.add(String.format(java.util.Locale.ROOT, "%soffset%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getOffset())))); } + // add `minLength` to the URL query string + if (getMinLength() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sminLength%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMinLength())))); + } + + // add `maxLength` to the URL query string + if (getMaxLength() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%smaxLength%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getMaxLength())))); + } + + // add `pathOrder` to the URL query string + if (getPathOrder() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%spathOrder%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getPathOrder())))); + } + + // add `characterOrder` to the URL query string + if (getCharacterOrder() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scharacterOrder%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCharacterOrder())))); + } + + // add `seed` to the URL query string + if (getSeed() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%sseed%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSeed())))); + } + + // add `charset` to the URL query string + if (getCharset() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%scharset%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getCharset())))); + } + // add `options` to the URL query string if (getOptions() != null) { joiner.add(getOptions().toUrlQueryString(prefix + "options" + suffix)); diff --git a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java index 4845a48..b51e843 100644 --- a/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/GenerateStringsResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ GenerateStringsResponseDto.JSON_PROPERTY_TYPE, GenerateStringsResponseDto.JSON_PROPERTY_STRINGS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class GenerateStringsResponseDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java index 3d64fd3..7a096bc 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Length200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Length200ResponseDto.JSON_PROPERTY_SUCCESS, Length200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Length200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java index 1f8b08c..47c90a5 100644 --- a/src/main/java/com/regexsolver/api/generated/model/LengthDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/LengthDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ LengthDto.JSON_PROPERTY_MIN, LengthDto.JSON_PROPERTY_MAX }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class LengthDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Limits200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Limits200ResponseDto.java new file mode 100644 index 0000000..a021669 --- /dev/null +++ b/src/main/java/com/regexsolver/api/generated/model/Limits200ResponseDto.java @@ -0,0 +1,185 @@ +/* + * RegexSolver API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.1.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.regexsolver.api.generated.model; + +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.regexsolver.api.generated.model.AccountLimitsDto; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +import com.regexsolver.api.generated.ApiClient; +/** + * Limits200ResponseDto + */ +@JsonPropertyOrder({ + Limits200ResponseDto.JSON_PROPERTY_SUCCESS, + Limits200ResponseDto.JSON_PROPERTY_DATA +}) +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +public class Limits200ResponseDto { + public static final String JSON_PROPERTY_SUCCESS = "success"; + @jakarta.annotation.Nonnull + private Boolean success; + + public static final String JSON_PROPERTY_DATA = "data"; + @jakarta.annotation.Nonnull + private AccountLimitsDto data; + + public Limits200ResponseDto() { + } + + public Limits200ResponseDto success(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + return this; + } + + /** + * Get success + * @return success + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getSuccess() { + return success; + } + + + @JsonProperty(value = JSON_PROPERTY_SUCCESS, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setSuccess(@jakarta.annotation.Nonnull Boolean success) { + this.success = success; + } + + + public Limits200ResponseDto data(@jakarta.annotation.Nonnull AccountLimitsDto data) { + this.data = data; + return this; + } + + /** + * Get data + * @return data + */ + @jakarta.annotation.Nonnull + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AccountLimitsDto getData() { + return data; + } + + + @JsonProperty(value = JSON_PROPERTY_DATA, required = true) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public void setData(@jakarta.annotation.Nonnull AccountLimitsDto data) { + this.data = data; + } + + + /** + * Return true if this limits_200_response object is equal to o. + */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Limits200ResponseDto limits200Response = (Limits200ResponseDto) o; + return Objects.equals(this.success, limits200Response.success) && + Objects.equals(this.data, limits200Response.data); + } + + @Override + public int hashCode() { + return Objects.hash(success, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Limits200ResponseDto {\n"); + sb.append(" success: ").append(toIndentedString(success)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + 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 `success` to the URL query string + if (getSuccess() != null) { + joiner.add(String.format(java.util.Locale.ROOT, "%ssuccess%s=%s", prefix, suffix, ApiClient.urlEncode(ApiClient.valueToString(getSuccess())))); + } + + // add `data` to the URL query string + if (getData() != null) { + joiner.add(getData().toUrlQueryString(prefix + "data" + suffix)); + } + + return joiner.toString(); + } +} + diff --git a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java index 103ee69..72ed918 100644 --- a/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/MultiTermsRequestDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -40,7 +40,7 @@ MultiTermsRequestDto.JSON_PROPERTY_TERMS, MultiTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class MultiTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java index 941d457..6499ca1 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RepeatRequestDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -40,7 +40,7 @@ RepeatRequestDto.JSON_PROPERTY_MAX, RepeatRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RepeatRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java index cce0199..43142ac 100644 --- a/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/RequestOptionsDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -39,7 +39,7 @@ RequestOptionsDto.JSON_PROPERTY_RESPONSE, RequestOptionsDto.JSON_PROPERTY_EXECUTION }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class RequestOptionsDto { public static final String JSON_PROPERTY_SCHEMA_VERSION = "schemaVersion"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java index cca138b..73c6fcc 100644 --- a/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/ResponseOptionsDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ ResponseOptionsDto.JSON_PROPERTY_FORMAT, ResponseOptionsDto.JSON_PROPERTY_FAIR }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class ResponseOptionsDto { /** * Return format of the term. diff --git a/src/main/java/com/regexsolver/api/generated/model/StringDto.java b/src/main/java/com/regexsolver/api/generated/model/StringDto.java index 18a997d..579ec7c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -36,7 +36,7 @@ StringDto.JSON_PROPERTY_TYPE, StringDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java index f2af373..bc3de55 100644 --- a/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/Strings200ResponseDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -37,7 +37,7 @@ Strings200ResponseDto.JSON_PROPERTY_SUCCESS, Strings200ResponseDto.JSON_PROPERTY_DATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class Strings200ResponseDto { public static final String JSON_PROPERTY_SUCCESS = "success"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java index 975bb88..b24d74c 100644 --- a/src/main/java/com/regexsolver/api/generated/model/StringsDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/StringsDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -38,7 +38,7 @@ StringsDto.JSON_PROPERTY_TYPE, StringsDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class StringsDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermDto.java b/src/main/java/com/regexsolver/api/generated/model/TermDto.java index d0f7d8a..3f8b5fb 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -58,7 +58,7 @@ import com.regexsolver.api.generated.ApiClient; import com.regexsolver.api.generated.JSON; -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") @JsonDeserialize(using = TermDto.TermDtoDeserializer.class) @JsonSerialize(using = TermDto.TermDtoSerializer.class) public class TermDto extends AbstractOpenApiSchema { diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java index 9a8856c..679975d 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -38,7 +38,7 @@ TermFairDto.JSON_PROPERTY_VALUE, TermFairDto.JSON_PROPERTY_METADATA }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java index 35ced67..a372879 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermFairMetadataDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -35,7 +35,7 @@ @JsonPropertyOrder({ TermFairMetadataDto.JSON_PROPERTY_DETERMINISTIC }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermFairMetadataDto { public static final String JSON_PROPERTY_DETERMINISTIC = "deterministic"; @jakarta.annotation.Nullable diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java index 668c601..185aff4 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRegexDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -36,7 +36,7 @@ TermRegexDto.JSON_PROPERTY_TYPE, TermRegexDto.JSON_PROPERTY_VALUE }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRegexDto { /** * Gets or Sets type diff --git a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java index a8c62ad..227ce92 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TermRequestDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -38,7 +38,7 @@ TermRequestDto.JSON_PROPERTY_TERM, TermRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TermRequestDto { public static final String JSON_PROPERTY_TERM = "term"; @jakarta.annotation.Nonnull diff --git a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java index 5bb42ca..cd31384 100644 --- a/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java +++ b/src/main/java/com/regexsolver/api/generated/model/TwoTermsRequestDto.java @@ -1,5 +1,5 @@ /* - * RegexSolver + * RegexSolver API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.1.0 @@ -40,7 +40,7 @@ TwoTermsRequestDto.JSON_PROPERTY_TERMS, TwoTermsRequestDto.JSON_PROPERTY_OPTIONS }) -@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-07-25T17:30:56.796219110+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") +@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2026-08-04T20:54:20.558114023+02:00[Europe/Zurich]", comments = "Generator version: 7.21.0") public class TwoTermsRequestDto { public static final String JSON_PROPERTY_TERMS = "terms"; @jakarta.annotation.Nonnull diff --git a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java index 4e8eedc..7167723 100644 --- a/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java +++ b/src/test/java/com/regexsolver/api/AsyncRegexSolverClientTest.java @@ -7,6 +7,7 @@ import com.regexsolver.api.exceptions.*; import com.regexsolver.api.generated.ApiException; +import com.regexsolver.api.generated.api.AccountApi; import com.regexsolver.api.generated.api.AnalyzeApi; import com.regexsolver.api.generated.api.ComputeApi; import com.regexsolver.api.generated.api.GenerateApi; @@ -19,12 +20,16 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) class AsyncRegexSolverClientTest { + @Mock + private AccountApi accountApi; + @Mock private AnalyzeApi analyzeApi; @@ -44,9 +49,14 @@ void setUp() throws Exception { .build(); // Use reflection to inject the mocks into the final class fields - injectMock(client, "analyzeApi", analyzeApi); - injectMock(client, "computeApi", computeApi); - injectMock(client, "generateApi", generateApi); + injectMocks(client); + } + + private void injectMocks(AsyncRegexSolverClient target) throws Exception { + injectMock(target, "accountApi", accountApi); + injectMock(target, "analyzeApi", analyzeApi); + injectMock(target, "computeApi", computeApi); + injectMock(target, "generateApi", generateApi); } private void injectMock(Object target, String fieldName, Object mock) @@ -574,4 +584,326 @@ void testGenerateStrings() { List result = client.generateStrings(term, 3, 0).join(); assertThat(result).containsExactly("", "a", "aa"); } + + @Test + void testGenerateStringsWithOptions() { + Term term = Term.regex("[a-z]{2}"); + Strings200ResponseDto responseDto = new Strings200ResponseDto(); + StringsDto stringsDto = new StringsDto(); + stringsDto.setValue(List.of("xy")); + GenerateStringsResponseDto generateStrings = + new GenerateStringsResponseDto(); + generateStrings.setStrings(stringsDto); + responseDto.setData(generateStrings); + + when(generateApi.strings(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + GenerateStringsOptions options = GenerateStringsOptions.builder() + .pathOrder(PathOrder.INTERLEAVE) + .characterOrder(CharacterOrder.SHUFFLED) + .seed(42L) + .minLength(1) + .maxLength(10) + .charset("[a-z]"); + List result = client + .generateStrings(term, 5, 0, options) + .join(); + assertThat(result).containsExactly("xy"); + + ArgumentCaptor captor = + ArgumentCaptor.forClass(GenerateStringsRequestDto.class); + verify(generateApi).strings(captor.capture()); + GenerateStringsRequestDto request = captor.getValue(); + assertThat(request.getPathOrder()).isEqualTo( + GenerateStringsPathOrderDto.INTERLEAVE + ); + assertThat(request.getCharacterOrder()).isEqualTo( + GenerateStringsCharacterOrderDto.SHUFFLED + ); + assertThat(request.getSeed()).isEqualTo(42L); + assertThat(request.getMinLength()).isEqualTo(1); + assertThat(request.getMaxLength()).isEqualTo(10); + assertThat(request.getCharset()).isEqualTo("[a-z]"); + } + + @Test + void testGenerateStringsOmitsUnsetOptions() { + Term term = Term.regex("a"); + Strings200ResponseDto responseDto = new Strings200ResponseDto(); + StringsDto stringsDto = new StringsDto(); + stringsDto.setValue(List.of("a")); + GenerateStringsResponseDto generateStrings = + new GenerateStringsResponseDto(); + generateStrings.setStrings(stringsDto); + responseDto.setData(generateStrings); + + when(generateApi.strings(any())).thenReturn( + CompletableFuture.completedFuture(responseDto) + ); + + client.generateStrings(term, 1, 0).join(); + + ArgumentCaptor captor = + ArgumentCaptor.forClass(GenerateStringsRequestDto.class); + verify(generateApi).strings(captor.capture()); + GenerateStringsRequestDto request = captor.getValue(); + // Omitted options fall back to the spec defaults baked into the DTO. + assertThat(request.getPathOrder()).isNull(); + assertThat(request.getCharacterOrder()).isNull(); + assertThat(request.getSeed()).isEqualTo(0L); + assertThat(request.getMinLength()).isEqualTo(0); + assertThat(request.getMaxLength()).isEqualTo(100); + assertThat(request.getCharset()).isNull(); + } + + // --- ACCOUNT LIMITS & AUTO-BATCHING --- + + private static Concat200ResponseDto termResponse(String value) { + Concat200ResponseDto responseDto = new Concat200ResponseDto(); + responseDto.setData(new TermDto(new TermRegexDto().value(value))); + return responseDto; + } + + private static Limits200ResponseDto limitsResponse(long maxTerms) { + AccountLimitsDto limits = new AccountLimitsDto() + .type(AccountLimitsDto.TypeEnum.ACCOUNT_LIMITS) + .maxRequestsCount(1000L) + .maxRequestsRate(10L) + .maxTermsCount(maxTerms) + .maxTimeout(60000L) + .maxStatesCount(8192L); + return new Limits200ResponseDto().data(limits); + } + + private static ApiException tooManyTermsError(int provided, int allowed) { + return new ApiException( + 400, + "Bad Request", + null, + "{\"success\":false,\"error\":\"" + + provided + + " terms provided. Maximum allowed is " + + allowed + + ".\",\"errorCode\":\"TooManyTerms\"}" + ); + } + + private static List termValues(MultiTermsRequestDto request) { + return request + .getTerms() + .stream() + .map(t -> { + Object instance = t.getActualInstance(); + return instance instanceof TermRegexDto + ? ((TermRegexDto) instance).getValue() + : instance.toString(); + }) + .collect(java.util.stream.Collectors.toList()); + } + + @Test + void testGetAccountLimitsMemoized() { + when(accountApi.limits()).thenReturn( + CompletableFuture.completedFuture(limitsResponse(4L)) + ); + + AccountLimits limits = client.getAccountLimits().join(); + assertThat(limits.getMaxRequestsCount()).isEqualTo(1000L); + assertThat(limits.getMaxRequestsRate()).isEqualTo(10L); + assertThat(limits.getMaxTermsCount()).isEqualTo(4L); + assertThat(limits.getMaxTimeout()).isEqualTo(60000L); + assertThat(limits.getMaxStatesCount()).isEqualTo(8192L); + + client.getAccountLimits().join(); + verify(accountApi, times(1)).limits(); + } + + @Test + void testProactiveBatchingWithOverride() throws Exception { + AsyncRegexSolverClient batchClient = AsyncRegexSolverClient.builder() + .apiToken("batch-token") + .maxTermsPerRequest(3) + .build(); + injectMocks(batchClient); + + when(computeApi.concat(any())) + .thenReturn(CompletableFuture.completedFuture(termResponse("r0"))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r1"))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r2"))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r3"))); + + List terms = new java.util.ArrayList<>(); + for (int i = 0; i < 8; i++) { + terms.add(Term.regex("t" + i)); + } + Term result = batchClient + .concat( + terms, + OperationOptions.builder().responseFormat(ResponseFormat.REGEX) + ) + .join(); + assertThat(result.getPattern()).contains("r3"); + + ArgumentCaptor captor = ArgumentCaptor.forClass( + MultiTermsRequestDto.class + ); + verify(computeApi, times(4)).concat(captor.capture()); + List requests = captor.getAllValues(); + // Left fold preserves concat order: contiguous chunks, accumulator first. + assertThat(termValues(requests.get(0))).containsExactly( + "t0", + "t1", + "t2" + ); + assertThat(termValues(requests.get(1))).containsExactly( + "r0", + "t3", + "t4" + ); + assertThat(termValues(requests.get(2))).containsExactly( + "r1", + "t5", + "t6" + ); + assertThat(termValues(requests.get(3))).containsExactly("r2", "t7"); + // Only the final request carries the caller's response options. + assertThat(requests.get(0).getOptions().getResponse()).isNull(); + assertThat(requests.get(1).getOptions().getResponse()).isNull(); + assertThat(requests.get(2).getOptions().getResponse()).isNull(); + assertThat(requests.get(3).getOptions().getResponse()).isNotNull(); + // The limit was known up front, so no limits fetch happened. + verify(accountApi, never()).limits(); + } + + @Test + void testReactiveBatchingFetchesLimits() { + when(accountApi.limits()).thenReturn( + CompletableFuture.completedFuture(limitsResponse(4L)) + ); + when(computeApi.union(any())) + .thenReturn(CompletableFuture.failedFuture(tooManyTermsError(9, 4))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r0"))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r1"))) + .thenReturn(CompletableFuture.completedFuture(termResponse("r2"))); + + List terms = new java.util.ArrayList<>(); + for (int i = 0; i < 9; i++) { + terms.add(Term.regex("t" + i)); + } + Term result = client.union(terms).join(); + assertThat(result.getPattern()).contains("r2"); + + ArgumentCaptor captor = ArgumentCaptor.forClass( + MultiTermsRequestDto.class + ); + verify(computeApi, times(4)).union(captor.capture()); + List requests = captor.getAllValues(); + assertThat(termValues(requests.get(1))).containsExactly( + "t0", + "t1", + "t2", + "t3" + ); + assertThat(termValues(requests.get(2))).containsExactly( + "r0", + "t4", + "t5", + "t6" + ); + assertThat(termValues(requests.get(3))).containsExactly( + "r1", + "t7", + "t8" + ); + verify(accountApi, times(1)).limits(); + } + + @Test + void testAutoBatchOptOut() throws Exception { + AsyncRegexSolverClient noBatchClient = AsyncRegexSolverClient.builder() + .apiToken("no-batch-token") + .autoBatch(false) + .build(); + injectMocks(noBatchClient); + + when(computeApi.union(any())).thenReturn( + CompletableFuture.failedFuture(tooManyTermsError(9, 4)) + ); + + List terms = new java.util.ArrayList<>(); + for (int i = 0; i < 9; i++) { + terms.add(Term.regex("t" + i)); + } + assertThatThrownBy(() -> noBatchClient.union(terms).join()) + .hasCauseInstanceOf(TooManyTermsException.class); + verify(accountApi, never()).limits(); + } + + @Test + void testLimitsFetchFailureRethrowsOriginal() { + when(accountApi.limits()).thenReturn( + CompletableFuture.failedFuture( + new ApiException(500, "Internal Server Error", null, null) + ) + ); + when(computeApi.union(any())).thenReturn( + CompletableFuture.failedFuture(tooManyTermsError(9, 4)) + ); + + List terms = new java.util.ArrayList<>(); + for (int i = 0; i < 9; i++) { + terms.add(Term.regex("t" + i)); + } + assertThatThrownBy(() -> client.union(terms).join()) + .hasCauseInstanceOf(TooManyTermsException.class); + verify(accountApi, times(1)).limits(); + } + + @Test + void testRetrySurvivesManyConsecutive429s() { + Term term = Term.regex("abc"); + + HttpHeaders mockHeaders = mock(HttpHeaders.class); + when(mockHeaders.firstValue("Retry-After")).thenReturn( + Optional.of("0.01") + ); + ApiException error429 = new ApiException( + 429, + "Too Many Requests", + mockHeaders, + null + ); + + Empty200ResponseDto successResponse = new Empty200ResponseDto(); + BooleanDto data = new BooleanDto(); + data.setValue(true); + successResponse.setData(data); + + // Six consecutive 429s exceed the old cap of five attempts. + when(analyzeApi.empty(any())) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.failedFuture(error429)) + .thenReturn(CompletableFuture.completedFuture(successResponse)); + + Boolean result = client.isEmpty(term).join(); + + assertThat(result).isTrue(); + verify(analyzeApi, times(7)).empty(any()); + } + + @Test + void testBuilderRejectsInvalidMaxTermsPerRequest() { + assertThatThrownBy(() -> + AsyncRegexSolverClient.builder() + .apiToken("test-token") + .maxTermsPerRequest(1) + .build() + ).isInstanceOf(IllegalArgumentException.class); + } } diff --git a/src/test/java/com/regexsolver/api/RateLimiterTest.java b/src/test/java/com/regexsolver/api/RateLimiterTest.java index f3a0884..418977c 100644 --- a/src/test/java/com/regexsolver/api/RateLimiterTest.java +++ b/src/test/java/com/regexsolver/api/RateLimiterTest.java @@ -56,6 +56,45 @@ void testRateLimiterTriggerAlreadyCleared() { assertThat(duration).isGreaterThanOrEqualTo(80); } + @Test + void testRateLimiterDeadlineExtendedWhileWaiting() throws Exception { + RateLimiter rl = RateLimiter.getInstance("test-token-4"); + + rl.trigger(0.1); + long start = System.currentTimeMillis(); + java.util.concurrent.CompletableFuture waiter = + rl.waitIfNecessary(); + + Thread.sleep(50); + rl.trigger(0.25); + + waiter.join(); + long duration = System.currentTimeMillis() - start; + // The waiter woke at the original deadline, re-checked, and waited + // again until the extended one (~50ms + 250ms from the second trigger). + assertThat(duration).isGreaterThanOrEqualTo(250); + } + + @Test + void testWaitIfNecessaryDoesNotBlockCaller() { + RateLimiter rl = RateLimiter.getInstance("test-token-5"); + + rl.trigger(0.2); + long start = System.currentTimeMillis(); + java.util.concurrent.CompletableFuture waiter = + rl.waitIfNecessary(); + long returned = System.currentTimeMillis(); + + // The call returns immediately with a pending future; no thread is + // parked on behalf of the caller. + assertThat(returned - start).isLessThan(50); + assertThat(waiter).isNotDone(); + waiter.join(); + assertThat(System.currentTimeMillis() - start).isGreaterThanOrEqualTo( + 150 + ); + } + @Test void testGetInstanceReturnsSameInstanceForSameToken() { RateLimiter rl1 = RateLimiter.getInstance("tokenA"); From c44cfe424d52ff93a89a4a11f8cc38e76662984e Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 8 Aug 2026 12:14:12 +0200 Subject: [PATCH 23/24] Fix compatibility issue with java 11 --- pom.xml | 3 +- .../api/AsyncRegexSolverClient.java | 78 ++++++++++++------- 2 files changed, 52 insertions(+), 29 deletions(-) diff --git a/pom.xml b/pom.xml index 19d3657..2130650 100644 --- a/pom.xml +++ b/pom.xml @@ -128,8 +128,7 @@ maven-compiler-plugin 3.13.0 - 11 - 11 + 11
diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index f399d8a..941c1b2 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; @@ -195,9 +196,9 @@ private CompletableFuture executeWithRetry( ) ); } - return gate - .thenCompose(v -> apiCall.get()) - .exceptionallyCompose(ex -> { + return exceptionallyCompose( + gate.thenCompose(v -> apiCall.get()), + ex -> { Throwable cause = ex.getCause() != null ? ex.getCause() : ex; if (cause instanceof ApiException) { ApiException apiEx = (ApiException) cause; @@ -236,7 +237,25 @@ private CompletableFuture executeWithRetry( cause instanceof RuntimeException ) throw (RuntimeException) cause; throw new RuntimeException(cause); - }); + } + ); + } + + /** + * `CompletableFuture.exceptionallyCompose` equivalent; that method is + * only available from Java 12 onwards and this SDK targets Java 11. + */ + private static CompletableFuture exceptionallyCompose( + CompletableFuture future, + Function> fallback + ) { + CompletableFuture> composed = future.handle( + (value, ex) -> + ex == null + ? CompletableFuture.completedFuture(value) + : fallback.apply(ex) + ); + return composed.thenCompose(stage -> stage); } private RegexSolverException mapException(ApiException ex) { @@ -456,30 +475,35 @@ private CompletableFuture runNary( return fold(op, terms, options, maxTerms); } boolean limitWasKnown = maxTerms != null; - return naryCall(op, terms, options, true).exceptionallyCompose(ex -> { - Throwable cause = ex.getCause() != null ? ex.getCause() : ex; - if ( - !autoBatch || - limitWasKnown || - !(cause instanceof TooManyTermsException) - ) { - return CompletableFuture.failedFuture(cause); + return exceptionallyCompose( + naryCall(op, terms, options, true), + ex -> { + Throwable cause = ex.getCause() != null ? ex.getCause() : ex; + if ( + !autoBatch || + limitWasKnown || + !(cause instanceof TooManyTermsException) + ) { + return CompletableFuture.failedFuture(cause); + } + return getAccountLimits() + .handle((limits, fetchError) -> + // A failed fetch falls back to surfacing the original + // TooManyTerms, never worse than without batching. + fetchError != null ? null : effectiveMaxTerms() + ) + .thenCompose(newMax -> { + if ( + newMax == null || + newMax < 2 || + terms.size() <= newMax + ) { + return CompletableFuture.failedFuture(cause); + } + return fold(op, terms, options, newMax); + }); } - return getAccountLimits() - .handle((limits, fetchError) -> - // A failed fetch falls back to surfacing the original - // TooManyTerms, never worse than without batching. - fetchError != null ? null : effectiveMaxTerms() - ) - .thenCompose(newMax -> { - if ( - newMax == null || newMax < 2 || terms.size() <= newMax - ) { - return CompletableFuture.failedFuture(cause); - } - return fold(op, terms, options, newMax); - }); - }); + ); } private CompletableFuture naryCall( From 00cfadacc2587169129e9721d1e566654561547c Mon Sep 17 00:00:00 2001 From: Alexandre van Beurden <1949482+alexvbrdn@users.noreply.github.com> Date: Sat, 8 Aug 2026 13:21:19 +0200 Subject: [PATCH 24/24] Fix javadocs --- .../com/regexsolver/api/AccountLimits.java | 10 +++++----- .../api/AsyncRegexSolverClient.java | 10 ++++++++-- .../api/GenerateStringsOptions.java | 18 ++++++++++++++++++ src/main/java/com/regexsolver/api/Length.java | 4 ++-- .../com/regexsolver/api/OperationOptions.java | 9 +++++++++ .../com/regexsolver/api/RegexSolverClient.java | 10 ++++++++-- src/main/java/com/regexsolver/api/Term.java | 2 ++ 7 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/regexsolver/api/AccountLimits.java b/src/main/java/com/regexsolver/api/AccountLimits.java index 8ba5f90..5e56eb7 100644 --- a/src/main/java/com/regexsolver/api/AccountLimits.java +++ b/src/main/java/com/regexsolver/api/AccountLimits.java @@ -38,27 +38,27 @@ static AccountLimits fromDto(AccountLimitsDto dto) { ); } - /** Maximum number of requests allowed per billing period. */ + /** @return Maximum number of requests allowed per billing period. */ public long getMaxRequestsCount() { return maxRequestsCount; } - /** Maximum number of requests allowed per second. 0 means no rate limit is enforced. */ + /** @return Maximum number of requests allowed per second. 0 means no rate limit is enforced. */ public long getMaxRequestsRate() { return maxRequestsRate; } - /** Maximum number of terms accepted in a single request. */ + /** @return Maximum number of terms accepted in a single request. */ public long getMaxTermsCount() { return maxTermsCount; } - /** Maximum execution timeout per request, in milliseconds. */ + /** @return Maximum execution timeout per request, in milliseconds. */ public long getMaxTimeout() { return maxTimeout; } - /** Maximum number of automaton states an operation may build. */ + /** @return Maximum number of automaton states an operation may build. */ public long getMaxStatesCount() { return maxStatesCount; } diff --git a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java index 941c1b2..b60f3fa 100644 --- a/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/AsyncRegexSolverClient.java @@ -104,6 +104,9 @@ public Builder baseUrl(String baseUrl) { * carrying more terms than the account's per-request limit are * transparently split into several requests and folded back into one * result. Each constituent request counts against the monthly quota. + * + * @param autoBatch whether to enable auto-batching + * @return this builder */ public Builder autoBatch(boolean autoBatch) { this.autoBatch = autoBatch; @@ -111,8 +114,11 @@ public Builder autoBatch(boolean autoBatch) { } /** - * Upper bound (>= 2) on the number of terms sent in a single request, - * overriding the limit fetched from the API when smaller. + * Upper bound (>= 2) on the number of terms sent in a single + * request, overriding the limit fetched from the API when smaller. + * + * @param maxTermsPerRequest the cap, or null to use the account limit + * @return this builder */ public Builder maxTermsPerRequest(Integer maxTermsPerRequest) { this.maxTermsPerRequest = maxTermsPerRequest; diff --git a/src/main/java/com/regexsolver/api/GenerateStringsOptions.java b/src/main/java/com/regexsolver/api/GenerateStringsOptions.java index 65e267d..1d058ad 100644 --- a/src/main/java/com/regexsolver/api/GenerateStringsOptions.java +++ b/src/main/java/com/regexsolver/api/GenerateStringsOptions.java @@ -30,6 +30,9 @@ public GenerateStringsOptions executionTimeout(Integer timeout) { /** * Order in which the paths (shapes) of the language are scheduled. * Defaults to {@link PathOrder#SWEEP}. + * + * @param pathOrder the path order + * @return these options */ public GenerateStringsOptions pathOrder(PathOrder pathOrder) { this.pathOrder = pathOrder; @@ -39,6 +42,9 @@ public GenerateStringsOptions pathOrder(PathOrder pathOrder) { /** * Order in which the strings within each path are produced. Defaults to * {@link CharacterOrder#ASCENDING}. + * + * @param characterOrder the character order + * @return these options */ public GenerateStringsOptions characterOrder(CharacterOrder characterOrder) { this.characterOrder = characterOrder; @@ -49,6 +55,9 @@ public GenerateStringsOptions characterOrder(CharacterOrder characterOrder) { * Seed behind the shuffled modes. The default seed is fixed, so two calls * sharing a seed generate the same strings and {@code offset} pages * through them consistently. + * + * @param seed the seed + * @return these options */ public GenerateStringsOptions seed(Long seed) { this.seed = seed; @@ -58,6 +67,9 @@ public GenerateStringsOptions seed(Long seed) { /** * Shortest string to generate. Shorter strings are left out of the * enumeration entirely, {@code offset} never counting them. + * + * @param minLength the minimum length + * @return these options */ public GenerateStringsOptions minLength(Integer minLength) { this.minLength = minLength; @@ -66,6 +78,9 @@ public GenerateStringsOptions minLength(Integer minLength) { /** * Longest string to generate. + * + * @param maxLength the maximum length + * @return these options */ public GenerateStringsOptions maxLength(Integer maxLength) { this.maxLength = maxLength; @@ -75,6 +90,9 @@ public GenerateStringsOptions maxLength(Integer maxLength) { /** * Restricts generation to the given characters, e.g. {@code [a-z]}. Paths * requiring a character outside it are dropped. + * + * @param charset the allowed characters + * @return these options */ public GenerateStringsOptions charset(String charset) { this.charset = charset; diff --git a/src/main/java/com/regexsolver/api/Length.java b/src/main/java/com/regexsolver/api/Length.java index 3d68d28..4c13b2d 100644 --- a/src/main/java/com/regexsolver/api/Length.java +++ b/src/main/java/com/regexsolver/api/Length.java @@ -21,12 +21,12 @@ static Length fromDto(LengthDto len) { return new Length(len.getMin(), len.getMax()); } - /** The shortest possible matched string length, or {@link java.util.Optional#empty()} if the language is empty. */ + /** @return The shortest possible matched string length, or {@link java.util.Optional#empty()} if the language is empty. */ public Optional getMin() { return Optional.ofNullable(min); } - /** The longest possible matched string length, or {@link java.util.Optional#empty()} if the length is unbounded. */ + /** @return The longest possible matched string length, or {@link java.util.Optional#empty()} if the length is unbounded. */ public Optional getMax() { return Optional.ofNullable(max); } diff --git a/src/main/java/com/regexsolver/api/OperationOptions.java b/src/main/java/com/regexsolver/api/OperationOptions.java index 56105be..6f44003 100644 --- a/src/main/java/com/regexsolver/api/OperationOptions.java +++ b/src/main/java/com/regexsolver/api/OperationOptions.java @@ -31,6 +31,9 @@ public static OperationOptions builder() { /** * Maximum time, in milliseconds, the engine may spend on the operation before aborting it. + * + * @param timeout the timeout in milliseconds + * @return these options */ public OperationOptions executionTimeout(Integer timeout) { this.executionTimeout = timeout; @@ -39,6 +42,9 @@ public OperationOptions executionTimeout(Integer timeout) { /** * Format of the term returned by the operation. + * + * @param format the requested response format + * @return these options */ public OperationOptions responseFormat(ResponseFormat format) { this.responseFormat = format; @@ -49,6 +55,9 @@ public OperationOptions responseFormat(ResponseFormat format) { * When true, guarantees the returned FAIR encodes a deterministic automaton. * Only valid with responseFormat = ResponseFormat.FAIR or when responseFormat is * unset (in which case it defaults to ResponseFormat.FAIR). Throws otherwise. + * + * @param deterministic whether the returned FAIR must be deterministic + * @return these options */ public OperationOptions deterministic(Boolean deterministic) { this.deterministic = deterministic; diff --git a/src/main/java/com/regexsolver/api/RegexSolverClient.java b/src/main/java/com/regexsolver/api/RegexSolverClient.java index 9ddaa05..145cf2f 100644 --- a/src/main/java/com/regexsolver/api/RegexSolverClient.java +++ b/src/main/java/com/regexsolver/api/RegexSolverClient.java @@ -39,6 +39,9 @@ public Builder baseUrl(String baseUrl) { * carrying more terms than the account's per-request limit are * transparently split into several requests and folded back into one * result. Each constituent request counts against the monthly quota. + * + * @param autoBatch whether to enable auto-batching + * @return this builder */ public Builder autoBatch(boolean autoBatch) { asyncBuilder.autoBatch(autoBatch); @@ -46,8 +49,11 @@ public Builder autoBatch(boolean autoBatch) { } /** - * Upper bound (>= 2) on the number of terms sent in a single request, - * overriding the limit fetched from the API when smaller. + * Upper bound (>= 2) on the number of terms sent in a single + * request, overriding the limit fetched from the API when smaller. + * + * @param maxTermsPerRequest the cap, or null to use the account limit + * @return this builder */ public Builder maxTermsPerRequest(Integer maxTermsPerRequest) { asyncBuilder.maxTermsPerRequest(maxTermsPerRequest); diff --git a/src/main/java/com/regexsolver/api/Term.java b/src/main/java/com/regexsolver/api/Term.java index 6e33908..d8de403 100644 --- a/src/main/java/com/regexsolver/api/Term.java +++ b/src/main/java/com/regexsolver/api/Term.java @@ -238,6 +238,8 @@ public static final class FairTerm extends Term { /** * Whether this FAIR encodes a deterministic automaton, or * {@link java.util.Optional#empty()} if it is not known yet. + * + * @return the cached determinism flag, if known */ public Optional getCachedDeterministic() { return this.deterministic;