diff --git a/build.gradle b/build.gradle index d933c91..7d63209 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ publishing { maven(MavenPublication) { groupId = 'io.squidex' artifactId = 'squidex' - version = '0.0.8' + version = '0.0.11' from components.java } } diff --git a/src/main/java/com/squidex/api/AccessToken.java b/src/main/java/com/squidex/api/AccessToken.java deleted file mode 100644 index 3a023d3..0000000 --- a/src/main/java/com/squidex/api/AccessToken.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.squidex.api; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.time.Instant; - -public final class AccessToken { - private final String accessToken; - private final int expiresIn; - private final Instant expiresAt; - - @JsonCreator() - public AccessToken( - @JsonProperty("access_token")String accessToken, - @JsonProperty("expires_in")int expiresIn) { - this.accessToken = accessToken; - this.expiresIn = expiresIn; - this.expiresAt = Instant.now().plusSeconds(expiresIn); - } - - - public String getAccessToken() { - return accessToken; - } - - - public int getExpiresIn() { - return expiresIn; - } - - @JsonIgnore() - public Instant getExpiresAt() { - return expiresAt; - } -} diff --git a/src/main/java/com/squidex/api/AuthInterceptor.java b/src/main/java/com/squidex/api/AuthInterceptor.java deleted file mode 100644 index e2f5bc0..0000000 --- a/src/main/java/com/squidex/api/AuthInterceptor.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.squidex.api; - -import com.squidex.api.core.Environment; -import com.squidex.api.core.ObjectMappers; -import okhttp3.*; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.time.Instant; -import java.util.Objects; - -public final class AuthInterceptor implements Interceptor { - private final Environment environment; - private final String clientId; - private final String clientSecret; - private final TokenStore tokenStore; - private final OkHttpClient httpClient; - - public AuthInterceptor(OkHttpClient httpClient, Environment environment, String clientId, String clientSecret, TokenStore tokenStore) { - this.httpClient = httpClient; - this.environment = environment; - this.clientId = clientId; - this.clientSecret = clientSecret; - this.tokenStore = tokenStore; - } - - @NotNull - @Override - public Response intercept(@NotNull Chain chain) throws IOException { - Request originalRequest = chain.request(); - - AccessToken token = this.tokenStore.get(); - if (token != null && token.getExpiresAt().isBefore(Instant.now())) { - // The token has been expired, therefore also remove it from the store for other calls. - token = null; - this.tokenStore.clear(); - } - - if (token == null) { - token = acquireToken(); - this.tokenStore.set(token); - } - - Request requestWithHeader = originalRequest.newBuilder() - .header("Authorization", String.format("Bearer %s", token.getAccessToken())) - .build(); - - Response response = chain.proceed(requestWithHeader); - if (response.code() == 401) { - this.tokenStore.clear(); - - return intercept(chain); - } - - return response; - } - - private AccessToken acquireToken() throws IOException { - RequestBody formBody = new FormBody.Builder() - .add("grant_type", "client_credentials") - .add("client_id", this.clientId) - .add("client_secret", this.clientSecret) - .add("scope", "squidex-api") - .build(); - - HttpUrl tokenUrl = Objects.requireNonNull(HttpUrl.parse(this.environment.getUrl())) - .newBuilder() - .addPathSegments("identity-server/connect/token") - .build(); - - Request tokenRequest = new Request.Builder() - .url(tokenUrl.url()) - .post(formBody) - .build(); - - AccessToken token; - try (Response response = this.httpClient.newCall(tokenRequest).execute()) { - assert response.body() != null; - token = ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AccessToken.class); - } - - return token; - } -} \ No newline at end of file diff --git a/src/main/java/com/squidex/api/InMemoryTokenStore.java b/src/main/java/com/squidex/api/InMemoryTokenStore.java deleted file mode 100644 index 1d074e9..0000000 --- a/src/main/java/com/squidex/api/InMemoryTokenStore.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.squidex.api; - -public class InMemoryTokenStore implements TokenStore { - private AccessToken currentToken; - - @Override - public AccessToken get() { - return this.currentToken; - } - - @Override - public void set(AccessToken token) { - this.currentToken = token; - } - - @Override - public void clear() { - this.currentToken = null; - } -} diff --git a/src/main/java/com/squidex/api/SquidexApiClient.java b/src/main/java/com/squidex/api/SquidexApiClient.java deleted file mode 100644 index 45d20ba..0000000 --- a/src/main/java/com/squidex/api/SquidexApiClient.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.squidex.api; - -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Suppliers; -import com.squidex.api.resources.apps.AppsClient; -import com.squidex.api.resources.assets.AssetsClient; -import com.squidex.api.resources.backups.BackupsClient; -import com.squidex.api.resources.comments.CommentsClient; -import com.squidex.api.resources.contents.ContentsClient; -import com.squidex.api.resources.diagnostics.DiagnosticsClient; -import com.squidex.api.resources.eventconsumers.EventConsumersClient; -import com.squidex.api.resources.history.HistoryClient; -import com.squidex.api.resources.languages.LanguagesClient; -import com.squidex.api.resources.news.NewsClient; -import com.squidex.api.resources.notifications.NotificationsClient; -import com.squidex.api.resources.ping.PingClient; -import com.squidex.api.resources.plans.PlansClient; -import com.squidex.api.resources.rules.RulesClient; -import com.squidex.api.resources.schemas.SchemasClient; -import com.squidex.api.resources.search.SearchClient; -import com.squidex.api.resources.statistics.StatisticsClient; -import com.squidex.api.resources.teams.TeamsClient; -import com.squidex.api.resources.templates.TemplatesClient; -import com.squidex.api.resources.translations.TranslationsClient; -import com.squidex.api.resources.usermanagement.UserManagementClient; -import com.squidex.api.resources.users.UsersClient; -import java.util.function.Supplier; - -public class SquidexApiClient { - protected final ClientOptions clientOptions; - - protected final Supplier userManagementClient; - - protected final Supplier usersClient; - - protected final Supplier translationsClient; - - protected final Supplier templatesClient; - - protected final Supplier teamsClient; - - protected final Supplier statisticsClient; - - protected final Supplier searchClient; - - protected final Supplier schemasClient; - - protected final Supplier rulesClient; - - protected final Supplier plansClient; - - protected final Supplier pingClient; - - protected final Supplier newsClient; - - protected final Supplier languagesClient; - - protected final Supplier historyClient; - - protected final Supplier eventConsumersClient; - - protected final Supplier diagnosticsClient; - - protected final Supplier contentsClient; - - protected final Supplier commentsClient; - - protected final Supplier notificationsClient; - - protected final Supplier backupsClient; - - protected final Supplier assetsClient; - - protected final Supplier appsClient; - - public SquidexApiClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.userManagementClient = Suppliers.memoize(() -> new UserManagementClient(clientOptions)); - this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); - this.translationsClient = Suppliers.memoize(() -> new TranslationsClient(clientOptions)); - this.templatesClient = Suppliers.memoize(() -> new TemplatesClient(clientOptions)); - this.teamsClient = Suppliers.memoize(() -> new TeamsClient(clientOptions)); - this.statisticsClient = Suppliers.memoize(() -> new StatisticsClient(clientOptions)); - this.searchClient = Suppliers.memoize(() -> new SearchClient(clientOptions)); - this.schemasClient = Suppliers.memoize(() -> new SchemasClient(clientOptions)); - this.rulesClient = Suppliers.memoize(() -> new RulesClient(clientOptions)); - this.plansClient = Suppliers.memoize(() -> new PlansClient(clientOptions)); - this.pingClient = Suppliers.memoize(() -> new PingClient(clientOptions)); - this.newsClient = Suppliers.memoize(() -> new NewsClient(clientOptions)); - this.languagesClient = Suppliers.memoize(() -> new LanguagesClient(clientOptions)); - this.historyClient = Suppliers.memoize(() -> new HistoryClient(clientOptions)); - this.eventConsumersClient = Suppliers.memoize(() -> new EventConsumersClient(clientOptions)); - this.diagnosticsClient = Suppliers.memoize(() -> new DiagnosticsClient(clientOptions)); - this.contentsClient = Suppliers.memoize(() -> new ContentsClient(clientOptions)); - this.commentsClient = Suppliers.memoize(() -> new CommentsClient(clientOptions)); - this.notificationsClient = Suppliers.memoize(() -> new NotificationsClient(clientOptions)); - this.backupsClient = Suppliers.memoize(() -> new BackupsClient(clientOptions)); - this.assetsClient = Suppliers.memoize(() -> new AssetsClient(clientOptions)); - this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); - } - - public UserManagementClient userManagement() { - return this.userManagementClient.get(); - } - - public UsersClient users() { - return this.usersClient.get(); - } - - public TranslationsClient translations() { - return this.translationsClient.get(); - } - - public TemplatesClient templates() { - return this.templatesClient.get(); - } - - public TeamsClient teams() { - return this.teamsClient.get(); - } - - public StatisticsClient statistics() { - return this.statisticsClient.get(); - } - - public SearchClient search() { - return this.searchClient.get(); - } - - public SchemasClient schemas() { - return this.schemasClient.get(); - } - - public RulesClient rules() { - return this.rulesClient.get(); - } - - public PlansClient plans() { - return this.plansClient.get(); - } - - public PingClient ping() { - return this.pingClient.get(); - } - - public NewsClient news() { - return this.newsClient.get(); - } - - public LanguagesClient languages() { - return this.languagesClient.get(); - } - - public HistoryClient history() { - return this.historyClient.get(); - } - - public EventConsumersClient eventConsumers() { - return this.eventConsumersClient.get(); - } - - public DiagnosticsClient diagnostics() { - return this.diagnosticsClient.get(); - } - - public ContentsClient contents() { - return this.contentsClient.get(); - } - - public CommentsClient comments() { - return this.commentsClient.get(); - } - - public NotificationsClient notifications() { - return this.notificationsClient.get(); - } - - public BackupsClient backups() { - return this.backupsClient.get(); - } - - public AssetsClient assets() { - return this.assetsClient.get(); - } - - public AppsClient apps() { - return this.appsClient.get(); - } - - public static SquidexApiClientBuilder builder() { - return new SquidexApiClientBuilder(); - } -} diff --git a/src/main/java/com/squidex/api/SquidexApiClientBuilder.java b/src/main/java/com/squidex/api/SquidexApiClientBuilder.java deleted file mode 100644 index 6d4bced..0000000 --- a/src/main/java/com/squidex/api/SquidexApiClientBuilder.java +++ /dev/null @@ -1,123 +0,0 @@ -package com.squidex.api; - -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Environment; -import okhttp3.OkHttpClient; - -import javax.net.ssl.*; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; - -public final class SquidexApiClientBuilder { - private final ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); - - private Environment environment = Environment.DEFAULT; - private String clientId; - private String clientSecret; - private TokenStore tokenStore; - private OkHttpClient httpClient; - private boolean trustAllCerts; - - public SquidexApiClientBuilder environment(Environment environment) { - this.environment = environment; - return this; - } - - public SquidexApiClientBuilder url(String url) { - this.environment = Environment.custom(url); - return this; - } - - public SquidexApiClientBuilder clientId(String clientId) { - this.clientId = clientId; - return this; - } - - public String clientId() { - return this.clientId; - } - - public SquidexApiClientBuilder clientSecret(String clientSecret) { - this.clientSecret = clientSecret; - return this; - } - - public String clientSecret() { - return this.clientSecret; - } - - public SquidexApiClientBuilder tokenStore(TokenStore tokenStore) { - this.tokenStore = tokenStore; - return this; - } - - public SquidexApiClientBuilder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public SquidexApiClientBuilder appName(String appName) { - this.clientOptionsBuilder.appName(appName); - return this; - } - - public SquidexApiClientBuilder trustAllCerts() { - this.trustAllCerts = true; - return this; - } - - public SquidexApiClient build() { - clientOptionsBuilder.environment(this.environment); - - if (this.tokenStore == null) { - this.tokenStore = new InMemoryTokenStore(); - } - - if (this.httpClient == null) { - this.httpClient = new OkHttpClient(); - } - - if (this.trustAllCerts) { - X509TrustManager trustAllCerts = new X509TrustManager() { - @Override - public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) { - } - - @Override - public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) { - } - - @Override - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; - } - }; - - try { - SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(null, new TrustManager[] { trustAllCerts }, new java.security.SecureRandom()); - - this.httpClient = this.httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), trustAllCerts) - .build(); - } catch (NoSuchAlgorithmException | KeyManagementException e) { - throw new RuntimeException(e); - } - } - - AuthInterceptor interceptor = new AuthInterceptor( - this.httpClient, - this.environment, - this.clientId, - this.clientSecret, - this.tokenStore); - - this.httpClient = this.httpClient.newBuilder() - .addInterceptor(interceptor) - .build(); - - clientOptionsBuilder.httpClient(this.httpClient); - - return new SquidexApiClient(clientOptionsBuilder.build()); - } -} diff --git a/src/main/java/com/squidex/api/TokenStore.java b/src/main/java/com/squidex/api/TokenStore.java deleted file mode 100644 index 4b95ef6..0000000 --- a/src/main/java/com/squidex/api/TokenStore.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.squidex.api; - -public interface TokenStore { - AccessToken get(); - - void set(AccessToken token); - - void clear(); -} - diff --git a/src/main/java/com/squidex/api/core/ApiError.java b/src/main/java/com/squidex/api/core/ApiError.java deleted file mode 100644 index 8a38adc..0000000 --- a/src/main/java/com/squidex/api/core/ApiError.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.core; - -public final class ApiError extends RuntimeException { - private final int statusCode; - - private final Object body; - - public ApiError(int statusCode, Object body) { - this.statusCode = statusCode; - this.body = body; - } - - public int statusCode() { - return this.statusCode; - } - - public Object body() { - return this.body; - } - - @Override - public String toString() { - return "ApiError{" + "statusCode: " + statusCode + ", body: " + body + "}"; - } -} diff --git a/src/main/java/com/squidex/api/core/ClientOptions.java b/src/main/java/com/squidex/api/core/ClientOptions.java deleted file mode 100644 index 3398069..0000000 --- a/src/main/java/com/squidex/api/core/ClientOptions.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.squidex.api.core; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; -import okhttp3.OkHttpClient; - -public final class ClientOptions { - private final Environment environment; - - private final Map headers; - - private final Map> headerSuppliers; - - private final OkHttpClient httpClient; - - private String appName; - - private ClientOptions( - Environment environment, - Map headers, - Map> headerSuppliers, - OkHttpClient httpClient, - String appName) { - this.environment = environment; - this.headers = new HashMap<>(); - this.headers.putAll(headers); - this.headers.putAll(Map.of( - "X-Fern-SDK-Name", - "com.squidex.fern:api-sdk", - "X-Fern-SDK-Version", - "0.0.7", - "X-Fern-Language", - "JAVA")); - this.headerSuppliers = headerSuppliers; - this.httpClient = httpClient; - this.appName = appName; - } - - public Environment environment() { - return this.environment; - } - - public Map headers(RequestOptions requestOptions) { - Map values = new HashMap<>(this.headers); - headerSuppliers.forEach((key, supplier) -> { - values.put(key, supplier.get()); - }); - if (requestOptions != null) { - values.putAll(requestOptions.getHeaders()); - } - return values; - } - - public OkHttpClient httpClient() { - return this.httpClient; - } - - public String appName() { - return this.appName; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private Environment environment; - - private OkHttpClient httpClient; - - private final Map headers = new HashMap<>(); - - private final Map> headerSuppliers = new HashMap<>(); - - private String appName; - - public Builder environment(Environment environment) { - this.environment = environment; - return this; - } - - public Builder addHeader(String key, String value) { - this.headers.put(key, value); - return this; - } - - public Builder addHeader(String key, Supplier value) { - this.headerSuppliers.put(key, value); - return this; - } - - public Builder appName(String appName) { - this.appName = appName; - return this; - } - - public Builder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public ClientOptions build() { - if (this.httpClient == null) { - this.httpClient = new OkHttpClient(); - } - - return new ClientOptions(environment, headers, headerSuppliers, this.httpClient, this.appName); - } - } -} diff --git a/src/main/java/com/squidex/api/core/Environment.java b/src/main/java/com/squidex/api/core/Environment.java deleted file mode 100644 index 26e5194..0000000 --- a/src/main/java/com/squidex/api/core/Environment.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.squidex.api.core; - -public final class Environment { - public static final Environment DEFAULT = new Environment("https://cloud.squidex.io"); - - private final String url; - - private Environment(String url) { - this.url = url; - } - - public String getUrl() { - return this.url; - } - - public static Environment custom(String url) { - return new Environment(url); - } -} diff --git a/src/main/java/com/squidex/api/core/ObjectMappers.java b/src/main/java/com/squidex/api/core/ObjectMappers.java deleted file mode 100644 index 5aa1c1e..0000000 --- a/src/main/java/com/squidex/api/core/ObjectMappers.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.squidex.api.core; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; - -public final class ObjectMappers { - public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() - .addModule(new Jdk8Module()) - .addModule(new JavaTimeModule()) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .build(); - - private ObjectMappers() {} -} diff --git a/src/main/java/com/squidex/api/core/RequestOptions.java b/src/main/java/com/squidex/api/core/RequestOptions.java deleted file mode 100644 index 368c13e..0000000 --- a/src/main/java/com/squidex/api/core/RequestOptions.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.squidex.api.core; - -import java.util.HashMap; -import java.util.Map; - -public final class RequestOptions { - private final String token; - - private RequestOptions(String token) { - this.token = token; - } - - public Map getHeaders() { - Map headers = new HashMap<>(); - if (this.token != null) { - headers.put("Authorization", "Bearer " + this.token); - } - return headers; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private String token = null; - - public Builder token(String token) { - this.token = token; - return this; - } - - public RequestOptions build() { - return new RequestOptions(token); - } - } -} diff --git a/src/main/java/com/squidex/api/core/Suppliers.java b/src/main/java/com/squidex/api/core/Suppliers.java deleted file mode 100644 index 0e34ed1..0000000 --- a/src/main/java/com/squidex/api/core/Suppliers.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.squidex.api.core; - -import java.util.Objects; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; - -public final class Suppliers { - private Suppliers() {} - - public static Supplier memoize(Supplier delegate) { - AtomicReference value = new AtomicReference<>(); - return () -> { - T val = value.get(); - if (val == null) { - val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); - } - return val; - }; - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/AppsClient.java b/src/main/java/com/squidex/api/resources/apps/AppsClient.java deleted file mode 100644 index e3acba7..0000000 --- a/src/main/java/com/squidex/api/resources/apps/AppsClient.java +++ /dev/null @@ -1,1314 +0,0 @@ -package com.squidex.api.resources.apps; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.apps.requests.AddLanguageDto; -import com.squidex.api.resources.apps.requests.AddRoleDto; -import com.squidex.api.resources.apps.requests.AddWorkflowDto; -import com.squidex.api.resources.apps.requests.AppsUploadImageRequest; -import com.squidex.api.resources.apps.requests.CreateAppDto; -import com.squidex.api.resources.apps.requests.CreateClientDto; -import com.squidex.api.resources.apps.requests.TransferToTeamDto; -import com.squidex.api.resources.apps.requests.UpdateAppDto; -import com.squidex.api.resources.apps.requests.UpdateAppSettingsDto; -import com.squidex.api.resources.apps.requests.UpdateAssetScriptsDto; -import com.squidex.api.resources.apps.requests.UpdateClientDto; -import com.squidex.api.resources.apps.requests.UpdateLanguageDto; -import com.squidex.api.resources.apps.requests.UpdateRoleDto; -import com.squidex.api.resources.apps.requests.UpdateWorkflowDto; -import com.squidex.api.types.AppDto; -import com.squidex.api.types.AppLanguagesDto; -import com.squidex.api.types.AppSettingsDto; -import com.squidex.api.types.AssetScriptsDto; -import com.squidex.api.types.AssignContributorDto; -import com.squidex.api.types.ClientsDto; -import com.squidex.api.types.ContributorsDto; -import com.squidex.api.types.RolesDto; -import com.squidex.api.types.WorkflowsDto; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.MultipartBody; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class AppsClient { - protected final ClientOptions clientOptions; - - public AppsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public AssetScriptsDto getAssetScripts() { - return getAssetScripts(null); - } - - public AssetScriptsDto getAssetScripts(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/scripts") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetScriptsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request) { - return putAssetScripts(request, null); - } - - public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/scripts") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getQuery().isPresent()) { - _requestBodyProperties.put("query", request.getQuery()); - } - if (request.getQueryPre().isPresent()) { - _requestBodyProperties.put("queryPre", request.getQueryPre()); - } - if (request.getCreate().isPresent()) { - _requestBodyProperties.put("create", request.getCreate()); - } - if (request.getUpdate().isPresent()) { - _requestBodyProperties.put("update", request.getUpdate()); - } - if (request.getAnnotate().isPresent()) { - _requestBodyProperties.put("annotate", request.getAnnotate()); - } - if (request.getMove().isPresent()) { - _requestBodyProperties.put("move", request.getMove()); - } - if (request.getDelete().isPresent()) { - _requestBodyProperties.put("delete", request.getDelete()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetScriptsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ClientsDto getClients() { - return getClients(null); - } - - public ClientsDto getClients(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ClientsDto postClient(CreateClientDto request) { - return postClient(request, null); - } - - public ClientsDto postClient(CreateClientDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("id", request.getId()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ClientsDto putClient(String id, UpdateClientDto request) { - return putClient(id, request, null); - } - - public ClientsDto putClient(String id, UpdateClientDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getName().isPresent()) { - _requestBodyProperties.put("name", request.getName()); - } - if (request.getRole().isPresent()) { - _requestBodyProperties.put("role", request.getRole()); - } - if (request.getAllowAnonymous().isPresent()) { - _requestBodyProperties.put("allowAnonymous", request.getAllowAnonymous()); - } - if (request.getApiCallsLimit().isPresent()) { - _requestBodyProperties.put("apiCallsLimit", request.getApiCallsLimit()); - } - if (request.getApiTrafficLimit().isPresent()) { - _requestBodyProperties.put("apiTrafficLimit", request.getApiTrafficLimit()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ClientsDto deleteClient(String id) { - return deleteClient(id, null); - } - - public ClientsDto deleteClient(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto getContributors() { - return getContributors(null); - } - - public ContributorsDto getContributors(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto postContributor(AssignContributorDto request) { - return postContributor(request, null); - } - - public ContributorsDto postContributor(AssignContributorDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteMyself() { - return deleteMyself(null); - } - - public ContributorsDto deleteMyself(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors/me") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteContributor(String id) { - return deleteContributor(id, null); - } - - public ContributorsDto deleteContributor(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getImage() { - return getImage(null); - } - - public InputStream getImage(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto uploadImage(File file, AppsUploadImageRequest request) { - return uploadImage(file, request, null); - } - - public AppDto uploadImage(File file, AppsUploadImageRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - MultipartBody.Builder _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); - _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); - RequestBody _requestBody = _multipartBody.build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto deleteImage() { - return deleteImage(null); - } - - public AppDto deleteImage(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto getLanguages() { - return getLanguages(null); - } - - public AppLanguagesDto getLanguages(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto postLanguage(AddLanguageDto request) { - return postLanguage(request, null); - } - - public AppLanguagesDto postLanguage(AddLanguageDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("language", request.getLanguage()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request) { - return putLanguage(language, request, null); - } - - public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .addPathSegment(language) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getIsMaster().isPresent()) { - _requestBodyProperties.put("isMaster", request.getIsMaster()); - } - if (request.getIsOptional().isPresent()) { - _requestBodyProperties.put("isOptional", request.getIsOptional()); - } - if (request.getFallback().isPresent()) { - _requestBodyProperties.put("fallback", request.getFallback()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto deleteLanguage(String language) { - return deleteLanguage(language, null); - } - - public AppLanguagesDto deleteLanguage(String language, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .addPathSegment(language) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto getRoles() { - return getRoles(null); - } - - public RolesDto getRoles(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto postRole(AddRoleDto request) { - return postRole(request, null); - } - - public RolesDto postRole(AddRoleDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getPermissions() { - return getPermissions(null); - } - - public List getPermissions(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles/permissions") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto putRole(String roleName, UpdateRoleDto request) { - return putRole(roleName, request, null); - } - - public RolesDto putRole(String roleName, UpdateRoleDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .addPathSegment(roleName) - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("permissions", request.getPermissions()); - if (request.getProperties().isPresent()) { - _requestBodyProperties.put("properties", request.getProperties()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto deleteRole(String roleName) { - return deleteRole(roleName, null); - } - - public RolesDto deleteRole(String roleName, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .addPathSegment(roleName) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getApps() { - return getApps(null); - } - - public List getApps(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto postApp(CreateAppDto request) { - return postApp(request, null); - } - - public AppDto postApp(CreateAppDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - if (request.getTemplate().isPresent()) { - _requestBodyProperties.put("template", request.getTemplate()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getTeamApps(String team) { - return getTeamApps(team, null); - } - - public List getTeamApps(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("apps") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto getApp() { - return getApp(null); - } - - public AppDto getApp(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto putApp(UpdateAppDto request) { - return putApp(request, null); - } - - public AppDto putApp(UpdateAppDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getLabel().isPresent()) { - _requestBodyProperties.put("label", request.getLabel()); - } - if (request.getDescription().isPresent()) { - _requestBodyProperties.put("description", request.getDescription()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteApp() { - deleteApp(null); - } - - public void deleteApp(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto putAppTeam(TransferToTeamDto request) { - return putAppTeam(request, null); - } - - public AppDto putAppTeam(TransferToTeamDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("team") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getTeamId().isPresent()) { - _requestBodyProperties.put("teamId", request.getTeamId()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppSettingsDto getSettings() { - return getSettings(null); - } - - public AppSettingsDto getSettings(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("settings") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppSettingsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppSettingsDto putSettings(UpdateAppSettingsDto request) { - return putSettings(request, null); - } - - public AppSettingsDto putSettings(UpdateAppSettingsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("settings") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("patterns", request.getPatterns()); - _requestBodyProperties.put("editors", request.getEditors()); - if (request.getHideScheduler().isPresent()) { - _requestBodyProperties.put("hideScheduler", request.getHideScheduler()); - } - if (request.getHideDateTimeModeButton().isPresent()) { - _requestBodyProperties.put("hideDateTimeModeButton", request.getHideDateTimeModeButton()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppSettingsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto getWorkflows() { - return getWorkflows(null); - } - - public WorkflowsDto getWorkflows(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto postWorkflow(AddWorkflowDto request) { - return postWorkflow(request, null); - } - - public WorkflowsDto postWorkflow(AddWorkflowDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto putWorkflow(String id, UpdateWorkflowDto request) { - return putWorkflow(id, request, null); - } - - public WorkflowsDto putWorkflow(String id, UpdateWorkflowDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getName().isPresent()) { - _requestBodyProperties.put("name", request.getName()); - } - _requestBodyProperties.put("steps", request.getSteps()); - if (request.getSchemaIds().isPresent()) { - _requestBodyProperties.put("schemaIds", request.getSchemaIds()); - } - _requestBodyProperties.put("initial", request.getInitial()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto deleteWorkflow(String id) { - return deleteWorkflow(id, null); - } - - public WorkflowsDto deleteWorkflow(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java deleted file mode 100644 index 5edc443..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddLanguageDto.Builder.class) -public final class AddLanguageDto { - private final String language; - - private AddLanguageDto(String language) { - this.language = language; - } - - /** - * @return The language to add. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("language") - public String getLanguage() { - return language; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddLanguageDto && equalTo((AddLanguageDto) other); - } - - private boolean equalTo(AddLanguageDto other) { - return language.equals(other.language); - } - - @Override - public int hashCode() { - return Objects.hash(this.language); - } - - @Override - public String toString() { - return "AddLanguageDto{" + "language: " + language + "}"; - } - - public static LanguageStage builder() { - return new Builder(); - } - - public interface LanguageStage { - _FinalStage language(String language); - - Builder from(AddLanguageDto other); - } - - public interface _FinalStage { - AddLanguageDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LanguageStage, _FinalStage { - private String language; - - private Builder() {} - - @Override - public Builder from(AddLanguageDto other) { - language(other.getLanguage()); - return this; - } - - /** - *

The language to add. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("language") - public _FinalStage language(String language) { - this.language = language; - return this; - } - - @Override - public AddLanguageDto build() { - return new AddLanguageDto(language); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java deleted file mode 100644 index ca99cd5..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddRoleDto.Builder.class) -public final class AddRoleDto { - private final String name; - - private AddRoleDto(String name) { - this.name = name; - } - - /** - * @return The role name. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddRoleDto && equalTo((AddRoleDto) other); - } - - private boolean equalTo(AddRoleDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return "AddRoleDto{" + "name: " + name + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(AddRoleDto other); - } - - public interface _FinalStage { - AddRoleDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(AddRoleDto other) { - name(other.getName()); - return this; - } - - /** - *

The role name. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public AddRoleDto build() { - return new AddRoleDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java deleted file mode 100644 index 085ecce..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddWorkflowDto.Builder.class) -public final class AddWorkflowDto { - private final String name; - - private AddWorkflowDto(String name) { - this.name = name; - } - - /** - * @return The name of the workflow. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddWorkflowDto && equalTo((AddWorkflowDto) other); - } - - private boolean equalTo(AddWorkflowDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return "AddWorkflowDto{" + "name: " + name + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(AddWorkflowDto other); - } - - public interface _FinalStage { - AddWorkflowDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(AddWorkflowDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the workflow. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public AddWorkflowDto build() { - return new AddWorkflowDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java b/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java deleted file mode 100644 index 4f409c3..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -public final class AppsUploadImageRequest { - private AppsUploadImageRequest() {} - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppsUploadImageRequest; - } - - @Override - public String toString() { - return "AppsUploadImageRequest{" + "}"; - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java b/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java deleted file mode 100644 index 1f2820e..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateAppDto.Builder.class) -public final class CreateAppDto { - private final String name; - - private final Optional template; - - private CreateAppDto(String name, Optional template) { - this.name = name; - this.template = template; - } - - /** - * @return The name of the app. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Initialize the app with the inbuilt template. - */ - @JsonProperty("template") - public Optional getTemplate() { - return template; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateAppDto && equalTo((CreateAppDto) other); - } - - private boolean equalTo(CreateAppDto other) { - return name.equals(other.name) && template.equals(other.template); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.template); - } - - @Override - public String toString() { - return "CreateAppDto{" + "name: " + name + ", template: " + template + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateAppDto other); - } - - public interface _FinalStage { - CreateAppDto build(); - - _FinalStage template(Optional template); - - _FinalStage template(String template); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Optional template = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateAppDto other) { - name(other.getName()); - template(other.getTemplate()); - return this; - } - - /** - *

The name of the app. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

Initialize the app with the inbuilt template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage template(String template) { - this.template = Optional.of(template); - return this; - } - - @Override - @JsonSetter(value = "template", nulls = Nulls.SKIP) - public _FinalStage template(Optional template) { - this.template = template; - return this; - } - - @Override - public CreateAppDto build() { - return new CreateAppDto(name, template); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java b/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java deleted file mode 100644 index afd01b9..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateClientDto.Builder.class) -public final class CreateClientDto { - private final String id; - - private CreateClientDto(String id) { - this.id = id; - } - - /** - * @return The ID of the client. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("id") - public String getId() { - return id; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateClientDto && equalTo((CreateClientDto) other); - } - - private boolean equalTo(CreateClientDto other) { - return id.equals(other.id); - } - - @Override - public int hashCode() { - return Objects.hash(this.id); - } - - @Override - public String toString() { - return "CreateClientDto{" + "id: " + id + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(String id); - - Builder from(CreateClientDto other); - } - - public interface _FinalStage { - CreateClientDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - private Builder() {} - - @Override - public Builder from(CreateClientDto other) { - id(other.getId()); - return this; - } - - /** - *

The ID of the client. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public _FinalStage id(String id) { - this.id = id; - return this; - } - - @Override - public CreateClientDto build() { - return new CreateClientDto(id); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java b/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java deleted file mode 100644 index 108c045..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TransferToTeamDto.Builder.class) -public final class TransferToTeamDto { - private final Optional teamId; - - private TransferToTeamDto(Optional teamId) { - this.teamId = teamId; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("teamId") - public Optional getTeamId() { - return teamId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TransferToTeamDto && equalTo((TransferToTeamDto) other); - } - - private boolean equalTo(TransferToTeamDto other) { - return teamId.equals(other.teamId); - } - - @Override - public int hashCode() { - return Objects.hash(this.teamId); - } - - @Override - public String toString() { - return "TransferToTeamDto{" + "teamId: " + teamId + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional teamId = Optional.empty(); - - private Builder() {} - - public Builder from(TransferToTeamDto other) { - teamId(other.getTeamId()); - return this; - } - - @JsonSetter(value = "teamId", nulls = Nulls.SKIP) - public Builder teamId(Optional teamId) { - this.teamId = teamId; - return this; - } - - public Builder teamId(String teamId) { - this.teamId = Optional.of(teamId); - return this; - } - - public TransferToTeamDto build() { - return new TransferToTeamDto(teamId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java deleted file mode 100644 index e707e07..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAppDto.Builder.class) -public final class UpdateAppDto { - private final Optional label; - - private final Optional description; - - private UpdateAppDto(Optional label, Optional description) { - this.label = label; - this.description = description; - } - - /** - * @return The optional label of your app. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return The optional description of your app. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAppDto && equalTo((UpdateAppDto) other); - } - - private boolean equalTo(UpdateAppDto other) { - return label.equals(other.label) && description.equals(other.description); - } - - @Override - public int hashCode() { - return Objects.hash(this.label, this.description); - } - - @Override - public String toString() { - return "UpdateAppDto{" + "label: " + label + ", description: " + description + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional label = Optional.empty(); - - private Optional description = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAppDto other) { - label(other.getLabel()); - description(other.getDescription()); - return this; - } - - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public Builder label(Optional label) { - this.label = label; - return this; - } - - public Builder label(String label) { - this.label = Optional.of(label); - return this; - } - - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public Builder description(Optional description) { - this.description = description; - return this; - } - - public Builder description(String description) { - this.description = Optional.of(description); - return this; - } - - public UpdateAppDto build() { - return new UpdateAppDto(label, description); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java deleted file mode 100644 index 719d8d7..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.EditorDto; -import com.squidex.api.types.PatternDto; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAppSettingsDto.Builder.class) -public final class UpdateAppSettingsDto { - private final List patterns; - - private final List editors; - - private final Optional hideScheduler; - - private final Optional hideDateTimeModeButton; - - private UpdateAppSettingsDto( - List patterns, - List editors, - Optional hideScheduler, - Optional hideDateTimeModeButton) { - this.patterns = patterns; - this.editors = editors; - this.hideScheduler = hideScheduler; - this.hideDateTimeModeButton = hideDateTimeModeButton; - } - - /** - * @return The configured app patterns. - */ - @JsonProperty("patterns") - public List getPatterns() { - return patterns; - } - - /** - * @return The configured UI editors. - */ - @JsonProperty("editors") - public List getEditors() { - return editors; - } - - /** - * @return Hide the scheduler for content items. - */ - @JsonProperty("hideScheduler") - public Optional getHideScheduler() { - return hideScheduler; - } - - /** - * @return Hide the datetime mode button. - */ - @JsonProperty("hideDateTimeModeButton") - public Optional getHideDateTimeModeButton() { - return hideDateTimeModeButton; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAppSettingsDto && equalTo((UpdateAppSettingsDto) other); - } - - private boolean equalTo(UpdateAppSettingsDto other) { - return patterns.equals(other.patterns) - && editors.equals(other.editors) - && hideScheduler.equals(other.hideScheduler) - && hideDateTimeModeButton.equals(other.hideDateTimeModeButton); - } - - @Override - public int hashCode() { - return Objects.hash(this.patterns, this.editors, this.hideScheduler, this.hideDateTimeModeButton); - } - - @Override - public String toString() { - return "UpdateAppSettingsDto{" + "patterns: " + patterns + ", editors: " + editors + ", hideScheduler: " - + hideScheduler + ", hideDateTimeModeButton: " + hideDateTimeModeButton + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List patterns = new ArrayList<>(); - - private List editors = new ArrayList<>(); - - private Optional hideScheduler = Optional.empty(); - - private Optional hideDateTimeModeButton = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAppSettingsDto other) { - patterns(other.getPatterns()); - editors(other.getEditors()); - hideScheduler(other.getHideScheduler()); - hideDateTimeModeButton(other.getHideDateTimeModeButton()); - return this; - } - - @JsonSetter(value = "patterns", nulls = Nulls.SKIP) - public Builder patterns(List patterns) { - this.patterns.clear(); - this.patterns.addAll(patterns); - return this; - } - - public Builder addPatterns(PatternDto patterns) { - this.patterns.add(patterns); - return this; - } - - public Builder addAllPatterns(List patterns) { - this.patterns.addAll(patterns); - return this; - } - - @JsonSetter(value = "editors", nulls = Nulls.SKIP) - public Builder editors(List editors) { - this.editors.clear(); - this.editors.addAll(editors); - return this; - } - - public Builder addEditors(EditorDto editors) { - this.editors.add(editors); - return this; - } - - public Builder addAllEditors(List editors) { - this.editors.addAll(editors); - return this; - } - - @JsonSetter(value = "hideScheduler", nulls = Nulls.SKIP) - public Builder hideScheduler(Optional hideScheduler) { - this.hideScheduler = hideScheduler; - return this; - } - - public Builder hideScheduler(Boolean hideScheduler) { - this.hideScheduler = Optional.of(hideScheduler); - return this; - } - - @JsonSetter(value = "hideDateTimeModeButton", nulls = Nulls.SKIP) - public Builder hideDateTimeModeButton(Optional hideDateTimeModeButton) { - this.hideDateTimeModeButton = hideDateTimeModeButton; - return this; - } - - public Builder hideDateTimeModeButton(Boolean hideDateTimeModeButton) { - this.hideDateTimeModeButton = Optional.of(hideDateTimeModeButton); - return this; - } - - public UpdateAppSettingsDto build() { - return new UpdateAppSettingsDto(patterns, editors, hideScheduler, hideDateTimeModeButton); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java deleted file mode 100644 index f3ab0cd..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAssetScriptsDto.Builder.class) -public final class UpdateAssetScriptsDto { - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional annotate; - - private final Optional move; - - private final Optional delete; - - private UpdateAssetScriptsDto( - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional annotate, - Optional move, - Optional delete) { - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.annotate = annotate; - this.move = move; - this.delete = delete; - } - - /** - * @return The script that is executed for each asset when querying assets. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all assets when querying assets. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating an asset. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when annotating a content. - */ - @JsonProperty("annotate") - public Optional getAnnotate() { - return annotate; - } - - /** - * @return The script that is executed when moving a content. - */ - @JsonProperty("move") - public Optional getMove() { - return move; - } - - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAssetScriptsDto && equalTo((UpdateAssetScriptsDto) other); - } - - private boolean equalTo(UpdateAssetScriptsDto other) { - return query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && annotate.equals(other.annotate) - && move.equals(other.move) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.queryPre, this.create, this.update, this.annotate, this.move, this.delete); - } - - @Override - public String toString() { - return "UpdateAssetScriptsDto{" + "query: " + query + ", queryPre: " + queryPre + ", create: " + create - + ", update: " + update + ", annotate: " + annotate + ", move: " + move + ", delete: " + delete + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional annotate = Optional.empty(); - - private Optional move = Optional.empty(); - - private Optional delete = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAssetScriptsDto other) { - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - annotate(other.getAnnotate()); - move(other.getMove()); - delete(other.getDelete()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public Builder queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - public Builder queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public Builder create(Optional create) { - this.create = create; - return this; - } - - public Builder create(String create) { - this.create = Optional.of(create); - return this; - } - - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public Builder update(Optional update) { - this.update = update; - return this; - } - - public Builder update(String update) { - this.update = Optional.of(update); - return this; - } - - @JsonSetter(value = "annotate", nulls = Nulls.SKIP) - public Builder annotate(Optional annotate) { - this.annotate = annotate; - return this; - } - - public Builder annotate(String annotate) { - this.annotate = Optional.of(annotate); - return this; - } - - @JsonSetter(value = "move", nulls = Nulls.SKIP) - public Builder move(Optional move) { - this.move = move; - return this; - } - - public Builder move(String move) { - this.move = Optional.of(move); - return this; - } - - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public Builder delete(Optional delete) { - this.delete = delete; - return this; - } - - public Builder delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - public UpdateAssetScriptsDto build() { - return new UpdateAssetScriptsDto(query, queryPre, create, update, annotate, move, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java deleted file mode 100644 index a0c7a84..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateClientDto.Builder.class) -public final class UpdateClientDto { - private final Optional name; - - private final Optional role; - - private final Optional allowAnonymous; - - private final Optional apiCallsLimit; - - private final Optional apiTrafficLimit; - - private UpdateClientDto( - Optional name, - Optional role, - Optional allowAnonymous, - Optional apiCallsLimit, - Optional apiTrafficLimit) { - this.name = name; - this.role = role; - this.allowAnonymous = allowAnonymous; - this.apiCallsLimit = apiCallsLimit; - this.apiTrafficLimit = apiTrafficLimit; - } - - /** - * @return The new display name of the client. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The role of the client. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - /** - * @return True to allow anonymous access without an access token for this client. - */ - @JsonProperty("allowAnonymous") - public Optional getAllowAnonymous() { - return allowAnonymous; - } - - /** - * @return The number of allowed api calls per month for this client. - */ - @JsonProperty("apiCallsLimit") - public Optional getApiCallsLimit() { - return apiCallsLimit; - } - - /** - * @return The number of allowed api traffic bytes per month for this client. - */ - @JsonProperty("apiTrafficLimit") - public Optional getApiTrafficLimit() { - return apiTrafficLimit; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateClientDto && equalTo((UpdateClientDto) other); - } - - private boolean equalTo(UpdateClientDto other) { - return name.equals(other.name) - && role.equals(other.role) - && allowAnonymous.equals(other.allowAnonymous) - && apiCallsLimit.equals(other.apiCallsLimit) - && apiTrafficLimit.equals(other.apiTrafficLimit); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.role, this.allowAnonymous, this.apiCallsLimit, this.apiTrafficLimit); - } - - @Override - public String toString() { - return "UpdateClientDto{" + "name: " + name + ", role: " + role + ", allowAnonymous: " + allowAnonymous - + ", apiCallsLimit: " + apiCallsLimit + ", apiTrafficLimit: " + apiTrafficLimit + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Optional role = Optional.empty(); - - private Optional allowAnonymous = Optional.empty(); - - private Optional apiCallsLimit = Optional.empty(); - - private Optional apiTrafficLimit = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateClientDto other) { - name(other.getName()); - role(other.getRole()); - allowAnonymous(other.getAllowAnonymous()); - apiCallsLimit(other.getApiCallsLimit()); - apiTrafficLimit(other.getApiTrafficLimit()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public Builder role(Optional role) { - this.role = role; - return this; - } - - public Builder role(String role) { - this.role = Optional.of(role); - return this; - } - - @JsonSetter(value = "allowAnonymous", nulls = Nulls.SKIP) - public Builder allowAnonymous(Optional allowAnonymous) { - this.allowAnonymous = allowAnonymous; - return this; - } - - public Builder allowAnonymous(Boolean allowAnonymous) { - this.allowAnonymous = Optional.of(allowAnonymous); - return this; - } - - @JsonSetter(value = "apiCallsLimit", nulls = Nulls.SKIP) - public Builder apiCallsLimit(Optional apiCallsLimit) { - this.apiCallsLimit = apiCallsLimit; - return this; - } - - public Builder apiCallsLimit(Integer apiCallsLimit) { - this.apiCallsLimit = Optional.of(apiCallsLimit); - return this; - } - - @JsonSetter(value = "apiTrafficLimit", nulls = Nulls.SKIP) - public Builder apiTrafficLimit(Optional apiTrafficLimit) { - this.apiTrafficLimit = apiTrafficLimit; - return this; - } - - public Builder apiTrafficLimit(Integer apiTrafficLimit) { - this.apiTrafficLimit = Optional.of(apiTrafficLimit); - return this; - } - - public UpdateClientDto build() { - return new UpdateClientDto(name, role, allowAnonymous, apiCallsLimit, apiTrafficLimit); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java deleted file mode 100644 index 9592780..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateLanguageDto.Builder.class) -public final class UpdateLanguageDto { - private final Optional isMaster; - - private final Optional isOptional; - - private final Optional> fallback; - - private UpdateLanguageDto( - Optional isMaster, Optional isOptional, Optional> fallback) { - this.isMaster = isMaster; - this.isOptional = isOptional; - this.fallback = fallback; - } - - /** - * @return Set the value to true to make the language the master. - */ - @JsonProperty("isMaster") - public Optional getIsMaster() { - return isMaster; - } - - /** - * @return Set the value to true to make the language optional. - */ - @JsonProperty("isOptional") - public Optional getIsOptional() { - return isOptional; - } - - /** - * @return Optional fallback languages. - */ - @JsonProperty("fallback") - public Optional> getFallback() { - return fallback; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateLanguageDto && equalTo((UpdateLanguageDto) other); - } - - private boolean equalTo(UpdateLanguageDto other) { - return isMaster.equals(other.isMaster) - && isOptional.equals(other.isOptional) - && fallback.equals(other.fallback); - } - - @Override - public int hashCode() { - return Objects.hash(this.isMaster, this.isOptional, this.fallback); - } - - @Override - public String toString() { - return "UpdateLanguageDto{" + "isMaster: " + isMaster + ", isOptional: " + isOptional + ", fallback: " - + fallback + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional isMaster = Optional.empty(); - - private Optional isOptional = Optional.empty(); - - private Optional> fallback = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateLanguageDto other) { - isMaster(other.getIsMaster()); - isOptional(other.getIsOptional()); - fallback(other.getFallback()); - return this; - } - - @JsonSetter(value = "isMaster", nulls = Nulls.SKIP) - public Builder isMaster(Optional isMaster) { - this.isMaster = isMaster; - return this; - } - - public Builder isMaster(Boolean isMaster) { - this.isMaster = Optional.of(isMaster); - return this; - } - - @JsonSetter(value = "isOptional", nulls = Nulls.SKIP) - public Builder isOptional(Optional isOptional) { - this.isOptional = isOptional; - return this; - } - - public Builder isOptional(Boolean isOptional) { - this.isOptional = Optional.of(isOptional); - return this; - } - - @JsonSetter(value = "fallback", nulls = Nulls.SKIP) - public Builder fallback(Optional> fallback) { - this.fallback = fallback; - return this; - } - - public Builder fallback(List fallback) { - this.fallback = Optional.of(fallback); - return this; - } - - public UpdateLanguageDto build() { - return new UpdateLanguageDto(isMaster, isOptional, fallback); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java deleted file mode 100644 index a66b4da..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateRoleDto.Builder.class) -public final class UpdateRoleDto { - private final List permissions; - - private final Optional> properties; - - private UpdateRoleDto(List permissions, Optional> properties) { - this.permissions = permissions; - this.properties = properties; - } - - /** - * @return Associated list of permissions. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Associated list of UI properties. - */ - @JsonProperty("properties") - public Optional> getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateRoleDto && equalTo((UpdateRoleDto) other); - } - - private boolean equalTo(UpdateRoleDto other) { - return permissions.equals(other.permissions) && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.permissions, this.properties); - } - - @Override - public String toString() { - return "UpdateRoleDto{" + "permissions: " + permissions + ", properties: " + properties + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List permissions = new ArrayList<>(); - - private Optional> properties = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateRoleDto other) { - permissions(other.getPermissions()); - properties(other.getProperties()); - return this; - } - - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public Builder permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - public Builder addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - public Builder addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional> properties) { - this.properties = properties; - return this; - } - - public Builder properties(Map properties) { - this.properties = Optional.of(properties); - return this; - } - - public UpdateRoleDto build() { - return new UpdateRoleDto(permissions, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java deleted file mode 100644 index ee925c2..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.WorkflowStepDto; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateWorkflowDto.Builder.class) -public final class UpdateWorkflowDto { - private final Optional name; - - private final Map steps; - - private final Optional> schemaIds; - - private final String initial; - - private UpdateWorkflowDto( - Optional name, - Map steps, - Optional> schemaIds, - String initial) { - this.name = name; - this.steps = steps; - this.schemaIds = schemaIds; - this.initial = initial; - } - - /** - * @return The name of the workflow. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The workflow steps. - */ - @JsonProperty("steps") - public Map getSteps() { - return steps; - } - - /** - * @return The schema ids. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return The initial step. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("initial") - public String getInitial() { - return initial; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateWorkflowDto && equalTo((UpdateWorkflowDto) other); - } - - private boolean equalTo(UpdateWorkflowDto other) { - return name.equals(other.name) - && steps.equals(other.steps) - && schemaIds.equals(other.schemaIds) - && initial.equals(other.initial); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.steps, this.schemaIds, this.initial); - } - - @Override - public String toString() { - return "UpdateWorkflowDto{" + "name: " + name + ", steps: " + steps + ", schemaIds: " + schemaIds - + ", initial: " + initial + "}"; - } - - public static InitialStage builder() { - return new Builder(); - } - - public interface InitialStage { - _FinalStage initial(String initial); - - Builder from(UpdateWorkflowDto other); - } - - public interface _FinalStage { - UpdateWorkflowDto build(); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage steps(Map steps); - - _FinalStage putAllSteps(Map steps); - - _FinalStage steps(String key, WorkflowStepDto value); - - _FinalStage schemaIds(Optional> schemaIds); - - _FinalStage schemaIds(List schemaIds); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements InitialStage, _FinalStage { - private String initial; - - private Optional> schemaIds = Optional.empty(); - - private Map steps = new LinkedHashMap<>(); - - private Optional name = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpdateWorkflowDto other) { - name(other.getName()); - steps(other.getSteps()); - schemaIds(other.getSchemaIds()); - initial(other.getInitial()); - return this; - } - - /** - *

The initial step. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("initial") - public _FinalStage initial(String initial) { - this.initial = initial; - return this; - } - - /** - *

The schema ids.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @Override - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public _FinalStage schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage steps(String key, WorkflowStepDto value) { - this.steps.put(key, value); - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllSteps(Map steps) { - this.steps.putAll(steps); - return this; - } - - @Override - @JsonSetter(value = "steps", nulls = Nulls.SKIP) - public _FinalStage steps(Map steps) { - this.steps.clear(); - this.steps.putAll(steps); - return this; - } - - /** - *

The name of the workflow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @Override - public UpdateWorkflowDto build() { - return new UpdateWorkflowDto(name, steps, schemaIds, initial); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/AssetsClient.java b/src/main/java/com/squidex/api/resources/assets/AssetsClient.java deleted file mode 100644 index 3ee960e..0000000 --- a/src/main/java/com/squidex/api/resources/assets/AssetsClient.java +++ /dev/null @@ -1,914 +0,0 @@ -package com.squidex.api.resources.assets; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.assets.requests.AnnotateAssetDto; -import com.squidex.api.resources.assets.requests.AssetsDeleteAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetContentBySlugRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetContentRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetFoldersRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetsPostRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetsRequest; -import com.squidex.api.resources.assets.requests.AssetsPostAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsPostUpsertAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsPutAssetContentRequest; -import com.squidex.api.resources.assets.requests.BulkUpdateAssetsDto; -import com.squidex.api.resources.assets.requests.CreateAssetFolderDto; -import com.squidex.api.resources.assets.requests.MoveAssetDto; -import com.squidex.api.resources.assets.requests.MoveAssetFolderDto; -import com.squidex.api.resources.assets.requests.RenameAssetFolderDto; -import com.squidex.api.resources.assets.requests.RenameTagDto; -import com.squidex.api.types.AssetDto; -import com.squidex.api.types.AssetFolderDto; -import com.squidex.api.types.AssetFoldersDto; -import com.squidex.api.types.AssetsDto; -import com.squidex.api.types.BulkResultDto; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.MultipartBody; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class AssetsClient { - protected final ClientOptions clientOptions; - - public AssetsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public InputStream getAssetContentBySlug( - String idOrSlug, Optional more, AssetsGetAssetContentBySlugRequest request) { - return getAssetContentBySlug(idOrSlug, more, request, null); - } - - public InputStream getAssetContentBySlug( - String idOrSlug, - Optional more, - AssetsGetAssetContentBySlugRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/assets") - .addPathSegment(clientOptions.appName()) - .addPathSegment(idOrSlug); - if (more.isPresent()) { - _httpUrl.addPathSegment(more.get()); - } - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - if (request.getCache().isPresent()) { - _httpUrl.addQueryParameter("cache", request.getCache().get().toString()); - } - if (request.getDownload().isPresent()) { - _httpUrl.addQueryParameter("download", request.getDownload().get().toString()); - } - if (request.getWidth().isPresent()) { - _httpUrl.addQueryParameter("width", request.getWidth().get().toString()); - } - if (request.getHeight().isPresent()) { - _httpUrl.addQueryParameter("height", request.getHeight().get().toString()); - } - if (request.getQuality().isPresent()) { - _httpUrl.addQueryParameter("quality", request.getQuality().get().toString()); - } - if (request.getMode().isPresent()) { - _httpUrl.addQueryParameter("mode", request.getMode().get().toString()); - } - if (request.getBg().isPresent()) { - _httpUrl.addQueryParameter("bg", request.getBg().get()); - } - if (request.getFocusX().isPresent()) { - _httpUrl.addQueryParameter("focusX", request.getFocusX().get().toString()); - } - if (request.getFocusY().isPresent()) { - _httpUrl.addQueryParameter("focusY", request.getFocusY().get().toString()); - } - if (request.getNofocus().isPresent()) { - _httpUrl.addQueryParameter("nofocus", request.getNofocus().get().toString()); - } - if (request.getAuto().isPresent()) { - _httpUrl.addQueryParameter("auto", request.getAuto().get().toString()); - } - if (request.getForce().isPresent()) { - _httpUrl.addQueryParameter("force", request.getForce().get().toString()); - } - if (request.getFormat().isPresent()) { - _httpUrl.addQueryParameter("format", request.getFormat().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request) { - return getAssetContent(id, request, null); - } - - public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/assets") - .addPathSegment(id); - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - if (request.getCache().isPresent()) { - _httpUrl.addQueryParameter("cache", request.getCache().get().toString()); - } - if (request.getDownload().isPresent()) { - _httpUrl.addQueryParameter("download", request.getDownload().get().toString()); - } - if (request.getWidth().isPresent()) { - _httpUrl.addQueryParameter("width", request.getWidth().get().toString()); - } - if (request.getHeight().isPresent()) { - _httpUrl.addQueryParameter("height", request.getHeight().get().toString()); - } - if (request.getQuality().isPresent()) { - _httpUrl.addQueryParameter("quality", request.getQuality().get().toString()); - } - if (request.getMode().isPresent()) { - _httpUrl.addQueryParameter("mode", request.getMode().get().toString()); - } - if (request.getBg().isPresent()) { - _httpUrl.addQueryParameter("bg", request.getBg().get()); - } - if (request.getFocusX().isPresent()) { - _httpUrl.addQueryParameter("focusX", request.getFocusX().get().toString()); - } - if (request.getFocusY().isPresent()) { - _httpUrl.addQueryParameter("focusY", request.getFocusY().get().toString()); - } - if (request.getNofocus().isPresent()) { - _httpUrl.addQueryParameter("nofocus", request.getNofocus().get().toString()); - } - if (request.getAuto().isPresent()) { - _httpUrl.addQueryParameter("auto", request.getAuto().get().toString()); - } - if (request.getForce().isPresent()) { - _httpUrl.addQueryParameter("force", request.getForce().get().toString()); - } - if (request.getFormat().isPresent()) { - _httpUrl.addQueryParameter("format", request.getFormat().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request) { - return getAssetFolders(request, null); - } - - public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders"); - if (request.getParentId().isPresent()) { - _httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getScope().isPresent()) { - _httpUrl.addQueryParameter("scope", request.getScope().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFoldersDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto postAssetFolder(CreateAssetFolderDto request) { - return postAssetFolder(request, null); - } - - public AssetFolderDto postAssetFolder(CreateAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("folderName", request.getFolderName()); - if (request.getParentId().isPresent()) { - _requestBodyProperties.put("parentId", request.getParentId()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto putAssetFolder(String id, RenameAssetFolderDto request) { - return putAssetFolder(id, request, null); - } - - public AssetFolderDto putAssetFolder(String id, RenameAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("folderName", request.getFolderName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteAssetFolder(String id) { - deleteAssetFolder(id, null); - } - - public void deleteAssetFolder(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request) { - return putAssetFolderParent(id, request, null); - } - - public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .addPathSegments("parent") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getParentId().isPresent()) { - _requestBodyProperties.put("parentId", request.getParentId()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getTags() { - return getTags(null); - } - - public Map getTags(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/tags") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map putTag(String name, RenameTagDto request) { - return putTag(name, request, null); - } - - public Map putTag(String name, RenameTagDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/tags") - .addPathSegment(name) - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("tagName", request.getTagName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetsDto getAssets(AssetsGetAssetsRequest request) { - return getAssets(request, null); - } - - public AssetsDto getAssets(AssetsGetAssetsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets"); - if (request.getParentId().isPresent()) { - _httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getIds().isPresent()) { - _httpUrl.addQueryParameter("ids", request.getIds().get()); - } - if (request.getQ().isPresent()) { - _httpUrl.addQueryParameter("q", request.getQ().get()); - } - if (request.getTop().isPresent()) { - _httpUrl.addQueryParameter("$top", request.getTop().get().toString()); - } - if (request.getSkip().isPresent()) { - _httpUrl.addQueryParameter("$skip", request.getSkip().get().toString()); - } - if (request.getOrderby().isPresent()) { - _httpUrl.addQueryParameter("$orderby", request.getOrderby().get()); - } - if (request.getFilter().isPresent()) { - _httpUrl.addQueryParameter("$filter", request.getFilter().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto postAsset(File file, AssetsPostAssetRequest request) { - return postAsset(file, request, null); - } - - public AssetDto postAsset(File file, AssetsPostAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets"); - if (request.getParentId().isPresent()) { - _httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getId().isPresent()) { - _httpUrl.addQueryParameter("id", request.getId().get()); - } - if (request.getDuplicate().isPresent()) { - _httpUrl.addQueryParameter("duplicate", request.getDuplicate().get().toString()); - } - MultipartBody.Builder _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); - _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); - RequestBody _requestBody = _multipartBody.build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request) { - return getAssetsPost(request, null); - } - - public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/query") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto getAsset(String id) { - return getAsset(id, null); - } - - public AssetDto getAsset(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto postUpsertAsset(String id, File file, AssetsPostUpsertAssetRequest request) { - return postUpsertAsset(id, file, request, null); - } - - public AssetDto postUpsertAsset( - String id, File file, AssetsPostUpsertAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id); - if (request.getParentId().isPresent()) { - _httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getDuplicate().isPresent()) { - _httpUrl.addQueryParameter("duplicate", request.getDuplicate().get().toString()); - } - MultipartBody.Builder _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); - _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); - RequestBody _requestBody = _multipartBody.build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto putAsset(String id, AnnotateAssetDto request) { - return putAsset(id, request, null); - } - - public AssetDto putAsset(String id, AnnotateAssetDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getFileName().isPresent()) { - _requestBodyProperties.put("fileName", request.getFileName()); - } - if (request.getSlug().isPresent()) { - _requestBodyProperties.put("slug", request.getSlug()); - } - if (request.getIsProtected().isPresent()) { - _requestBodyProperties.put("isProtected", request.getIsProtected()); - } - if (request.getTags().isPresent()) { - _requestBodyProperties.put("tags", request.getTags()); - } - if (request.getMetadata().isPresent()) { - _requestBodyProperties.put("metadata", request.getMetadata()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteAsset(String id, AssetsDeleteAssetRequest request) { - deleteAsset(id, request, null); - } - - public void deleteAsset(String id, AssetsDeleteAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id); - if (request.getCheckReferrers().isPresent()) { - _httpUrl.addQueryParameter( - "checkReferrers", request.getCheckReferrers().get().toString()); - } - if (request.getPermanent().isPresent()) { - _httpUrl.addQueryParameter("permanent", request.getPermanent().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("DELETE", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List bulkUpdateAssets(BulkUpdateAssetsDto request) { - return bulkUpdateAssets(request, null); - } - - public List bulkUpdateAssets(BulkUpdateAssetsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/bulk") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getJobs().isPresent()) { - _requestBodyProperties.put("jobs", request.getJobs()); - } - if (request.getCheckReferrers().isPresent()) { - _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); - } - if (request.getOptimizeValidation().isPresent()) { - _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); - } - if (request.getDoNotScript().isPresent()) { - _requestBodyProperties.put("doNotScript", request.getDoNotScript()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto putAssetContent(String id, File file, AssetsPutAssetContentRequest request) { - return putAssetContent(id, file, request, null); - } - - public AssetDto putAssetContent( - String id, File file, AssetsPutAssetContentRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .addPathSegments("content") - .build(); - MultipartBody.Builder _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); - _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); - RequestBody _requestBody = _multipartBody.build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto putAssetParent(String id, MoveAssetDto request) { - return putAssetParent(id, request, null); - } - - public AssetDto putAssetParent(String id, MoveAssetDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .addPathSegments("parent") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getParentId().isPresent()) { - _requestBodyProperties.put("parentId", request.getParentId()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java b/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java deleted file mode 100644 index 665c5ea..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AnnotateAssetDto.Builder.class) -public final class AnnotateAssetDto { - private final Optional fileName; - - private final Optional slug; - - private final Optional isProtected; - - private final Optional> tags; - - private final Optional> metadata; - - private AnnotateAssetDto( - Optional fileName, - Optional slug, - Optional isProtected, - Optional> tags, - Optional> metadata) { - this.fileName = fileName; - this.slug = slug; - this.isProtected = isProtected; - this.tags = tags; - this.metadata = metadata; - } - - /** - * @return The new name of the asset. - */ - @JsonProperty("fileName") - public Optional getFileName() { - return fileName; - } - - /** - * @return The new slug of the asset. - */ - @JsonProperty("slug") - public Optional getSlug() { - return slug; - } - - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public Optional getIsProtected() { - return isProtected; - } - - /** - * @return The new asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Optional> getMetadata() { - return metadata; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AnnotateAssetDto && equalTo((AnnotateAssetDto) other); - } - - private boolean equalTo(AnnotateAssetDto other) { - return fileName.equals(other.fileName) - && slug.equals(other.slug) - && isProtected.equals(other.isProtected) - && tags.equals(other.tags) - && metadata.equals(other.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(this.fileName, this.slug, this.isProtected, this.tags, this.metadata); - } - - @Override - public String toString() { - return "AnnotateAssetDto{" + "fileName: " + fileName + ", slug: " + slug + ", isProtected: " + isProtected - + ", tags: " + tags + ", metadata: " + metadata + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fileName = Optional.empty(); - - private Optional slug = Optional.empty(); - - private Optional isProtected = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> metadata = Optional.empty(); - - private Builder() {} - - public Builder from(AnnotateAssetDto other) { - fileName(other.getFileName()); - slug(other.getSlug()); - isProtected(other.getIsProtected()); - tags(other.getTags()); - metadata(other.getMetadata()); - return this; - } - - @JsonSetter(value = "fileName", nulls = Nulls.SKIP) - public Builder fileName(Optional fileName) { - this.fileName = fileName; - return this; - } - - public Builder fileName(String fileName) { - this.fileName = Optional.of(fileName); - return this; - } - - @JsonSetter(value = "slug", nulls = Nulls.SKIP) - public Builder slug(Optional slug) { - this.slug = slug; - return this; - } - - public Builder slug(String slug) { - this.slug = Optional.of(slug); - return this; - } - - @JsonSetter(value = "isProtected", nulls = Nulls.SKIP) - public Builder isProtected(Optional isProtected) { - this.isProtected = isProtected; - return this; - } - - public Builder isProtected(Boolean isProtected) { - this.isProtected = Optional.of(isProtected); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional> metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Map metadata) { - this.metadata = Optional.of(metadata); - return this; - } - - public AnnotateAssetDto build() { - return new AnnotateAssetDto(fileName, slug, isProtected, tags, metadata); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java deleted file mode 100644 index 0825689..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsDeleteAssetRequest.Builder.class) -public final class AssetsDeleteAssetRequest { - private final Optional checkReferrers; - - private final Optional permanent; - - private AssetsDeleteAssetRequest(Optional checkReferrers, Optional permanent) { - this.checkReferrers = checkReferrers; - this.permanent = permanent; - } - - /** - * @return True to check referrers of this asset. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to delete the asset permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsDeleteAssetRequest && equalTo((AssetsDeleteAssetRequest) other); - } - - private boolean equalTo(AssetsDeleteAssetRequest other) { - return checkReferrers.equals(other.checkReferrers) && permanent.equals(other.permanent); - } - - @Override - public int hashCode() { - return Objects.hash(this.checkReferrers, this.permanent); - } - - @Override - public String toString() { - return "AssetsDeleteAssetRequest{" + "checkReferrers: " + checkReferrers + ", permanent: " + permanent + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional checkReferrers = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsDeleteAssetRequest other) { - checkReferrers(other.getCheckReferrers()); - permanent(other.getPermanent()); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - public AssetsDeleteAssetRequest build() { - return new AssetsDeleteAssetRequest(checkReferrers, permanent); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java deleted file mode 100644 index b52de26..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java +++ /dev/null @@ -1,453 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.ImageFormat; -import com.squidex.api.types.ResizeMode; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetContentBySlugRequest.Builder.class) -public final class AssetsGetAssetContentBySlugRequest { - private final Optional version; - - private final Optional cache; - - private final Optional download; - - private final Optional width; - - private final Optional height; - - private final Optional quality; - - private final Optional mode; - - private final Optional bg; - - private final Optional focusX; - - private final Optional focusY; - - private final Optional nofocus; - - private final Optional auto; - - private final Optional force; - - private final Optional format; - - private AssetsGetAssetContentBySlugRequest( - Optional version, - Optional cache, - Optional download, - Optional width, - Optional height, - Optional quality, - Optional mode, - Optional bg, - Optional focusX, - Optional focusY, - Optional nofocus, - Optional auto, - Optional force, - Optional format) { - this.version = version; - this.cache = cache; - this.download = download; - this.width = width; - this.height = height; - this.quality = quality; - this.mode = mode; - this.bg = bg; - this.focusX = focusX; - this.focusY = focusY; - this.nofocus = nofocus; - this.auto = auto; - this.force = force; - this.format = format; - } - - /** - * @return The optional version of the asset. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return The cache duration in seconds. - */ - @JsonProperty("cache") - public Optional getCache() { - return cache; - } - - /** - * @return Set it to 0 to prevent download. - */ - @JsonProperty("download") - public Optional getDownload() { - return download; - } - - /** - * @return The target width of the asset, if it is an image. - */ - @JsonProperty("width") - public Optional getWidth() { - return width; - } - - /** - * @return The target height of the asset, if it is an image. - */ - @JsonProperty("height") - public Optional getHeight() { - return height; - } - - /** - * @return Optional image quality, it is is an jpeg image. - */ - @JsonProperty("quality") - public Optional getQuality() { - return quality; - } - - /** - * @return The resize mode when the width and height is defined. - */ - @JsonProperty("mode") - public Optional getMode() { - return mode; - } - - /** - * @return Optional background color. - */ - @JsonProperty("bg") - public Optional getBg() { - return bg; - } - - /** - * @return Override the y focus point. - */ - @JsonProperty("focusX") - public Optional getFocusX() { - return focusX; - } - - /** - * @return Override the x focus point. - */ - @JsonProperty("focusY") - public Optional getFocusY() { - return focusY; - } - - /** - * @return True to ignore the asset focus point if any. - */ - @JsonProperty("nofocus") - public Optional getNofocus() { - return nofocus; - } - - /** - * @return True to use auto format. - */ - @JsonProperty("auto") - public Optional getAuto() { - return auto; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("force") - public Optional getForce() { - return force; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetContentBySlugRequest - && equalTo((AssetsGetAssetContentBySlugRequest) other); - } - - private boolean equalTo(AssetsGetAssetContentBySlugRequest other) { - return version.equals(other.version) - && cache.equals(other.cache) - && download.equals(other.download) - && width.equals(other.width) - && height.equals(other.height) - && quality.equals(other.quality) - && mode.equals(other.mode) - && bg.equals(other.bg) - && focusX.equals(other.focusX) - && focusY.equals(other.focusY) - && nofocus.equals(other.nofocus) - && auto.equals(other.auto) - && force.equals(other.force) - && format.equals(other.format); - } - - @Override - public int hashCode() { - return Objects.hash( - this.version, - this.cache, - this.download, - this.width, - this.height, - this.quality, - this.mode, - this.bg, - this.focusX, - this.focusY, - this.nofocus, - this.auto, - this.force, - this.format); - } - - @Override - public String toString() { - return "AssetsGetAssetContentBySlugRequest{" + "version: " + version + ", cache: " + cache + ", download: " - + download + ", width: " + width + ", height: " + height + ", quality: " + quality + ", mode: " + mode - + ", bg: " + bg + ", focusX: " + focusX + ", focusY: " + focusY + ", nofocus: " + nofocus + ", auto: " - + auto + ", force: " + force + ", format: " + format + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Optional cache = Optional.empty(); - - private Optional download = Optional.empty(); - - private Optional width = Optional.empty(); - - private Optional height = Optional.empty(); - - private Optional quality = Optional.empty(); - - private Optional mode = Optional.empty(); - - private Optional bg = Optional.empty(); - - private Optional focusX = Optional.empty(); - - private Optional focusY = Optional.empty(); - - private Optional nofocus = Optional.empty(); - - private Optional auto = Optional.empty(); - - private Optional force = Optional.empty(); - - private Optional format = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetContentBySlugRequest other) { - version(other.getVersion()); - cache(other.getCache()); - download(other.getDownload()); - width(other.getWidth()); - height(other.getHeight()); - quality(other.getQuality()); - mode(other.getMode()); - bg(other.getBg()); - focusX(other.getFocusX()); - focusY(other.getFocusY()); - nofocus(other.getNofocus()); - auto(other.getAuto()); - force(other.getForce()); - format(other.getFormat()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - @JsonSetter(value = "cache", nulls = Nulls.SKIP) - public Builder cache(Optional cache) { - this.cache = cache; - return this; - } - - public Builder cache(Integer cache) { - this.cache = Optional.of(cache); - return this; - } - - @JsonSetter(value = "download", nulls = Nulls.SKIP) - public Builder download(Optional download) { - this.download = download; - return this; - } - - public Builder download(Integer download) { - this.download = Optional.of(download); - return this; - } - - @JsonSetter(value = "width", nulls = Nulls.SKIP) - public Builder width(Optional width) { - this.width = width; - return this; - } - - public Builder width(Integer width) { - this.width = Optional.of(width); - return this; - } - - @JsonSetter(value = "height", nulls = Nulls.SKIP) - public Builder height(Optional height) { - this.height = height; - return this; - } - - public Builder height(Integer height) { - this.height = Optional.of(height); - return this; - } - - @JsonSetter(value = "quality", nulls = Nulls.SKIP) - public Builder quality(Optional quality) { - this.quality = quality; - return this; - } - - public Builder quality(Integer quality) { - this.quality = Optional.of(quality); - return this; - } - - @JsonSetter(value = "mode", nulls = Nulls.SKIP) - public Builder mode(Optional mode) { - this.mode = mode; - return this; - } - - public Builder mode(ResizeMode mode) { - this.mode = Optional.of(mode); - return this; - } - - @JsonSetter(value = "bg", nulls = Nulls.SKIP) - public Builder bg(Optional bg) { - this.bg = bg; - return this; - } - - public Builder bg(String bg) { - this.bg = Optional.of(bg); - return this; - } - - @JsonSetter(value = "focusX", nulls = Nulls.SKIP) - public Builder focusX(Optional focusX) { - this.focusX = focusX; - return this; - } - - public Builder focusX(Double focusX) { - this.focusX = Optional.of(focusX); - return this; - } - - @JsonSetter(value = "focusY", nulls = Nulls.SKIP) - public Builder focusY(Optional focusY) { - this.focusY = focusY; - return this; - } - - public Builder focusY(Double focusY) { - this.focusY = Optional.of(focusY); - return this; - } - - @JsonSetter(value = "nofocus", nulls = Nulls.SKIP) - public Builder nofocus(Optional nofocus) { - this.nofocus = nofocus; - return this; - } - - public Builder nofocus(Boolean nofocus) { - this.nofocus = Optional.of(nofocus); - return this; - } - - @JsonSetter(value = "auto", nulls = Nulls.SKIP) - public Builder auto(Optional auto) { - this.auto = auto; - return this; - } - - public Builder auto(Boolean auto) { - this.auto = Optional.of(auto); - return this; - } - - @JsonSetter(value = "force", nulls = Nulls.SKIP) - public Builder force(Optional force) { - this.force = force; - return this; - } - - public Builder force(Boolean force) { - this.force = Optional.of(force); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(ImageFormat format) { - this.format = Optional.of(format); - return this; - } - - public AssetsGetAssetContentBySlugRequest build() { - return new AssetsGetAssetContentBySlugRequest( - version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, - format); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java deleted file mode 100644 index c77b5e8..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java +++ /dev/null @@ -1,452 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.ImageFormat; -import com.squidex.api.types.ResizeMode; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetContentRequest.Builder.class) -public final class AssetsGetAssetContentRequest { - private final Optional version; - - private final Optional cache; - - private final Optional download; - - private final Optional width; - - private final Optional height; - - private final Optional quality; - - private final Optional mode; - - private final Optional bg; - - private final Optional focusX; - - private final Optional focusY; - - private final Optional nofocus; - - private final Optional auto; - - private final Optional force; - - private final Optional format; - - private AssetsGetAssetContentRequest( - Optional version, - Optional cache, - Optional download, - Optional width, - Optional height, - Optional quality, - Optional mode, - Optional bg, - Optional focusX, - Optional focusY, - Optional nofocus, - Optional auto, - Optional force, - Optional format) { - this.version = version; - this.cache = cache; - this.download = download; - this.width = width; - this.height = height; - this.quality = quality; - this.mode = mode; - this.bg = bg; - this.focusX = focusX; - this.focusY = focusY; - this.nofocus = nofocus; - this.auto = auto; - this.force = force; - this.format = format; - } - - /** - * @return The optional version of the asset. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return The cache duration in seconds. - */ - @JsonProperty("cache") - public Optional getCache() { - return cache; - } - - /** - * @return Set it to 0 to prevent download. - */ - @JsonProperty("download") - public Optional getDownload() { - return download; - } - - /** - * @return The target width of the asset, if it is an image. - */ - @JsonProperty("width") - public Optional getWidth() { - return width; - } - - /** - * @return The target height of the asset, if it is an image. - */ - @JsonProperty("height") - public Optional getHeight() { - return height; - } - - /** - * @return Optional image quality, it is is an jpeg image. - */ - @JsonProperty("quality") - public Optional getQuality() { - return quality; - } - - /** - * @return The resize mode when the width and height is defined. - */ - @JsonProperty("mode") - public Optional getMode() { - return mode; - } - - /** - * @return Optional background color. - */ - @JsonProperty("bg") - public Optional getBg() { - return bg; - } - - /** - * @return Override the y focus point. - */ - @JsonProperty("focusX") - public Optional getFocusX() { - return focusX; - } - - /** - * @return Override the x focus point. - */ - @JsonProperty("focusY") - public Optional getFocusY() { - return focusY; - } - - /** - * @return True to ignore the asset focus point if any. - */ - @JsonProperty("nofocus") - public Optional getNofocus() { - return nofocus; - } - - /** - * @return True to use auto format. - */ - @JsonProperty("auto") - public Optional getAuto() { - return auto; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("force") - public Optional getForce() { - return force; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetContentRequest && equalTo((AssetsGetAssetContentRequest) other); - } - - private boolean equalTo(AssetsGetAssetContentRequest other) { - return version.equals(other.version) - && cache.equals(other.cache) - && download.equals(other.download) - && width.equals(other.width) - && height.equals(other.height) - && quality.equals(other.quality) - && mode.equals(other.mode) - && bg.equals(other.bg) - && focusX.equals(other.focusX) - && focusY.equals(other.focusY) - && nofocus.equals(other.nofocus) - && auto.equals(other.auto) - && force.equals(other.force) - && format.equals(other.format); - } - - @Override - public int hashCode() { - return Objects.hash( - this.version, - this.cache, - this.download, - this.width, - this.height, - this.quality, - this.mode, - this.bg, - this.focusX, - this.focusY, - this.nofocus, - this.auto, - this.force, - this.format); - } - - @Override - public String toString() { - return "AssetsGetAssetContentRequest{" + "version: " + version + ", cache: " + cache + ", download: " + download - + ", width: " + width + ", height: " + height + ", quality: " + quality + ", mode: " + mode + ", bg: " - + bg + ", focusX: " + focusX + ", focusY: " + focusY + ", nofocus: " + nofocus + ", auto: " + auto - + ", force: " + force + ", format: " + format + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Optional cache = Optional.empty(); - - private Optional download = Optional.empty(); - - private Optional width = Optional.empty(); - - private Optional height = Optional.empty(); - - private Optional quality = Optional.empty(); - - private Optional mode = Optional.empty(); - - private Optional bg = Optional.empty(); - - private Optional focusX = Optional.empty(); - - private Optional focusY = Optional.empty(); - - private Optional nofocus = Optional.empty(); - - private Optional auto = Optional.empty(); - - private Optional force = Optional.empty(); - - private Optional format = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetContentRequest other) { - version(other.getVersion()); - cache(other.getCache()); - download(other.getDownload()); - width(other.getWidth()); - height(other.getHeight()); - quality(other.getQuality()); - mode(other.getMode()); - bg(other.getBg()); - focusX(other.getFocusX()); - focusY(other.getFocusY()); - nofocus(other.getNofocus()); - auto(other.getAuto()); - force(other.getForce()); - format(other.getFormat()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - @JsonSetter(value = "cache", nulls = Nulls.SKIP) - public Builder cache(Optional cache) { - this.cache = cache; - return this; - } - - public Builder cache(Integer cache) { - this.cache = Optional.of(cache); - return this; - } - - @JsonSetter(value = "download", nulls = Nulls.SKIP) - public Builder download(Optional download) { - this.download = download; - return this; - } - - public Builder download(Integer download) { - this.download = Optional.of(download); - return this; - } - - @JsonSetter(value = "width", nulls = Nulls.SKIP) - public Builder width(Optional width) { - this.width = width; - return this; - } - - public Builder width(Integer width) { - this.width = Optional.of(width); - return this; - } - - @JsonSetter(value = "height", nulls = Nulls.SKIP) - public Builder height(Optional height) { - this.height = height; - return this; - } - - public Builder height(Integer height) { - this.height = Optional.of(height); - return this; - } - - @JsonSetter(value = "quality", nulls = Nulls.SKIP) - public Builder quality(Optional quality) { - this.quality = quality; - return this; - } - - public Builder quality(Integer quality) { - this.quality = Optional.of(quality); - return this; - } - - @JsonSetter(value = "mode", nulls = Nulls.SKIP) - public Builder mode(Optional mode) { - this.mode = mode; - return this; - } - - public Builder mode(ResizeMode mode) { - this.mode = Optional.of(mode); - return this; - } - - @JsonSetter(value = "bg", nulls = Nulls.SKIP) - public Builder bg(Optional bg) { - this.bg = bg; - return this; - } - - public Builder bg(String bg) { - this.bg = Optional.of(bg); - return this; - } - - @JsonSetter(value = "focusX", nulls = Nulls.SKIP) - public Builder focusX(Optional focusX) { - this.focusX = focusX; - return this; - } - - public Builder focusX(Double focusX) { - this.focusX = Optional.of(focusX); - return this; - } - - @JsonSetter(value = "focusY", nulls = Nulls.SKIP) - public Builder focusY(Optional focusY) { - this.focusY = focusY; - return this; - } - - public Builder focusY(Double focusY) { - this.focusY = Optional.of(focusY); - return this; - } - - @JsonSetter(value = "nofocus", nulls = Nulls.SKIP) - public Builder nofocus(Optional nofocus) { - this.nofocus = nofocus; - return this; - } - - public Builder nofocus(Boolean nofocus) { - this.nofocus = Optional.of(nofocus); - return this; - } - - @JsonSetter(value = "auto", nulls = Nulls.SKIP) - public Builder auto(Optional auto) { - this.auto = auto; - return this; - } - - public Builder auto(Boolean auto) { - this.auto = Optional.of(auto); - return this; - } - - @JsonSetter(value = "force", nulls = Nulls.SKIP) - public Builder force(Optional force) { - this.force = force; - return this; - } - - public Builder force(Boolean force) { - this.force = Optional.of(force); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(ImageFormat format) { - this.format = Optional.of(format); - return this; - } - - public AssetsGetAssetContentRequest build() { - return new AssetsGetAssetContentRequest( - version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, - format); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java deleted file mode 100644 index 1d943f9..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.AssetFolderScope; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetFoldersRequest.Builder.class) -public final class AssetsGetAssetFoldersRequest { - private final Optional parentId; - - private final Optional scope; - - private AssetsGetAssetFoldersRequest(Optional parentId, Optional scope) { - this.parentId = parentId; - this.scope = scope; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The scope of the query. - */ - @JsonProperty("scope") - public Optional getScope() { - return scope; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetFoldersRequest && equalTo((AssetsGetAssetFoldersRequest) other); - } - - private boolean equalTo(AssetsGetAssetFoldersRequest other) { - return parentId.equals(other.parentId) && scope.equals(other.scope); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.scope); - } - - @Override - public String toString() { - return "AssetsGetAssetFoldersRequest{" + "parentId: " + parentId + ", scope: " + scope + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional scope = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetFoldersRequest other) { - parentId(other.getParentId()); - scope(other.getScope()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "scope", nulls = Nulls.SKIP) - public Builder scope(Optional scope) { - this.scope = scope; - return this; - } - - public Builder scope(AssetFolderScope scope) { - this.scope = Optional.of(scope); - return this; - } - - public AssetsGetAssetFoldersRequest build() { - return new AssetsGetAssetFoldersRequest(parentId, scope); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java deleted file mode 100644 index 6774d37..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.QueryDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetsPostRequest.Builder.class) -public final class AssetsGetAssetsPostRequest { - private final Optional noTotal; - - private final Optional noSlowTotal; - - private final QueryDto body; - - private AssetsGetAssetsPostRequest(Optional noTotal, Optional noSlowTotal, QueryDto body) { - this.noTotal = noTotal; - this.noSlowTotal = noSlowTotal; - this.body = body; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - @JsonProperty("body") - public QueryDto getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetsPostRequest && equalTo((AssetsGetAssetsPostRequest) other); - } - - private boolean equalTo(AssetsGetAssetsPostRequest other) { - return noTotal.equals(other.noTotal) && noSlowTotal.equals(other.noSlowTotal) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.noTotal, this.noSlowTotal, this.body); - } - - @Override - public String toString() { - return "AssetsGetAssetsPostRequest{" + "noTotal: " + noTotal + ", noSlowTotal: " + noSlowTotal + ", body: " - + body + "}"; - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(QueryDto body); - - Builder from(AssetsGetAssetsPostRequest other); - } - - public interface _FinalStage { - AssetsGetAssetsPostRequest build(); - - _FinalStage noTotal(Optional noTotal); - - _FinalStage noTotal(Boolean noTotal); - - _FinalStage noSlowTotal(Optional noSlowTotal); - - _FinalStage noSlowTotal(Boolean noSlowTotal); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private QueryDto body; - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AssetsGetAssetsPostRequest other) { - noTotal(other.getNoTotal()); - noSlowTotal(other.getNoSlowTotal()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(QueryDto body) { - this.body = body; - return this; - } - - /** - *

Do not return the total amount, if it would be slow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public _FinalStage noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - /** - *

Do not return the total amount.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public _FinalStage noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - @Override - public AssetsGetAssetsPostRequest build() { - return new AssetsGetAssetsPostRequest(noTotal, noSlowTotal, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java deleted file mode 100644 index d690730..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java +++ /dev/null @@ -1,307 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetsRequest.Builder.class) -public final class AssetsGetAssetsRequest { - private final Optional noTotal; - - private final Optional noSlowTotal; - - private final Optional parentId; - - private final Optional ids; - - private final Optional q; - - private final Optional top; - - private final Optional skip; - - private final Optional orderby; - - private final Optional filter; - - private AssetsGetAssetsRequest( - Optional noTotal, - Optional noSlowTotal, - Optional parentId, - Optional ids, - Optional q, - Optional top, - Optional skip, - Optional orderby, - Optional filter) { - this.noTotal = noTotal; - this.noSlowTotal = noSlowTotal; - this.parentId = parentId; - this.ids = ids; - this.q = q; - this.top = top; - this.skip = skip; - this.orderby = orderby; - this.filter = filter; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The optional asset ids. - */ - @JsonProperty("ids") - public Optional getIds() { - return ids; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Optional number of items to take. - */ - @JsonProperty("$top") - public Optional getTop() { - return top; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$skip") - public Optional getSkip() { - return skip; - } - - /** - * @return Optional OData order definition. - */ - @JsonProperty("$orderby") - public Optional getOrderby() { - return orderby; - } - - /** - * @return Optional OData filter. - */ - @JsonProperty("$filter") - public Optional getFilter() { - return filter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetsRequest && equalTo((AssetsGetAssetsRequest) other); - } - - private boolean equalTo(AssetsGetAssetsRequest other) { - return noTotal.equals(other.noTotal) - && noSlowTotal.equals(other.noSlowTotal) - && parentId.equals(other.parentId) - && ids.equals(other.ids) - && q.equals(other.q) - && top.equals(other.top) - && skip.equals(other.skip) - && orderby.equals(other.orderby) - && filter.equals(other.filter); - } - - @Override - public int hashCode() { - return Objects.hash( - this.noTotal, - this.noSlowTotal, - this.parentId, - this.ids, - this.q, - this.top, - this.skip, - this.orderby, - this.filter); - } - - @Override - public String toString() { - return "AssetsGetAssetsRequest{" + "noTotal: " + noTotal + ", noSlowTotal: " + noSlowTotal + ", parentId: " - + parentId + ", ids: " + ids + ", q: " + q + ", top: " + top + ", skip: " + skip + ", orderby: " - + orderby + ", filter: " + filter + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional noTotal = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional parentId = Optional.empty(); - - private Optional ids = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional top = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional orderby = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetsRequest other) { - noTotal(other.getNoTotal()); - noSlowTotal(other.getNoSlowTotal()); - parentId(other.getParentId()); - ids(other.getIds()); - q(other.getQ()); - top(other.getTop()); - skip(other.getSkip()); - orderby(other.getOrderby()); - filter(other.getFilter()); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional ids) { - this.ids = ids; - return this; - } - - public Builder ids(String ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - @JsonSetter(value = "$top", nulls = Nulls.SKIP) - public Builder top(Optional top) { - this.top = top; - return this; - } - - public Builder top(Double top) { - this.top = Optional.of(top); - return this; - } - - @JsonSetter(value = "$skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Double skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "$orderby", nulls = Nulls.SKIP) - public Builder orderby(Optional orderby) { - this.orderby = orderby; - return this; - } - - public Builder orderby(String orderby) { - this.orderby = Optional.of(orderby); - return this; - } - - @JsonSetter(value = "$filter", nulls = Nulls.SKIP) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.of(filter); - return this; - } - - public AssetsGetAssetsRequest build() { - return new AssetsGetAssetsRequest(noTotal, noSlowTotal, parentId, ids, q, top, skip, orderby, filter); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java deleted file mode 100644 index 3592ab9..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsPostAssetRequest.Builder.class) -public final class AssetsPostAssetRequest { - private final Optional parentId; - - private final Optional id; - - private final Optional duplicate; - - private AssetsPostAssetRequest(Optional parentId, Optional id, Optional duplicate) { - this.parentId = parentId; - this.id = id; - this.duplicate = duplicate; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The optional custom asset id. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return True to duplicate the asset, event if the file has been uploaded. - */ - @JsonProperty("duplicate") - public Optional getDuplicate() { - return duplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPostAssetRequest && equalTo((AssetsPostAssetRequest) other); - } - - private boolean equalTo(AssetsPostAssetRequest other) { - return parentId.equals(other.parentId) && id.equals(other.id) && duplicate.equals(other.duplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.id, this.duplicate); - } - - @Override - public String toString() { - return "AssetsPostAssetRequest{" + "parentId: " + parentId + ", id: " + id + ", duplicate: " + duplicate + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional duplicate = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsPostAssetRequest other) { - parentId(other.getParentId()); - id(other.getId()); - duplicate(other.getDuplicate()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "duplicate", nulls = Nulls.SKIP) - public Builder duplicate(Optional duplicate) { - this.duplicate = duplicate; - return this; - } - - public Builder duplicate(Boolean duplicate) { - this.duplicate = Optional.of(duplicate); - return this; - } - - public AssetsPostAssetRequest build() { - return new AssetsPostAssetRequest(parentId, id, duplicate); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java deleted file mode 100644 index aae2f66..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsPostUpsertAssetRequest.Builder.class) -public final class AssetsPostUpsertAssetRequest { - private final Optional parentId; - - private final Optional duplicate; - - private AssetsPostUpsertAssetRequest(Optional parentId, Optional duplicate) { - this.parentId = parentId; - this.duplicate = duplicate; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return True to duplicate the asset, event if the file has been uploaded. - */ - @JsonProperty("duplicate") - public Optional getDuplicate() { - return duplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPostUpsertAssetRequest && equalTo((AssetsPostUpsertAssetRequest) other); - } - - private boolean equalTo(AssetsPostUpsertAssetRequest other) { - return parentId.equals(other.parentId) && duplicate.equals(other.duplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.duplicate); - } - - @Override - public String toString() { - return "AssetsPostUpsertAssetRequest{" + "parentId: " + parentId + ", duplicate: " + duplicate + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional duplicate = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsPostUpsertAssetRequest other) { - parentId(other.getParentId()); - duplicate(other.getDuplicate()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "duplicate", nulls = Nulls.SKIP) - public Builder duplicate(Optional duplicate) { - this.duplicate = duplicate; - return this; - } - - public Builder duplicate(Boolean duplicate) { - this.duplicate = Optional.of(duplicate); - return this; - } - - public AssetsPostUpsertAssetRequest build() { - return new AssetsPostUpsertAssetRequest(parentId, duplicate); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java deleted file mode 100644 index 83f50cf..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -public final class AssetsPutAssetContentRequest { - private AssetsPutAssetContentRequest() {} - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPutAssetContentRequest; - } - - @Override - public String toString() { - return "AssetsPutAssetContentRequest{" + "}"; - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java b/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java deleted file mode 100644 index 6bc3d8d..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.BulkUpdateAssetsJobDto; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateAssetsDto.Builder.class) -public final class BulkUpdateAssetsDto { - private final Optional> jobs; - - private final Optional checkReferrers; - - private final Optional optimizeValidation; - - private final Optional doNotScript; - - private BulkUpdateAssetsDto( - Optional> jobs, - Optional checkReferrers, - Optional optimizeValidation, - Optional doNotScript) { - this.jobs = jobs; - this.checkReferrers = checkReferrers; - this.optimizeValidation = optimizeValidation; - this.doNotScript = doNotScript; - } - - /** - * @return The contents to update or insert. - */ - @JsonProperty("jobs") - public Optional> getJobs() { - return jobs; - } - - /** - * @return True to check referrers of deleted assets. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to turn off costly validation: Folder checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateAssetsDto && equalTo((BulkUpdateAssetsDto) other); - } - - private boolean equalTo(BulkUpdateAssetsDto other) { - return jobs.equals(other.jobs) - && checkReferrers.equals(other.checkReferrers) - && optimizeValidation.equals(other.optimizeValidation) - && doNotScript.equals(other.doNotScript); - } - - @Override - public int hashCode() { - return Objects.hash(this.jobs, this.checkReferrers, this.optimizeValidation, this.doNotScript); - } - - @Override - public String toString() { - return "BulkUpdateAssetsDto{" + "jobs: " + jobs + ", checkReferrers: " + checkReferrers - + ", optimizeValidation: " + optimizeValidation + ", doNotScript: " + doNotScript + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> jobs = Optional.empty(); - - private Optional checkReferrers = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateAssetsDto other) { - jobs(other.getJobs()); - checkReferrers(other.getCheckReferrers()); - optimizeValidation(other.getOptimizeValidation()); - doNotScript(other.getDoNotScript()); - return this; - } - - @JsonSetter(value = "jobs", nulls = Nulls.SKIP) - public Builder jobs(Optional> jobs) { - this.jobs = jobs; - return this; - } - - public Builder jobs(List jobs) { - this.jobs = Optional.of(jobs); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - public BulkUpdateAssetsDto build() { - return new BulkUpdateAssetsDto(jobs, checkReferrers, optimizeValidation, doNotScript); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java deleted file mode 100644 index 39dd78e..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateAssetFolderDto.Builder.class) -public final class CreateAssetFolderDto { - private final String folderName; - - private final Optional parentId; - - private CreateAssetFolderDto(String folderName, Optional parentId) { - this.folderName = folderName; - this.parentId = parentId; - } - - /** - * @return The name of the folder. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - /** - * @return The ID of the parent folder. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateAssetFolderDto && equalTo((CreateAssetFolderDto) other); - } - - private boolean equalTo(CreateAssetFolderDto other) { - return folderName.equals(other.folderName) && parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.folderName, this.parentId); - } - - @Override - public String toString() { - return "CreateAssetFolderDto{" + "folderName: " + folderName + ", parentId: " + parentId + "}"; - } - - public static FolderNameStage builder() { - return new Builder(); - } - - public interface FolderNameStage { - _FinalStage folderName(String folderName); - - Builder from(CreateAssetFolderDto other); - } - - public interface _FinalStage { - CreateAssetFolderDto build(); - - _FinalStage parentId(Optional parentId); - - _FinalStage parentId(String parentId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FolderNameStage, _FinalStage { - private String folderName; - - private Optional parentId = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateAssetFolderDto other) { - folderName(other.getFolderName()); - parentId(other.getParentId()); - return this; - } - - /** - *

The name of the folder. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public _FinalStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - /** - *

The ID of the parent folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @Override - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public _FinalStage parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - @Override - public CreateAssetFolderDto build() { - return new CreateAssetFolderDto(folderName, parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java deleted file mode 100644 index 21fdfa3..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MoveAssetDto.Builder.class) -public final class MoveAssetDto { - private final Optional parentId; - - private MoveAssetDto(Optional parentId) { - this.parentId = parentId; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MoveAssetDto && equalTo((MoveAssetDto) other); - } - - private boolean equalTo(MoveAssetDto other) { - return parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId); - } - - @Override - public String toString() { - return "MoveAssetDto{" + "parentId: " + parentId + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Builder() {} - - public Builder from(MoveAssetDto other) { - parentId(other.getParentId()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - public MoveAssetDto build() { - return new MoveAssetDto(parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java deleted file mode 100644 index 55039ab..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MoveAssetFolderDto.Builder.class) -public final class MoveAssetFolderDto { - private final Optional parentId; - - private MoveAssetFolderDto(Optional parentId) { - this.parentId = parentId; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MoveAssetFolderDto && equalTo((MoveAssetFolderDto) other); - } - - private boolean equalTo(MoveAssetFolderDto other) { - return parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId); - } - - @Override - public String toString() { - return "MoveAssetFolderDto{" + "parentId: " + parentId + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Builder() {} - - public Builder from(MoveAssetFolderDto other) { - parentId(other.getParentId()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - public MoveAssetFolderDto build() { - return new MoveAssetFolderDto(parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java deleted file mode 100644 index 20f38cc..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RenameAssetFolderDto.Builder.class) -public final class RenameAssetFolderDto { - private final String folderName; - - private RenameAssetFolderDto(String folderName) { - this.folderName = folderName; - } - - /** - * @return The name of the folder. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RenameAssetFolderDto && equalTo((RenameAssetFolderDto) other); - } - - private boolean equalTo(RenameAssetFolderDto other) { - return folderName.equals(other.folderName); - } - - @Override - public int hashCode() { - return Objects.hash(this.folderName); - } - - @Override - public String toString() { - return "RenameAssetFolderDto{" + "folderName: " + folderName + "}"; - } - - public static FolderNameStage builder() { - return new Builder(); - } - - public interface FolderNameStage { - _FinalStage folderName(String folderName); - - Builder from(RenameAssetFolderDto other); - } - - public interface _FinalStage { - RenameAssetFolderDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FolderNameStage, _FinalStage { - private String folderName; - - private Builder() {} - - @Override - public Builder from(RenameAssetFolderDto other) { - folderName(other.getFolderName()); - return this; - } - - /** - *

The name of the folder. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public _FinalStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - @Override - public RenameAssetFolderDto build() { - return new RenameAssetFolderDto(folderName); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java b/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java deleted file mode 100644 index 1e51ce3..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RenameTagDto.Builder.class) -public final class RenameTagDto { - private final String tagName; - - private RenameTagDto(String tagName) { - this.tagName = tagName; - } - - /** - * @return The new name for the tag. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("tagName") - public String getTagName() { - return tagName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RenameTagDto && equalTo((RenameTagDto) other); - } - - private boolean equalTo(RenameTagDto other) { - return tagName.equals(other.tagName); - } - - @Override - public int hashCode() { - return Objects.hash(this.tagName); - } - - @Override - public String toString() { - return "RenameTagDto{" + "tagName: " + tagName + "}"; - } - - public static TagNameStage builder() { - return new Builder(); - } - - public interface TagNameStage { - _FinalStage tagName(String tagName); - - Builder from(RenameTagDto other); - } - - public interface _FinalStage { - RenameTagDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TagNameStage, _FinalStage { - private String tagName; - - private Builder() {} - - @Override - public Builder from(RenameTagDto other) { - tagName(other.getTagName()); - return this; - } - - /** - *

The new name for the tag. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("tagName") - public _FinalStage tagName(String tagName) { - this.tagName = tagName; - return this; - } - - @Override - public RenameTagDto build() { - return new RenameTagDto(tagName); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/BackupsClient.java b/src/main/java/com/squidex/api/resources/backups/BackupsClient.java deleted file mode 100644 index 75906fc..0000000 --- a/src/main/java/com/squidex/api/resources/backups/BackupsClient.java +++ /dev/null @@ -1,254 +0,0 @@ -package com.squidex.api.resources.backups; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.backups.requests.BackupsGetBackupContentV2Request; -import com.squidex.api.resources.backups.requests.RestoreRequestDto; -import com.squidex.api.types.BackupJobsDto; -import com.squidex.api.types.RestoreJobDto; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class BackupsClient { - protected final ClientOptions clientOptions; - - public BackupsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public InputStream getBackupContent(String id) { - return getBackupContent(id, null); - } - - public InputStream getBackupContent(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteBackup(String id) { - deleteBackup(id, null); - } - - public void deleteBackup(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getBackupContentV2(String id, BackupsGetBackupContentV2Request request) { - return getBackupContentV2(id, request, null); - } - - public InputStream getBackupContentV2( - String id, BackupsGetBackupContentV2Request request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/backups") - .addPathSegment(id); - if (request.getAppId().isPresent()) { - _httpUrl.addQueryParameter("appId", request.getAppId().get()); - } - if (request.getApp().isPresent()) { - _httpUrl.addQueryParameter("app", request.getApp().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public BackupJobsDto getBackups() { - return getBackups(null); - } - - public BackupJobsDto getBackups(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), BackupJobsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void postBackup() { - postBackup(null); - } - - public void postBackup(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RestoreJobDto getRestoreJob() { - return getRestoreJob(null); - } - - public RestoreJobDto getRestoreJob(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/restore") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RestoreJobDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void postRestoreJob(RestoreRequestDto request) { - postRestoreJob(request, null); - } - - public void postRestoreJob(RestoreRequestDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/restore") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getName().isPresent()) { - _requestBodyProperties.put("name", request.getName()); - } - _requestBodyProperties.put("url", request.getUrl()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java b/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java deleted file mode 100644 index 87ba311..0000000 --- a/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.backups.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupsGetBackupContentV2Request.Builder.class) -public final class BackupsGetBackupContentV2Request { - private final Optional appId; - - private final Optional app; - - private BackupsGetBackupContentV2Request(Optional appId, Optional app) { - this.appId = appId; - this.app = app; - } - - /** - * @return The ID of the app. - */ - @JsonProperty("appId") - public Optional getAppId() { - return appId; - } - - /** - * @return The name of the app. - */ - @JsonProperty("app") - public Optional getApp() { - return app; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupsGetBackupContentV2Request && equalTo((BackupsGetBackupContentV2Request) other); - } - - private boolean equalTo(BackupsGetBackupContentV2Request other) { - return appId.equals(other.appId) && app.equals(other.app); - } - - @Override - public int hashCode() { - return Objects.hash(this.appId, this.app); - } - - @Override - public String toString() { - return "BackupsGetBackupContentV2Request{" + "appId: " + appId + ", app: " + app + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional appId = Optional.empty(); - - private Optional app = Optional.empty(); - - private Builder() {} - - public Builder from(BackupsGetBackupContentV2Request other) { - appId(other.getAppId()); - app(other.getApp()); - return this; - } - - @JsonSetter(value = "appId", nulls = Nulls.SKIP) - public Builder appId(Optional appId) { - this.appId = appId; - return this; - } - - public Builder appId(String appId) { - this.appId = Optional.of(appId); - return this; - } - - @JsonSetter(value = "app", nulls = Nulls.SKIP) - public Builder app(Optional app) { - this.app = app; - return this; - } - - public Builder app(String app) { - this.app = Optional.of(app); - return this; - } - - public BackupsGetBackupContentV2Request build() { - return new BackupsGetBackupContentV2Request(appId, app); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java b/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java deleted file mode 100644 index a069907..0000000 --- a/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.resources.backups.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RestoreRequestDto.Builder.class) -public final class RestoreRequestDto { - private final Optional name; - - private final String url; - - private RestoreRequestDto(Optional name, String url) { - this.name = name; - this.url = url; - } - - /** - * @return The name of the app. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The url to the restore file. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RestoreRequestDto && equalTo((RestoreRequestDto) other); - } - - private boolean equalTo(RestoreRequestDto other) { - return name.equals(other.name) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.url); - } - - @Override - public String toString() { - return "RestoreRequestDto{" + "name: " + name + ", url: " + url + "}"; - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - _FinalStage url(String url); - - Builder from(RestoreRequestDto other); - } - - public interface _FinalStage { - RestoreRequestDto build(); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, _FinalStage { - private String url; - - private Optional name = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RestoreRequestDto other) { - name(other.getName()); - url(other.getUrl()); - return this; - } - - /** - *

The url to the restore file. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; - } - - /** - *

The name of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @Override - public RestoreRequestDto build() { - return new RestoreRequestDto(name, url); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/comments/CommentsClient.java b/src/main/java/com/squidex/api/resources/comments/CommentsClient.java deleted file mode 100644 index 25dc5c1..0000000 --- a/src/main/java/com/squidex/api/resources/comments/CommentsClient.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.squidex.api.resources.comments; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.comments.requests.CommentsGetCommentsRequest; -import com.squidex.api.types.CommentDto; -import com.squidex.api.types.CommentsDto; -import com.squidex.api.types.UpsertCommentDto; -import java.io.IOException; -import java.util.List; -import java.util.Optional; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class CommentsClient { - protected final ClientOptions clientOptions; - - public CommentsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getWatchingUsers(Optional resource) { - return getWatchingUsers(resource, null); - } - - public List getWatchingUsers(Optional resource, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("watching"); - if (resource.isPresent()) { - _httpUrl.addPathSegment(resource.get()); - } - Request _request = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CommentsDto getComments(String commentsId, CommentsGetCommentsRequest request) { - return getComments(commentsId, request, null); - } - - public CommentsDto getComments( - String commentsId, CommentsGetCommentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId); - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CommentDto postComment(String commentsId, UpsertCommentDto request) { - return postComment(commentsId, request, null); - } - - public CommentDto postComment(String commentsId, UpsertCommentDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putComment(String commentsId, String commentId, UpsertCommentDto request) { - putComment(commentsId, commentId, request, null); - } - - public void putComment( - String commentsId, String commentId, UpsertCommentDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .addPathSegment(commentId) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteComment(String commentsId, String commentId) { - deleteComment(commentsId, commentId, null); - } - - public void deleteComment(String commentsId, String commentId, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .addPathSegment(commentId) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java b/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java deleted file mode 100644 index a70778f..0000000 --- a/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.comments.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentsGetCommentsRequest.Builder.class) -public final class CommentsGetCommentsRequest { - private final Optional version; - - private CommentsGetCommentsRequest(Optional version) { - this.version = version; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentsGetCommentsRequest && equalTo((CommentsGetCommentsRequest) other); - } - - private boolean equalTo(CommentsGetCommentsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return "CommentsGetCommentsRequest{" + "version: " + version + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(CommentsGetCommentsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public CommentsGetCommentsRequest build() { - return new CommentsGetCommentsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/ContentsClient.java b/src/main/java/com/squidex/api/resources/contents/ContentsClient.java deleted file mode 100644 index f68f936..0000000 --- a/src/main/java/com/squidex/api/resources/contents/ContentsClient.java +++ /dev/null @@ -1,937 +0,0 @@ -package com.squidex.api.resources.contents; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.contents.requests.BulkUpdateContentsDto; -import com.squidex.api.resources.contents.requests.ChangeStatusDto; -import com.squidex.api.resources.contents.requests.ContentsCreateDraftRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteContentRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteContentStatusRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteVersionRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentVersionRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentsPostRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentsRequest; -import com.squidex.api.resources.contents.requests.ContentsGetReferencesRequest; -import com.squidex.api.resources.contents.requests.ContentsGetReferencingRequest; -import com.squidex.api.resources.contents.requests.ContentsPatchContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPostContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPostUpsertContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPutContentRequest; -import com.squidex.api.resources.contents.requests.ImportContentsDto; -import com.squidex.api.types.BulkResultDto; -import com.squidex.api.types.ContentDto; -import com.squidex.api.types.ContentsDto; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class ContentsClient { - protected final ClientOptions clientOptions; - - public ContentsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public ContentsDto getContents(String schema, ContentsGetContentsRequest request) { - return getContents(schema, request, null); - } - - public ContentsDto getContents(String schema, ContentsGetContentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema); - if (request.getIds().isPresent()) { - _httpUrl.addQueryParameter("ids", request.getIds().get()); - } - if (request.getQ().isPresent()) { - _httpUrl.addQueryParameter("q", request.getQ().get()); - } - if (request.getSearch().isPresent()) { - _httpUrl.addQueryParameter("$search", request.getSearch().get()); - } - if (request.getTop().isPresent()) { - _httpUrl.addQueryParameter("$top", request.getTop().get().toString()); - } - if (request.getSkip().isPresent()) { - _httpUrl.addQueryParameter("$skip", request.getSkip().get().toString()); - } - if (request.getOrderby().isPresent()) { - _httpUrl.addQueryParameter("$orderby", request.getOrderby().get()); - } - if (request.getFilter().isPresent()) { - _httpUrl.addQueryParameter("$filter", request.getFilter().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto postContent(String schema, ContentsPostContentRequest request) { - return postContent(schema, request, null); - } - - public ContentDto postContent(String schema, ContentsPostContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema); - if (request.getStatus().isPresent()) { - _httpUrl.addQueryParameter("status", request.getStatus().get()); - } - if (request.getId().isPresent()) { - _httpUrl.addQueryParameter("id", request.getId().get()); - } - if (request.getPublish().isPresent()) { - _httpUrl.addQueryParameter("publish", request.getPublish().get().toString()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentsDto getContentsPost(String schema, ContentsGetContentsPostRequest request) { - return getContentsPost(schema, request, null); - } - - public ContentsDto getContentsPost( - String schema, ContentsGetContentsPostRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("query") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto getContent(String schema, String id, ContentsGetContentRequest request) { - return getContent(schema, id, request, null); - } - - public ContentDto getContent( - String schema, String id, ContentsGetContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto postUpsertContent(String schema, String id, ContentsPostUpsertContentRequest request) { - return postUpsertContent(schema, id, request, null); - } - - public ContentDto postUpsertContent( - String schema, String id, ContentsPostUpsertContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getStatus().isPresent()) { - _httpUrl.addQueryParameter("status", request.getStatus().get()); - } - if (request.getPatch().isPresent()) { - _httpUrl.addQueryParameter("patch", request.getPatch().get().toString()); - } - if (request.getPublish().isPresent()) { - _httpUrl.addQueryParameter("publish", request.getPublish().get().toString()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto putContent(String schema, String id, ContentsPutContentRequest request) { - return putContent(schema, id, request, null); - } - - public ContentDto putContent( - String schema, String id, ContentsPutContentRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto patchContent(String schema, String id, ContentsPatchContentRequest request) { - return patchContent(schema, id, request, null); - } - - public ContentDto patchContent( - String schema, String id, ContentsPatchContentRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PATCH", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteContent(String schema, String id, ContentsDeleteContentRequest request) { - deleteContent(schema, id, request, null); - } - - public void deleteContent( - String schema, String id, ContentsDeleteContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getCheckReferrers().isPresent()) { - _httpUrl.addQueryParameter( - "checkReferrers", request.getCheckReferrers().get().toString()); - } - if (request.getPermanent().isPresent()) { - _httpUrl.addQueryParameter("permanent", request.getPermanent().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("DELETE", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getContentValidity(String schema, String id) { - getContentValidity(schema, id, null); - } - - public void getContentValidity(String schema, String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("validity") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentsDto getReferences(String schema, String id, ContentsGetReferencesRequest request) { - return getReferences(schema, id, request, null); - } - - public ContentsDto getReferences( - String schema, String id, ContentsGetReferencesRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("references"); - if (request.getQ().isPresent()) { - _httpUrl.addQueryParameter("q", request.getQ().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentsDto getReferencing(String schema, String id, ContentsGetReferencingRequest request) { - return getReferencing(schema, id, request, null); - } - - public ContentsDto getReferencing( - String schema, String id, ContentsGetReferencingRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("referencing"); - if (request.getQ().isPresent()) { - _httpUrl.addQueryParameter("q", request.getQ().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getContentVersion( - String schema, String id, int version, ContentsGetContentVersionRequest request) { - return getContentVersion(schema, id, version, request, null); - } - - public InputStream getContentVersion( - String schema, - String id, - int version, - ContentsGetContentVersionRequest request, - RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegment(Integer.toString(version)) - .build(); - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List postContents(String schema, ImportContentsDto request) { - return postContents(schema, request, null); - } - - public List postContents(String schema, ImportContentsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("import") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("datas", request.getDatas()); - if (request.getPublish().isPresent()) { - _requestBodyProperties.put("publish", request.getPublish()); - } - if (request.getDoNotScript().isPresent()) { - _requestBodyProperties.put("doNotScript", request.getDoNotScript()); - } - if (request.getOptimizeValidation().isPresent()) { - _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List bulkUpdateContents(String schema, BulkUpdateContentsDto request) { - return bulkUpdateContents(schema, request, null); - } - - public List bulkUpdateContents( - String schema, BulkUpdateContentsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("bulk") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("jobs", request.getJobs()); - if (request.getPublish().isPresent()) { - _requestBodyProperties.put("publish", request.getPublish()); - } - if (request.getDoNotScript().isPresent()) { - _requestBodyProperties.put("doNotScript", request.getDoNotScript()); - } - if (request.getDoNotValidate().isPresent()) { - _requestBodyProperties.put("doNotValidate", request.getDoNotValidate()); - } - if (request.getDoNotValidateWorkflow().isPresent()) { - _requestBodyProperties.put("doNotValidateWorkflow", request.getDoNotValidateWorkflow()); - } - if (request.getCheckReferrers().isPresent()) { - _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); - } - if (request.getOptimizeValidation().isPresent()) { - _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto putContentStatus(String schema, String id, ChangeStatusDto request) { - return putContentStatus(schema, id, request, null); - } - - public ContentDto putContentStatus( - String schema, String id, ChangeStatusDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("status") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("status", request.getStatus()); - if (request.getDueTime().isPresent()) { - _requestBodyProperties.put("dueTime", request.getDueTime()); - } - if (request.getCheckReferrers().isPresent()) { - _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto deleteContentStatus(String schema, String id, ContentsDeleteContentStatusRequest request) { - return deleteContentStatus(schema, id, request, null); - } - - public ContentDto deleteContentStatus( - String schema, String id, ContentsDeleteContentStatusRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("status") - .build(); - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("DELETE", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto createDraft(String schema, String id, ContentsCreateDraftRequest request) { - return createDraft(schema, id, request, null); - } - - public ContentDto createDraft( - String schema, String id, ContentsCreateDraftRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("draft") - .build(); - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContentDto deleteVersion(String schema, String id, ContentsDeleteVersionRequest request) { - return deleteVersion(schema, id, request, null); - } - - public ContentDto deleteVersion( - String schema, String id, ContentsDeleteVersionRequest request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("draft") - .build(); - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("DELETE", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java b/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java deleted file mode 100644 index 96fa0c6..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java +++ /dev/null @@ -1,267 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.BulkUpdateContentsJobDto; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateContentsDto.Builder.class) -public final class BulkUpdateContentsDto { - private final List jobs; - - private final Optional publish; - - private final Optional doNotScript; - - private final Optional doNotValidate; - - private final Optional doNotValidateWorkflow; - - private final Optional checkReferrers; - - private final Optional optimizeValidation; - - private BulkUpdateContentsDto( - List jobs, - Optional publish, - Optional doNotScript, - Optional doNotValidate, - Optional doNotValidateWorkflow, - Optional checkReferrers, - Optional optimizeValidation) { - this.jobs = jobs; - this.publish = publish; - this.doNotScript = doNotScript; - this.doNotValidate = doNotValidate; - this.doNotValidateWorkflow = doNotValidateWorkflow; - this.checkReferrers = checkReferrers; - this.optimizeValidation = optimizeValidation; - } - - /** - * @return The contents to update or insert. - */ - @JsonProperty("jobs") - public List getJobs() { - return jobs; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - /** - * @return True to turn off validation for faster inserts. Default: false. - */ - @JsonProperty("doNotValidate") - public Optional getDoNotValidate() { - return doNotValidate; - } - - /** - * @return True to turn off validation of workflow rules. Default: false. - */ - @JsonProperty("doNotValidateWorkflow") - public Optional getDoNotValidateWorkflow() { - return doNotValidateWorkflow; - } - - /** - * @return True to check referrers of deleted contents. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateContentsDto && equalTo((BulkUpdateContentsDto) other); - } - - private boolean equalTo(BulkUpdateContentsDto other) { - return jobs.equals(other.jobs) - && publish.equals(other.publish) - && doNotScript.equals(other.doNotScript) - && doNotValidate.equals(other.doNotValidate) - && doNotValidateWorkflow.equals(other.doNotValidateWorkflow) - && checkReferrers.equals(other.checkReferrers) - && optimizeValidation.equals(other.optimizeValidation); - } - - @Override - public int hashCode() { - return Objects.hash( - this.jobs, - this.publish, - this.doNotScript, - this.doNotValidate, - this.doNotValidateWorkflow, - this.checkReferrers, - this.optimizeValidation); - } - - @Override - public String toString() { - return "BulkUpdateContentsDto{" + "jobs: " + jobs + ", publish: " + publish + ", doNotScript: " + doNotScript - + ", doNotValidate: " + doNotValidate + ", doNotValidateWorkflow: " + doNotValidateWorkflow - + ", checkReferrers: " + checkReferrers + ", optimizeValidation: " + optimizeValidation + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List jobs = new ArrayList<>(); - - private Optional publish = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Optional doNotValidate = Optional.empty(); - - private Optional doNotValidateWorkflow = Optional.empty(); - - private Optional checkReferrers = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateContentsDto other) { - jobs(other.getJobs()); - publish(other.getPublish()); - doNotScript(other.getDoNotScript()); - doNotValidate(other.getDoNotValidate()); - doNotValidateWorkflow(other.getDoNotValidateWorkflow()); - checkReferrers(other.getCheckReferrers()); - optimizeValidation(other.getOptimizeValidation()); - return this; - } - - @JsonSetter(value = "jobs", nulls = Nulls.SKIP) - public Builder jobs(List jobs) { - this.jobs.clear(); - this.jobs.addAll(jobs); - return this; - } - - public Builder addJobs(BulkUpdateContentsJobDto jobs) { - this.jobs.add(jobs); - return this; - } - - public Builder addAllJobs(List jobs) { - this.jobs.addAll(jobs); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - @JsonSetter(value = "doNotValidate", nulls = Nulls.SKIP) - public Builder doNotValidate(Optional doNotValidate) { - this.doNotValidate = doNotValidate; - return this; - } - - public Builder doNotValidate(Boolean doNotValidate) { - this.doNotValidate = Optional.of(doNotValidate); - return this; - } - - @JsonSetter(value = "doNotValidateWorkflow", nulls = Nulls.SKIP) - public Builder doNotValidateWorkflow(Optional doNotValidateWorkflow) { - this.doNotValidateWorkflow = doNotValidateWorkflow; - return this; - } - - public Builder doNotValidateWorkflow(Boolean doNotValidateWorkflow) { - this.doNotValidateWorkflow = Optional.of(doNotValidateWorkflow); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - public BulkUpdateContentsDto build() { - return new BulkUpdateContentsDto( - jobs, - publish, - doNotScript, - doNotValidate, - doNotValidateWorkflow, - checkReferrers, - optimizeValidation); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java b/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java deleted file mode 100644 index 28e133f..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangeStatusDto.Builder.class) -public final class ChangeStatusDto { - private final Optional unpublished; - - private final Optional languages; - - private final String status; - - private final Optional dueTime; - - private final Optional checkReferrers; - - private ChangeStatusDto( - Optional unpublished, - Optional languages, - String status, - Optional dueTime, - Optional checkReferrers) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.dueTime = dueTime; - this.checkReferrers = checkReferrers; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The new status. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The due time. - */ - @JsonProperty("dueTime") - public Optional getDueTime() { - return dueTime; - } - - /** - * @return True to check referrers of this content. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangeStatusDto && equalTo((ChangeStatusDto) other); - } - - private boolean equalTo(ChangeStatusDto other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && checkReferrers.equals(other.checkReferrers); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.dueTime, this.checkReferrers); - } - - @Override - public String toString() { - return "ChangeStatusDto{" + "unpublished: " + unpublished + ", languages: " + languages + ", status: " + status - + ", dueTime: " + dueTime + ", checkReferrers: " + checkReferrers + "}"; - } - - public static StatusStage builder() { - return new Builder(); - } - - public interface StatusStage { - _FinalStage status(String status); - - Builder from(ChangeStatusDto other); - } - - public interface _FinalStage { - ChangeStatusDto build(); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - - _FinalStage languages(Optional languages); - - _FinalStage languages(String languages); - - _FinalStage dueTime(Optional dueTime); - - _FinalStage dueTime(OffsetDateTime dueTime); - - _FinalStage checkReferrers(Optional checkReferrers); - - _FinalStage checkReferrers(Boolean checkReferrers); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StatusStage, _FinalStage { - private String status; - - private Optional checkReferrers = Optional.empty(); - - private Optional dueTime = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ChangeStatusDto other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - dueTime(other.getDueTime()); - checkReferrers(other.getCheckReferrers()); - return this; - } - - /** - *

The new status. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public _FinalStage status(String status) { - this.status = status; - return this; - } - - /** - *

True to check referrers of this content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @Override - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public _FinalStage checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - /** - *

The due time.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage dueTime(OffsetDateTime dueTime) { - this.dueTime = Optional.of(dueTime); - return this; - } - - @Override - @JsonSetter(value = "dueTime", nulls = Nulls.SKIP) - public _FinalStage dueTime(Optional dueTime) { - this.dueTime = dueTime; - return this; - } - - /** - *

Only resolve these languages (comma-separated).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @Override - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public _FinalStage languages(Optional languages) { - this.languages = languages; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - @Override - public ChangeStatusDto build() { - return new ChangeStatusDto(unpublished, languages, status, dueTime, checkReferrers); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java deleted file mode 100644 index 8797e43..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsCreateDraftRequest.Builder.class) -public final class ContentsCreateDraftRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsCreateDraftRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsCreateDraftRequest && equalTo((ContentsCreateDraftRequest) other); - } - - private boolean equalTo(ContentsCreateDraftRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return "ContentsCreateDraftRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsCreateDraftRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsCreateDraftRequest build() { - return new ContentsCreateDraftRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java deleted file mode 100644 index 776a552..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteContentRequest.Builder.class) -public final class ContentsDeleteContentRequest { - private final Optional checkReferrers; - - private final Optional permanent; - - private ContentsDeleteContentRequest(Optional checkReferrers, Optional permanent) { - this.checkReferrers = checkReferrers; - this.permanent = permanent; - } - - /** - * @return True to check referrers of this content. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to delete the content permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteContentRequest && equalTo((ContentsDeleteContentRequest) other); - } - - private boolean equalTo(ContentsDeleteContentRequest other) { - return checkReferrers.equals(other.checkReferrers) && permanent.equals(other.permanent); - } - - @Override - public int hashCode() { - return Objects.hash(this.checkReferrers, this.permanent); - } - - @Override - public String toString() { - return "ContentsDeleteContentRequest{" + "checkReferrers: " + checkReferrers + ", permanent: " + permanent - + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional checkReferrers = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteContentRequest other) { - checkReferrers(other.getCheckReferrers()); - permanent(other.getPermanent()); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - public ContentsDeleteContentRequest build() { - return new ContentsDeleteContentRequest(checkReferrers, permanent); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java deleted file mode 100644 index ff7eea5..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteContentStatusRequest.Builder.class) -public final class ContentsDeleteContentStatusRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsDeleteContentStatusRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteContentStatusRequest - && equalTo((ContentsDeleteContentStatusRequest) other); - } - - private boolean equalTo(ContentsDeleteContentStatusRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return "ContentsDeleteContentStatusRequest{" + "unpublished: " + unpublished + ", languages: " + languages - + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteContentStatusRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsDeleteContentStatusRequest build() { - return new ContentsDeleteContentStatusRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java deleted file mode 100644 index c027bdb..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteVersionRequest.Builder.class) -public final class ContentsDeleteVersionRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsDeleteVersionRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteVersionRequest && equalTo((ContentsDeleteVersionRequest) other); - } - - private boolean equalTo(ContentsDeleteVersionRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return "ContentsDeleteVersionRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteVersionRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsDeleteVersionRequest build() { - return new ContentsDeleteVersionRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java deleted file mode 100644 index 2db8ebd..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentRequest.Builder.class) -public final class ContentsGetContentRequest { - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional version; - - private ContentsGetContentRequest( - Optional flatten, - Optional languages, - Optional unpublished, - Optional version) { - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.version = version; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The optional version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentRequest && equalTo((ContentsGetContentRequest) other); - } - - private boolean equalTo(ContentsGetContentRequest other) { - return flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.flatten, this.languages, this.unpublished, this.version); - } - - @Override - public String toString() { - return "ContentsGetContentRequest{" + "flatten: " + flatten + ", languages: " + languages + ", unpublished: " - + unpublished + ", version: " + version + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentRequest other) { - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public ContentsGetContentRequest build() { - return new ContentsGetContentRequest(flatten, languages, unpublished, version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java deleted file mode 100644 index ba01ac9..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentVersionRequest.Builder.class) -public final class ContentsGetContentVersionRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsGetContentVersionRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentVersionRequest && equalTo((ContentsGetContentVersionRequest) other); - } - - private boolean equalTo(ContentsGetContentVersionRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return "ContentsGetContentVersionRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentVersionRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsGetContentVersionRequest build() { - return new ContentsGetContentVersionRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java deleted file mode 100644 index 526c6c3..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.QueryDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentsPostRequest.Builder.class) -public final class ContentsGetContentsPostRequest { - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final QueryDto body; - - private ContentsGetContentsPostRequest( - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - QueryDto body) { - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.body = body; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - @JsonProperty("body") - public QueryDto getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentsPostRequest && equalTo((ContentsGetContentsPostRequest) other); - } - - private boolean equalTo(ContentsGetContentsPostRequest other) { - return flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.flatten, this.languages, this.noSlowTotal, this.noTotal, this.unpublished, this.body); - } - - @Override - public String toString() { - return "ContentsGetContentsPostRequest{" + "flatten: " + flatten + ", languages: " + languages - + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", unpublished: " + unpublished - + ", body: " + body + "}"; - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(QueryDto body); - - Builder from(ContentsGetContentsPostRequest other); - } - - public interface _FinalStage { - ContentsGetContentsPostRequest build(); - - _FinalStage flatten(Optional flatten); - - _FinalStage flatten(Boolean flatten); - - _FinalStage languages(Optional languages); - - _FinalStage languages(String languages); - - _FinalStage noSlowTotal(Optional noSlowTotal); - - _FinalStage noSlowTotal(Boolean noSlowTotal); - - _FinalStage noTotal(Optional noTotal); - - _FinalStage noTotal(Boolean noTotal); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private QueryDto body; - - private Optional unpublished = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentsGetContentsPostRequest other) { - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(QueryDto body) { - this.body = body; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - /** - *

Do not return the total amount.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public _FinalStage noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - /** - *

Do not return the total amount, if it would be slow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public _FinalStage noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - /** - *

Only resolve these languages (comma-separated).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @Override - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public _FinalStage languages(Optional languages) { - this.languages = languages; - return this; - } - - /** - *

Provide the data as flat object.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @Override - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public _FinalStage flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - @Override - public ContentsGetContentsPostRequest build() { - return new ContentsGetContentsPostRequest(flatten, languages, noSlowTotal, noTotal, unpublished, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java deleted file mode 100644 index d4dc6ff..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java +++ /dev/null @@ -1,393 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentsRequest.Builder.class) -public final class ContentsGetContentsRequest { - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final Optional ids; - - private final Optional q; - - private final Optional search; - - private final Optional top; - - private final Optional skip; - - private final Optional orderby; - - private final Optional filter; - - private ContentsGetContentsRequest( - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - Optional ids, - Optional q, - Optional search, - Optional top, - Optional skip, - Optional orderby, - Optional filter) { - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.ids = ids; - this.q = q; - this.search = search; - this.top = top; - this.skip = skip; - this.orderby = orderby; - this.filter = filter; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The optional ids of the content to fetch. - */ - @JsonProperty("ids") - public Optional getIds() { - return ids; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$search") - public Optional getSearch() { - return search; - } - - /** - * @return Optional number of items to take. - */ - @JsonProperty("$top") - public Optional getTop() { - return top; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$skip") - public Optional getSkip() { - return skip; - } - - /** - * @return Optional OData order definition. - */ - @JsonProperty("$orderby") - public Optional getOrderby() { - return orderby; - } - - /** - * @return Optional OData filter. - */ - @JsonProperty("$filter") - public Optional getFilter() { - return filter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentsRequest && equalTo((ContentsGetContentsRequest) other); - } - - private boolean equalTo(ContentsGetContentsRequest other) { - return flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && ids.equals(other.ids) - && q.equals(other.q) - && search.equals(other.search) - && top.equals(other.top) - && skip.equals(other.skip) - && orderby.equals(other.orderby) - && filter.equals(other.filter); - } - - @Override - public int hashCode() { - return Objects.hash( - this.flatten, - this.languages, - this.noSlowTotal, - this.noTotal, - this.unpublished, - this.ids, - this.q, - this.search, - this.top, - this.skip, - this.orderby, - this.filter); - } - - @Override - public String toString() { - return "ContentsGetContentsRequest{" + "flatten: " + flatten + ", languages: " + languages + ", noSlowTotal: " - + noSlowTotal + ", noTotal: " + noTotal + ", unpublished: " + unpublished + ", ids: " + ids + ", q: " - + q + ", search: " + search + ", top: " + top + ", skip: " + skip + ", orderby: " + orderby - + ", filter: " + filter + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional ids = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional search = Optional.empty(); - - private Optional top = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional orderby = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentsRequest other) { - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - ids(other.getIds()); - q(other.getQ()); - search(other.getSearch()); - top(other.getTop()); - skip(other.getSkip()); - orderby(other.getOrderby()); - filter(other.getFilter()); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional ids) { - this.ids = ids; - return this; - } - - public Builder ids(String ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - @JsonSetter(value = "$search", nulls = Nulls.SKIP) - public Builder search(Optional search) { - this.search = search; - return this; - } - - public Builder search(String search) { - this.search = Optional.of(search); - return this; - } - - @JsonSetter(value = "$top", nulls = Nulls.SKIP) - public Builder top(Optional top) { - this.top = top; - return this; - } - - public Builder top(Double top) { - this.top = Optional.of(top); - return this; - } - - @JsonSetter(value = "$skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Double skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "$orderby", nulls = Nulls.SKIP) - public Builder orderby(Optional orderby) { - this.orderby = orderby; - return this; - } - - public Builder orderby(String orderby) { - this.orderby = Optional.of(orderby); - return this; - } - - @JsonSetter(value = "$filter", nulls = Nulls.SKIP) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.of(filter); - return this; - } - - public ContentsGetContentsRequest build() { - return new ContentsGetContentsRequest( - flatten, languages, noSlowTotal, noTotal, unpublished, ids, q, search, top, skip, orderby, filter); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java deleted file mode 100644 index 8cdf03b..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetReferencesRequest.Builder.class) -public final class ContentsGetReferencesRequest { - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional q; - - private ContentsGetReferencesRequest( - Optional flatten, - Optional languages, - Optional unpublished, - Optional noSlowTotal, - Optional noTotal, - Optional q) { - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.q = q; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetReferencesRequest && equalTo((ContentsGetReferencesRequest) other); - } - - private boolean equalTo(ContentsGetReferencesRequest other) { - return flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash(this.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); - } - - @Override - public String toString() { - return "ContentsGetReferencesRequest{" + "flatten: " + flatten + ", languages: " + languages + ", unpublished: " - + unpublished + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", q: " + q + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetReferencesRequest other) { - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - public ContentsGetReferencesRequest build() { - return new ContentsGetReferencesRequest(flatten, languages, unpublished, noSlowTotal, noTotal, q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java deleted file mode 100644 index d2c80e0..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java +++ /dev/null @@ -1,217 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetReferencingRequest.Builder.class) -public final class ContentsGetReferencingRequest { - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional q; - - private ContentsGetReferencingRequest( - Optional flatten, - Optional languages, - Optional unpublished, - Optional noSlowTotal, - Optional noTotal, - Optional q) { - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.q = q; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetReferencingRequest && equalTo((ContentsGetReferencingRequest) other); - } - - private boolean equalTo(ContentsGetReferencingRequest other) { - return flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash(this.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); - } - - @Override - public String toString() { - return "ContentsGetReferencingRequest{" + "flatten: " + flatten + ", languages: " + languages - + ", unpublished: " + unpublished + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", q: " - + q + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetReferencingRequest other) { - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - public ContentsGetReferencingRequest build() { - return new ContentsGetReferencingRequest(flatten, languages, unpublished, noSlowTotal, noTotal, q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java deleted file mode 100644 index 0eebad8..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPatchContentRequest.Builder.class) -public final class ContentsPatchContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Map> body; - - private ContentsPatchContentRequest( - Optional unpublished, Optional languages, Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPatchContentRequest && equalTo((ContentsPatchContentRequest) other); - } - - private boolean equalTo(ContentsPatchContentRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.body); - } - - @Override - public String toString() { - return "ContentsPatchContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + ", body: " - + body + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPatchContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPatchContentRequest build() { - return new ContentsPatchContentRequest(unpublished, languages, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java deleted file mode 100644 index b141aae..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostContentRequest.Builder.class) -public final class ContentsPostContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Optional status; - - private final Optional id; - - private final Optional publish; - - private final Map> body; - - private ContentsPostContentRequest( - Optional unpublished, - Optional languages, - Optional status, - Optional id, - Optional publish, - Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.id = id; - this.publish = publish; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The initial status. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return The optional custom content id. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostContentRequest && equalTo((ContentsPostContentRequest) other); - } - - private boolean equalTo(ContentsPostContentRequest other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && id.equals(other.id) - && publish.equals(other.publish) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.id, this.publish, this.body); - } - - @Override - public String toString() { - return "ContentsPostContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages - + ", status: " + status + ", id: " + id + ", publish: " + publish + ", body: " + body + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional publish = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPostContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - id(other.getId()); - publish(other.getPublish()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPostContentRequest build() { - return new ContentsPostContentRequest(unpublished, languages, status, id, publish, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java deleted file mode 100644 index b5af55a..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java +++ /dev/null @@ -1,221 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostUpsertContentRequest.Builder.class) -public final class ContentsPostUpsertContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Optional status; - - private final Optional patch; - - private final Optional publish; - - private final Map> body; - - private ContentsPostUpsertContentRequest( - Optional unpublished, - Optional languages, - Optional status, - Optional patch, - Optional publish, - Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.patch = patch; - this.publish = publish; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The initial status. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return Makes the update as patch. - */ - @JsonProperty("patch") - public Optional getPatch() { - return patch; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostUpsertContentRequest && equalTo((ContentsPostUpsertContentRequest) other); - } - - private boolean equalTo(ContentsPostUpsertContentRequest other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && patch.equals(other.patch) - && publish.equals(other.publish) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.patch, this.publish, this.body); - } - - @Override - public String toString() { - return "ContentsPostUpsertContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages - + ", status: " + status + ", patch: " + patch + ", publish: " + publish + ", body: " + body + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional patch = Optional.empty(); - - private Optional publish = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPostUpsertContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - patch(other.getPatch()); - publish(other.getPublish()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "patch", nulls = Nulls.SKIP) - public Builder patch(Optional patch) { - this.patch = patch; - return this; - } - - public Builder patch(Boolean patch) { - this.patch = Optional.of(patch); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPostUpsertContentRequest build() { - return new ContentsPostUpsertContentRequest(unpublished, languages, status, patch, publish, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java deleted file mode 100644 index 08bae21..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPutContentRequest.Builder.class) -public final class ContentsPutContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Map> body; - - private ContentsPutContentRequest( - Optional unpublished, Optional languages, Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Only resolve these languages (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPutContentRequest && equalTo((ContentsPutContentRequest) other); - } - - private boolean equalTo(ContentsPutContentRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.body); - } - - @Override - public String toString() { - return "ContentsPutContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + ", body: " - + body + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPutContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPutContentRequest build() { - return new ContentsPutContentRequest(unpublished, languages, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java b/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java deleted file mode 100644 index b46b1e3..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ImportContentsDto.Builder.class) -public final class ImportContentsDto { - private final List>> datas; - - private final Optional publish; - - private final Optional doNotScript; - - private final Optional optimizeValidation; - - private ImportContentsDto( - List>> datas, - Optional publish, - Optional doNotScript, - Optional optimizeValidation) { - this.datas = datas; - this.publish = publish; - this.doNotScript = doNotScript; - this.optimizeValidation = optimizeValidation; - } - - /** - * @return The data to import. - */ - @JsonProperty("datas") - public List>> getDatas() { - return datas; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - /** - * @return True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ImportContentsDto && equalTo((ImportContentsDto) other); - } - - private boolean equalTo(ImportContentsDto other) { - return datas.equals(other.datas) - && publish.equals(other.publish) - && doNotScript.equals(other.doNotScript) - && optimizeValidation.equals(other.optimizeValidation); - } - - @Override - public int hashCode() { - return Objects.hash(this.datas, this.publish, this.doNotScript, this.optimizeValidation); - } - - @Override - public String toString() { - return "ImportContentsDto{" + "datas: " + datas + ", publish: " + publish + ", doNotScript: " + doNotScript - + ", optimizeValidation: " + optimizeValidation + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List>> datas = new ArrayList<>(); - - private Optional publish = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Builder() {} - - public Builder from(ImportContentsDto other) { - datas(other.getDatas()); - publish(other.getPublish()); - doNotScript(other.getDoNotScript()); - optimizeValidation(other.getOptimizeValidation()); - return this; - } - - @JsonSetter(value = "datas", nulls = Nulls.SKIP) - public Builder datas(List>> datas) { - this.datas.clear(); - this.datas.addAll(datas); - return this; - } - - public Builder addDatas(Map> datas) { - this.datas.add(datas); - return this; - } - - public Builder addAllDatas(List>> datas) { - this.datas.addAll(datas); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - public ImportContentsDto build() { - return new ImportContentsDto(datas, publish, doNotScript, optimizeValidation); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java b/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java deleted file mode 100644 index 1efd00a..0000000 --- a/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.squidex.api.resources.diagnostics; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class DiagnosticsClient { - protected final ClientOptions clientOptions; - - public DiagnosticsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public void getDump() { - getDump(null); - } - - public void getDump(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/diagnostics/dump") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getGcDump() { - getGcDump(null); - } - - public void getGcDump(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/diagnostics/gcdump") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java b/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java deleted file mode 100644 index beff49d..0000000 --- a/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.squidex.api.resources.eventconsumers; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.EventConsumerDto; -import com.squidex.api.types.EventConsumersDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class EventConsumersClient { - protected final ClientOptions clientOptions; - - public EventConsumersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public EventConsumersDto getEventConsumers() { - return getEventConsumers(null); - } - - public EventConsumersDto getEventConsumers(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumersDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto startEventConsumer(String consumerName) { - return startEventConsumer(consumerName, null); - } - - public EventConsumerDto startEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("start") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto stopEventConsumer(String consumerName) { - return stopEventConsumer(consumerName, null); - } - - public EventConsumerDto stopEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("stop") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto resetEventConsumer(String consumerName) { - return resetEventConsumer(consumerName, null); - } - - public EventConsumerDto resetEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("reset") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/history/HistoryClient.java b/src/main/java/com/squidex/api/resources/history/HistoryClient.java deleted file mode 100644 index ad19c53..0000000 --- a/src/main/java/com/squidex/api/resources/history/HistoryClient.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.squidex.api.resources.history; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.history.requests.HistoryGetAppHistoryRequest; -import com.squidex.api.resources.history.requests.HistoryGetTeamHistoryRequest; -import com.squidex.api.types.HistoryEventDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class HistoryClient { - protected final ClientOptions clientOptions; - - public HistoryClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getAppHistory(HistoryGetAppHistoryRequest request) { - return getAppHistory(request, null); - } - - public List getAppHistory(HistoryGetAppHistoryRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("history"); - if (request.getChannel().isPresent()) { - _httpUrl.addQueryParameter("channel", request.getChannel().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getTeamHistory(String team, HistoryGetTeamHistoryRequest request) { - return getTeamHistory(team, request, null); - } - - public List getTeamHistory( - String team, HistoryGetTeamHistoryRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("history"); - if (request.getChannel().isPresent()) { - _httpUrl.addQueryParameter("channel", request.getChannel().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java deleted file mode 100644 index 4f58ff3..0000000 --- a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.history.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryGetAppHistoryRequest.Builder.class) -public final class HistoryGetAppHistoryRequest { - private final Optional channel; - - private HistoryGetAppHistoryRequest(Optional channel) { - this.channel = channel; - } - - /** - * @return The name of the channel. - */ - @JsonProperty("channel") - public Optional getChannel() { - return channel; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryGetAppHistoryRequest && equalTo((HistoryGetAppHistoryRequest) other); - } - - private boolean equalTo(HistoryGetAppHistoryRequest other) { - return channel.equals(other.channel); - } - - @Override - public int hashCode() { - return Objects.hash(this.channel); - } - - @Override - public String toString() { - return "HistoryGetAppHistoryRequest{" + "channel: " + channel + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional channel = Optional.empty(); - - private Builder() {} - - public Builder from(HistoryGetAppHistoryRequest other) { - channel(other.getChannel()); - return this; - } - - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public Builder channel(Optional channel) { - this.channel = channel; - return this; - } - - public Builder channel(String channel) { - this.channel = Optional.of(channel); - return this; - } - - public HistoryGetAppHistoryRequest build() { - return new HistoryGetAppHistoryRequest(channel); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java deleted file mode 100644 index 662c20e..0000000 --- a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.history.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryGetTeamHistoryRequest.Builder.class) -public final class HistoryGetTeamHistoryRequest { - private final Optional channel; - - private HistoryGetTeamHistoryRequest(Optional channel) { - this.channel = channel; - } - - /** - * @return The name of the channel. - */ - @JsonProperty("channel") - public Optional getChannel() { - return channel; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryGetTeamHistoryRequest && equalTo((HistoryGetTeamHistoryRequest) other); - } - - private boolean equalTo(HistoryGetTeamHistoryRequest other) { - return channel.equals(other.channel); - } - - @Override - public int hashCode() { - return Objects.hash(this.channel); - } - - @Override - public String toString() { - return "HistoryGetTeamHistoryRequest{" + "channel: " + channel + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional channel = Optional.empty(); - - private Builder() {} - - public Builder from(HistoryGetTeamHistoryRequest other) { - channel(other.getChannel()); - return this; - } - - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public Builder channel(Optional channel) { - this.channel = channel; - return this; - } - - public Builder channel(String channel) { - this.channel = Optional.of(channel); - return this; - } - - public HistoryGetTeamHistoryRequest build() { - return new HistoryGetTeamHistoryRequest(channel); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java b/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java deleted file mode 100644 index ff6437b..0000000 --- a/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.squidex.api.resources.languages; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.LanguageDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class LanguagesClient { - protected final ClientOptions clientOptions; - - public LanguagesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getLanguages() { - return getLanguages(null); - } - - public List getLanguages(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/languages") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/news/NewsClient.java b/src/main/java/com/squidex/api/resources/news/NewsClient.java deleted file mode 100644 index acba1a1..0000000 --- a/src/main/java/com/squidex/api/resources/news/NewsClient.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.squidex.api.resources.news; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.news.requests.NewsGetNewsRequest; -import com.squidex.api.types.FeaturesDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class NewsClient { - protected final ClientOptions clientOptions; - - public NewsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public FeaturesDto getNews(NewsGetNewsRequest request) { - return getNews(request, null); - } - - public FeaturesDto getNews(NewsGetNewsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/news/features"); - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), FeaturesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java b/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java deleted file mode 100644 index ec1655a..0000000 --- a/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.news.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NewsGetNewsRequest.Builder.class) -public final class NewsGetNewsRequest { - private final Optional version; - - private NewsGetNewsRequest(Optional version) { - this.version = version; - } - - /** - * @return The latest received version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NewsGetNewsRequest && equalTo((NewsGetNewsRequest) other); - } - - private boolean equalTo(NewsGetNewsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return "NewsGetNewsRequest{" + "version: " + version + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(NewsGetNewsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public NewsGetNewsRequest build() { - return new NewsGetNewsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java b/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java deleted file mode 100644 index ac060d1..0000000 --- a/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.squidex.api.resources.notifications; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.notifications.requests.NotificationsGetNotificationsRequest; -import com.squidex.api.types.CommentsDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class NotificationsClient { - protected final ClientOptions clientOptions; - - public NotificationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public CommentsDto getNotifications(String userId, NotificationsGetNotificationsRequest request) { - return getNotifications(userId, request, null); - } - - public CommentsDto getNotifications( - String userId, NotificationsGetNotificationsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(userId) - .addPathSegments("notifications"); - if (request.getVersion().isPresent()) { - _httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteComment(String userId, String commentId) { - deleteComment(userId, commentId, null); - } - - public void deleteComment(String userId, String commentId, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(userId) - .addPathSegments("notifications") - .addPathSegment(commentId) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java b/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java deleted file mode 100644 index 677915d..0000000 --- a/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.squidex.api.resources.notifications.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NotificationsGetNotificationsRequest.Builder.class) -public final class NotificationsGetNotificationsRequest { - private final Optional version; - - private NotificationsGetNotificationsRequest(Optional version) { - this.version = version; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationsGetNotificationsRequest - && equalTo((NotificationsGetNotificationsRequest) other); - } - - private boolean equalTo(NotificationsGetNotificationsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return "NotificationsGetNotificationsRequest{" + "version: " + version + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(NotificationsGetNotificationsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public NotificationsGetNotificationsRequest build() { - return new NotificationsGetNotificationsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/ping/PingClient.java b/src/main/java/com/squidex/api/resources/ping/PingClient.java deleted file mode 100644 index 3437d03..0000000 --- a/src/main/java/com/squidex/api/resources/ping/PingClient.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.squidex.api.resources.ping; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import java.io.IOException; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class PingClient { - protected final ClientOptions clientOptions; - - public PingClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public Map getInfo() { - return getInfo(null); - } - - public Map getInfo(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/info") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getPing() { - getPing(null); - } - - public void getPing(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/ping") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getAppPing() { - getAppPing(null); - } - - public void getAppPing(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/ping") - .addPathSegment(clientOptions.appName()) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/plans/PlansClient.java b/src/main/java/com/squidex/api/resources/plans/PlansClient.java deleted file mode 100644 index 50abfd9..0000000 --- a/src/main/java/com/squidex/api/resources/plans/PlansClient.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.squidex.api.resources.plans; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.ChangePlanDto; -import com.squidex.api.types.PlanChangedDto; -import com.squidex.api.types.PlansDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class PlansClient { - protected final ClientOptions clientOptions; - - public PlansClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public PlansDto getPlans() { - return getPlans(null); - } - - public PlansDto getPlans(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("plans") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlansDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlanChangedDto putPlan(ChangePlanDto request) { - return putPlan(request, null); - } - - public PlanChangedDto putPlan(ChangePlanDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("plan") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlanChangedDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlansDto getTeamPlans(String team) { - return getTeamPlans(team, null); - } - - public PlansDto getTeamPlans(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("plans") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlansDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlanChangedDto putTeamPlan(String team, ChangePlanDto request) { - return putTeamPlan(team, request, null); - } - - public PlanChangedDto putTeamPlan(String team, ChangePlanDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("plan") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlanChangedDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/RulesClient.java b/src/main/java/com/squidex/api/resources/rules/RulesClient.java deleted file mode 100644 index 7d99939..0000000 --- a/src/main/java/com/squidex/api/resources/rules/RulesClient.java +++ /dev/null @@ -1,659 +0,0 @@ -package com.squidex.api.resources.rules; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.rules.requests.RulesGetEventsRequest; -import com.squidex.api.resources.rules.requests.RulesPutRuleRunRequest; -import com.squidex.api.resources.rules.requests.UpdateRuleDto; -import com.squidex.api.types.CreateRuleDto; -import com.squidex.api.types.RuleDto; -import com.squidex.api.types.RuleElementDto; -import com.squidex.api.types.RuleEventsDto; -import com.squidex.api.types.RulesDto; -import com.squidex.api.types.SimulatedRuleEventsDto; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class RulesClient { - protected final ClientOptions clientOptions; - - public RulesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public Map getActions() { - return getActions(null); - } - - public Map getActions(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/actions") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RulesDto getRules() { - return getRules(null); - } - - public RulesDto getRules(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RulesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto postRule(CreateRuleDto request) { - return postRule(request, null); - } - - public RuleDto postRule(CreateRuleDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRuleRun() { - deleteRuleRun(null); - } - - public void deleteRuleRun(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/run") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto putRule(String id, UpdateRuleDto request) { - return putRule(id, request, null); - } - - public RuleDto putRule(String id, UpdateRuleDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getName().isPresent()) { - _requestBodyProperties.put("name", request.getName()); - } - if (request.getTrigger().isPresent()) { - _requestBodyProperties.put("trigger", request.getTrigger()); - } - if (request.getAction().isPresent()) { - _requestBodyProperties.put("action", request.getAction()); - } - if (request.getIsEnabled().isPresent()) { - _requestBodyProperties.put("isEnabled", request.getIsEnabled()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRule(String id) { - deleteRule(id, null); - } - - public void deleteRule(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto enableRule(String id) { - return enableRule(id, null); - } - - public RuleDto enableRule(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("enable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto disableRule(String id) { - return disableRule(id, null); - } - - public RuleDto disableRule(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("disable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void triggerRule(String id) { - triggerRule(id, null); - } - - public void triggerRule(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("trigger") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putRuleRun(String id, RulesPutRuleRunRequest request) { - putRuleRun(id, request, null); - } - - public void putRuleRun(String id, RulesPutRuleRunRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("run"); - if (request.getFromSnapshots().isPresent()) { - _httpUrl.addQueryParameter( - "fromSnapshots", request.getFromSnapshots().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRuleEvents(String id) { - deleteRuleEvents(id, null); - } - - public void deleteRuleEvents(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("events") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SimulatedRuleEventsDto simulatePost(CreateRuleDto request) { - return simulatePost(request, null); - } - - public SimulatedRuleEventsDto simulatePost(CreateRuleDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/simulate") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SimulatedRuleEventsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SimulatedRuleEventsDto simulateGet(String id) { - return simulateGet(id, null); - } - - public SimulatedRuleEventsDto simulateGet(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("simulate") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SimulatedRuleEventsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleEventsDto getEvents(RulesGetEventsRequest request) { - return getEvents(request, null); - } - - public RuleEventsDto getEvents(RulesGetEventsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events"); - if (request.getRuleId().isPresent()) { - _httpUrl.addQueryParameter("ruleId", request.getRuleId().get()); - } - if (request.getSkip().isPresent()) { - _httpUrl.addQueryParameter("skip", request.getSkip().get().toString()); - } - if (request.getTake().isPresent()) { - _httpUrl.addQueryParameter("take", request.getTake().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleEventsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteEvents() { - deleteEvents(null); - } - - public void deleteEvents(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putEvent(String id) { - putEvent(id, null); - } - - public void putEvent(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteEvent(String id) { - deleteEvent(id, null); - } - - public void deleteEvent(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getEventTypes() { - return getEventTypes(null); - } - - public List getEventTypes(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/eventtypes") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Object getEventSchema(String type) { - return getEventSchema(type, null); - } - - public Object getEventSchema(String type, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/eventtypes") - .addPathSegment(type) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java b/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java deleted file mode 100644 index 36731dd..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesGetEventsRequest.Builder.class) -public final class RulesGetEventsRequest { - private final Optional ruleId; - - private final Optional skip; - - private final Optional take; - - private RulesGetEventsRequest(Optional ruleId, Optional skip, Optional take) { - this.ruleId = ruleId; - this.skip = skip; - this.take = take; - } - - /** - * @return The optional rule id to filter to events. - */ - @JsonProperty("ruleId") - public Optional getRuleId() { - return ruleId; - } - - /** - * @return The number of events to skip. - */ - @JsonProperty("skip") - public Optional getSkip() { - return skip; - } - - /** - * @return The number of events to take. - */ - @JsonProperty("take") - public Optional getTake() { - return take; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesGetEventsRequest && equalTo((RulesGetEventsRequest) other); - } - - private boolean equalTo(RulesGetEventsRequest other) { - return ruleId.equals(other.ruleId) && skip.equals(other.skip) && take.equals(other.take); - } - - @Override - public int hashCode() { - return Objects.hash(this.ruleId, this.skip, this.take); - } - - @Override - public String toString() { - return "RulesGetEventsRequest{" + "ruleId: " + ruleId + ", skip: " + skip + ", take: " + take + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional ruleId = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional take = Optional.empty(); - - private Builder() {} - - public Builder from(RulesGetEventsRequest other) { - ruleId(other.getRuleId()); - skip(other.getSkip()); - take(other.getTake()); - return this; - } - - @JsonSetter(value = "ruleId", nulls = Nulls.SKIP) - public Builder ruleId(Optional ruleId) { - this.ruleId = ruleId; - return this; - } - - public Builder ruleId(String ruleId) { - this.ruleId = Optional.of(ruleId); - return this; - } - - @JsonSetter(value = "skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Integer skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "take", nulls = Nulls.SKIP) - public Builder take(Optional take) { - this.take = take; - return this; - } - - public Builder take(Integer take) { - this.take = Optional.of(take); - return this; - } - - public RulesGetEventsRequest build() { - return new RulesGetEventsRequest(ruleId, skip, take); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java b/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java deleted file mode 100644 index 403ddfe..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesPutRuleRunRequest.Builder.class) -public final class RulesPutRuleRunRequest { - private final Optional fromSnapshots; - - private RulesPutRuleRunRequest(Optional fromSnapshots) { - this.fromSnapshots = fromSnapshots; - } - - /** - * @return Runs the rule from snapeshots if possible. - */ - @JsonProperty("fromSnapshots") - public Optional getFromSnapshots() { - return fromSnapshots; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesPutRuleRunRequest && equalTo((RulesPutRuleRunRequest) other); - } - - private boolean equalTo(RulesPutRuleRunRequest other) { - return fromSnapshots.equals(other.fromSnapshots); - } - - @Override - public int hashCode() { - return Objects.hash(this.fromSnapshots); - } - - @Override - public String toString() { - return "RulesPutRuleRunRequest{" + "fromSnapshots: " + fromSnapshots + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fromSnapshots = Optional.empty(); - - private Builder() {} - - public Builder from(RulesPutRuleRunRequest other) { - fromSnapshots(other.getFromSnapshots()); - return this; - } - - @JsonSetter(value = "fromSnapshots", nulls = Nulls.SKIP) - public Builder fromSnapshots(Optional fromSnapshots) { - this.fromSnapshots = fromSnapshots; - return this; - } - - public Builder fromSnapshots(Boolean fromSnapshots) { - this.fromSnapshots = Optional.of(fromSnapshots); - return this; - } - - public RulesPutRuleRunRequest build() { - return new RulesPutRuleRunRequest(fromSnapshots); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java b/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java deleted file mode 100644 index 4abaa55..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.RuleActionDto; -import com.squidex.api.types.RuleTriggerDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateRuleDto.Builder.class) -public final class UpdateRuleDto { - private final Optional name; - - private final Optional trigger; - - private final Optional action; - - private final Optional isEnabled; - - private UpdateRuleDto( - Optional name, - Optional trigger, - Optional action, - Optional isEnabled) { - this.name = name; - this.trigger = trigger; - this.action = action; - this.isEnabled = isEnabled; - } - - /** - * @return Optional rule name. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("trigger") - public Optional getTrigger() { - return trigger; - } - - @JsonProperty("action") - public Optional getAction() { - return action; - } - - /** - * @return Enable or disable the rule. - */ - @JsonProperty("isEnabled") - public Optional getIsEnabled() { - return isEnabled; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateRuleDto && equalTo((UpdateRuleDto) other); - } - - private boolean equalTo(UpdateRuleDto other) { - return name.equals(other.name) - && trigger.equals(other.trigger) - && action.equals(other.action) - && isEnabled.equals(other.isEnabled); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.trigger, this.action, this.isEnabled); - } - - @Override - public String toString() { - return "UpdateRuleDto{" + "name: " + name + ", trigger: " + trigger + ", action: " + action + ", isEnabled: " - + isEnabled + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Optional trigger = Optional.empty(); - - private Optional action = Optional.empty(); - - private Optional isEnabled = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateRuleDto other) { - name(other.getName()); - trigger(other.getTrigger()); - action(other.getAction()); - isEnabled(other.getIsEnabled()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - @JsonSetter(value = "trigger", nulls = Nulls.SKIP) - public Builder trigger(Optional trigger) { - this.trigger = trigger; - return this; - } - - public Builder trigger(RuleTriggerDto trigger) { - this.trigger = Optional.of(trigger); - return this; - } - - @JsonSetter(value = "action", nulls = Nulls.SKIP) - public Builder action(Optional action) { - this.action = action; - return this; - } - - public Builder action(RuleActionDto action) { - this.action = Optional.of(action); - return this; - } - - @JsonSetter(value = "isEnabled", nulls = Nulls.SKIP) - public Builder isEnabled(Optional isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - public Builder isEnabled(Boolean isEnabled) { - this.isEnabled = Optional.of(isEnabled); - return this; - } - - public UpdateRuleDto build() { - return new UpdateRuleDto(name, trigger, action, isEnabled); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java b/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java deleted file mode 100644 index b5838f1..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java +++ /dev/null @@ -1,1219 +0,0 @@ -package com.squidex.api.resources.schemas; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.schemas.requests.ChangeCategoryDto; -import com.squidex.api.resources.schemas.requests.ConfigureFieldRulesDto; -import com.squidex.api.resources.schemas.requests.ConfigureUiFieldsDto; -import com.squidex.api.resources.schemas.requests.CreateSchemaDto; -import com.squidex.api.resources.schemas.requests.SynchronizeSchemaDto; -import com.squidex.api.resources.schemas.requests.UpdateSchemaDto; -import com.squidex.api.types.AddFieldDto; -import com.squidex.api.types.ReorderFieldsDto; -import com.squidex.api.types.SchemaDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.SchemasDto; -import com.squidex.api.types.UpdateFieldDto; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class SchemasClient { - protected final ClientOptions clientOptions; - - public SchemasClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public SchemaDto postField(String schema, AddFieldDto request) { - return postField(schema, request, null); - } - - public SchemaDto postField(String schema, AddFieldDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto postNestedField(String schema, int parentId, AddFieldDto request) { - return postNestedField(schema, parentId, request, null); - } - - public SchemaDto postNestedField(String schema, int parentId, AddFieldDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaUiFields(String schema, ConfigureUiFieldsDto request) { - return putSchemaUiFields(schema, request, null); - } - - public SchemaDto putSchemaUiFields(String schema, ConfigureUiFieldsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields/ui") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getFieldsInLists().isPresent()) { - _requestBodyProperties.put("fieldsInLists", request.getFieldsInLists()); - } - if (request.getFieldsInReferences().isPresent()) { - _requestBodyProperties.put("fieldsInReferences", request.getFieldsInReferences()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaFieldOrdering(String schema, ReorderFieldsDto request) { - return putSchemaFieldOrdering(schema, request, null); - } - - public SchemaDto putSchemaFieldOrdering(String schema, ReorderFieldsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields/ordering") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putNestedFieldOrdering(String schema, int parentId, ReorderFieldsDto request) { - return putNestedFieldOrdering(schema, parentId, request, null); - } - - public SchemaDto putNestedFieldOrdering( - String schema, int parentId, ReorderFieldsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested/ordering") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putField(String schema, int id, UpdateFieldDto request) { - return putField(schema, id, request, null); - } - - public SchemaDto putField(String schema, int id, UpdateFieldDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto deleteField(String schema, int id) { - return deleteField(schema, id, null); - } - - public SchemaDto deleteField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putNestedField(String schema, int parentId, int id, UpdateFieldDto request) { - return putNestedField(schema, parentId, id, request, null); - } - - public SchemaDto putNestedField( - String schema, int parentId, int id, UpdateFieldDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto deleteNestedField(String schema, int parentId, int id) { - return deleteNestedField(schema, parentId, id, null); - } - - public SchemaDto deleteNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto lockField(String schema, int id) { - return lockField(schema, id, null); - } - - public SchemaDto lockField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("lock") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto lockNestedField(String schema, int parentId, int id) { - return lockNestedField(schema, parentId, id, null); - } - - public SchemaDto lockNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("lock") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto hideField(String schema, int id) { - return hideField(schema, id, null); - } - - public SchemaDto hideField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("hide") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto hideNestedField(String schema, int parentId, int id) { - return hideNestedField(schema, parentId, id, null); - } - - public SchemaDto hideNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("hide") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto showField(String schema, int id) { - return showField(schema, id, null); - } - - public SchemaDto showField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("show") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto showNestedField(String schema, int parentId, int id) { - return showNestedField(schema, parentId, id, null); - } - - public SchemaDto showNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("show") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto enableField(String schema, int id) { - return enableField(schema, id, null); - } - - public SchemaDto enableField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("enable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto enableNestedField(String schema, int parentId, int id) { - return enableNestedField(schema, parentId, id, null); - } - - public SchemaDto enableNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("enable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto disableField(String schema, int id) { - return disableField(schema, id, null); - } - - public SchemaDto disableField(String schema, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("disable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto disableNestedField(String schema, int parentId, int id) { - return disableNestedField(schema, parentId, id, null); - } - - public SchemaDto disableNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("disable") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemasDto getSchemas() { - return getSchemas(null); - } - - public SchemasDto getSchemas(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemasDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto postSchema(CreateSchemaDto request) { - return postSchema(request, null); - } - - public SchemaDto postSchema(CreateSchemaDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - if (request.getType().isPresent()) { - _requestBodyProperties.put("type", request.getType()); - } - if (request.getIsSingleton().isPresent()) { - _requestBodyProperties.put("isSingleton", request.getIsSingleton()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto getSchema(String schema) { - return getSchema(schema, null); - } - - public SchemaDto getSchema(String schema, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchema(String schema, UpdateSchemaDto request) { - return putSchema(schema, request, null); - } - - public SchemaDto putSchema(String schema, UpdateSchemaDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getLabel().isPresent()) { - _requestBodyProperties.put("label", request.getLabel()); - } - if (request.getHints().isPresent()) { - _requestBodyProperties.put("hints", request.getHints()); - } - if (request.getContentsSidebarUrl().isPresent()) { - _requestBodyProperties.put("contentsSidebarUrl", request.getContentsSidebarUrl()); - } - if (request.getContentSidebarUrl().isPresent()) { - _requestBodyProperties.put("contentSidebarUrl", request.getContentSidebarUrl()); - } - if (request.getContentEditorUrl().isPresent()) { - _requestBodyProperties.put("contentEditorUrl", request.getContentEditorUrl()); - } - if (request.getValidateOnPublish().isPresent()) { - _requestBodyProperties.put("validateOnPublish", request.getValidateOnPublish()); - } - if (request.getTags().isPresent()) { - _requestBodyProperties.put("tags", request.getTags()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteSchema(String schema) { - deleteSchema(schema, null); - } - - public void deleteSchema(String schema, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaSync(String schema, SynchronizeSchemaDto request) { - return putSchemaSync(schema, request, null); - } - - public SchemaDto putSchemaSync(String schema, SynchronizeSchemaDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("sync") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getNoFieldDeletion().isPresent()) { - _requestBodyProperties.put("noFieldDeletion", request.getNoFieldDeletion()); - } - if (request.getNoFieldRecreation().isPresent()) { - _requestBodyProperties.put("noFieldRecreation", request.getNoFieldRecreation()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putCategory(String schema, ChangeCategoryDto request) { - return putCategory(schema, request, null); - } - - public SchemaDto putCategory(String schema, ChangeCategoryDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("category") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getName().isPresent()) { - _requestBodyProperties.put("name", request.getName()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putPreviewUrls(String schema, Map request) { - return putPreviewUrls(schema, request, null); - } - - public SchemaDto putPreviewUrls(String schema, Map request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("preview-urls") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putScripts(String schema, SchemaScriptsDto request) { - return putScripts(schema, request, null); - } - - public SchemaDto putScripts(String schema, SchemaScriptsDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("scripts") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putRules(String schema, ConfigureFieldRulesDto request) { - return putRules(schema, request, null); - } - - public SchemaDto putRules(String schema, ConfigureFieldRulesDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("rules") - .build(); - Map _requestBodyProperties = new HashMap<>(); - if (request.getFieldRules().isPresent()) { - _requestBodyProperties.put("fieldRules", request.getFieldRules()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto publishSchema(String schema) { - return publishSchema(schema, null); - } - - public SchemaDto publishSchema(String schema, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("publish") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto unpublishSchema(String schema) { - return unpublishSchema(schema, null); - } - - public SchemaDto unpublishSchema(String schema, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("unpublish") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java deleted file mode 100644 index 8e5ad6e..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangeCategoryDto.Builder.class) -public final class ChangeCategoryDto { - private final Optional name; - - private ChangeCategoryDto(Optional name) { - this.name = name; - } - - /** - * @return The name of the category. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangeCategoryDto && equalTo((ChangeCategoryDto) other); - } - - private boolean equalTo(ChangeCategoryDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return "ChangeCategoryDto{" + "name: " + name + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Builder() {} - - public Builder from(ChangeCategoryDto other) { - name(other.getName()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - public ChangeCategoryDto build() { - return new ChangeCategoryDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java deleted file mode 100644 index 342e4c0..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.FieldRuleDto; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ConfigureFieldRulesDto.Builder.class) -public final class ConfigureFieldRulesDto { - private final Optional> fieldRules; - - private ConfigureFieldRulesDto(Optional> fieldRules) { - this.fieldRules = fieldRules; - } - - /** - * @return The field rules to configure. - */ - @JsonProperty("fieldRules") - public Optional> getFieldRules() { - return fieldRules; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ConfigureFieldRulesDto && equalTo((ConfigureFieldRulesDto) other); - } - - private boolean equalTo(ConfigureFieldRulesDto other) { - return fieldRules.equals(other.fieldRules); - } - - @Override - public int hashCode() { - return Objects.hash(this.fieldRules); - } - - @Override - public String toString() { - return "ConfigureFieldRulesDto{" + "fieldRules: " + fieldRules + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> fieldRules = Optional.empty(); - - private Builder() {} - - public Builder from(ConfigureFieldRulesDto other) { - fieldRules(other.getFieldRules()); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - public ConfigureFieldRulesDto build() { - return new ConfigureFieldRulesDto(fieldRules); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java deleted file mode 100644 index 3b9e1cf..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ConfigureUiFieldsDto.Builder.class) -public final class ConfigureUiFieldsDto { - private final Optional> fieldsInLists; - - private final Optional> fieldsInReferences; - - private ConfigureUiFieldsDto(Optional> fieldsInLists, Optional> fieldsInReferences) { - this.fieldsInLists = fieldsInLists; - this.fieldsInReferences = fieldsInReferences; - } - - /** - * @return The name of fields that are used in content lists. - */ - @JsonProperty("fieldsInLists") - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return The name of fields that are used in content references. - */ - @JsonProperty("fieldsInReferences") - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ConfigureUiFieldsDto && equalTo((ConfigureUiFieldsDto) other); - } - - private boolean equalTo(ConfigureUiFieldsDto other) { - return fieldsInLists.equals(other.fieldsInLists) && fieldsInReferences.equals(other.fieldsInReferences); - } - - @Override - public int hashCode() { - return Objects.hash(this.fieldsInLists, this.fieldsInReferences); - } - - @Override - public String toString() { - return "ConfigureUiFieldsDto{" + "fieldsInLists: " + fieldsInLists + ", fieldsInReferences: " - + fieldsInReferences + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Builder() {} - - public Builder from(ConfigureUiFieldsDto other) { - fieldsInLists(other.getFieldsInLists()); - fieldsInReferences(other.getFieldsInReferences()); - return this; - } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - public ConfigureUiFieldsDto build() { - return new ConfigureUiFieldsDto(fieldsInLists, fieldsInReferences); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java deleted file mode 100644 index 772ac07..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java +++ /dev/null @@ -1,522 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.FieldRuleDto; -import com.squidex.api.types.IUpsertSchemaDto; -import com.squidex.api.types.SchemaPropertiesDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.SchemaType; -import com.squidex.api.types.UpsertSchemaFieldDto; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateSchemaDto.Builder.class) -public final class CreateSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private final String name; - - private final Optional type; - - private final Optional isSingleton; - - private CreateSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished, - String name, - Optional type, - Optional isSingleton) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - this.name = name; - this.type = type; - this.isSingleton = isSingleton; - } - - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; - } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; - } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; - } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; - } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; - } - - /** - * @return The name of the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return Set to true to allow a single content item only. - */ - @JsonProperty("isSingleton") - public Optional getIsSingleton() { - return isSingleton; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateSchemaDto && equalTo((CreateSchemaDto) other); - } - - private boolean equalTo(CreateSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished) - && name.equals(other.name) - && type.equals(other.type) - && isSingleton.equals(other.isSingleton); - } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished, - this.name, - this.type, - this.isSingleton); - } - - @Override - public String toString() { - return "CreateSchemaDto{" + "properties: " + properties + ", scripts: " + scripts + ", fieldsInReferences: " - + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " + fields + ", previewUrls: " - + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category + ", isPublished: " - + isPublished + ", name: " + name + ", type: " + type + ", isSingleton: " + isSingleton + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateSchemaDto other); - } - - public interface _FinalStage { - CreateSchemaDto build(); - - _FinalStage properties(Optional properties); - - _FinalStage properties(SchemaPropertiesDto properties); - - _FinalStage scripts(Optional scripts); - - _FinalStage scripts(SchemaScriptsDto scripts); - - _FinalStage fieldsInReferences(Optional> fieldsInReferences); - - _FinalStage fieldsInReferences(List fieldsInReferences); - - _FinalStage fieldsInLists(Optional> fieldsInLists); - - _FinalStage fieldsInLists(List fieldsInLists); - - _FinalStage fields(Optional> fields); - - _FinalStage fields(List fields); - - _FinalStage previewUrls(Optional>> previewUrls); - - _FinalStage previewUrls(Map> previewUrls); - - _FinalStage fieldRules(Optional> fieldRules); - - _FinalStage fieldRules(List fieldRules); - - _FinalStage category(Optional category); - - _FinalStage category(String category); - - _FinalStage isPublished(Optional isPublished); - - _FinalStage isPublished(Boolean isPublished); - - _FinalStage type(Optional type); - - _FinalStage type(SchemaType type); - - _FinalStage isSingleton(Optional isSingleton); - - _FinalStage isSingleton(Boolean isSingleton); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Optional isSingleton = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional properties = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - name(other.getName()); - type(other.getType()); - isSingleton(other.getIsSingleton()); - return this; - } - - /** - *

The name of the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

Set to true to allow a single content item only.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isSingleton(Boolean isSingleton) { - this.isSingleton = Optional.of(isSingleton); - return this; - } - - @Override - @JsonSetter(value = "isSingleton", nulls = Nulls.SKIP) - public _FinalStage isSingleton(Optional isSingleton) { - this.isSingleton = isSingleton; - return this; - } - - @Override - public _FinalStage type(SchemaType type) { - this.type = Optional.of(type); - return this; - } - - @Override - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public _FinalStage type(Optional type) { - this.type = type; - return this; - } - - /** - *

Set it to true to autopublish the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - @Override - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public _FinalStage isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - /** - *

The category.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(String category) { - this.category = Optional.of(category); - return this; - } - - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; - } - - /** - *

The optional field Rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @Override - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public _FinalStage fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - /** - *

The optional preview urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @Override - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public _FinalStage previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - /** - *

Optional fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @Override - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public _FinalStage fields(Optional> fields) { - this.fields = fields; - return this; - } - - /** - *

The names of the fields that should be shown in lists, including meta fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @Override - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public _FinalStage fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - /** - *

The names of the fields that should be used in references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - @Override - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public _FinalStage fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - @Override - public _FinalStage scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @Override - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public _FinalStage scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - @Override - public _FinalStage properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(Optional properties) { - this.properties = properties; - return this; - } - - @Override - public CreateSchemaDto build() { - return new CreateSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished, - name, - type, - isSingleton); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java deleted file mode 100644 index a166bff..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java +++ /dev/null @@ -1,386 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.types.FieldRuleDto; -import com.squidex.api.types.IUpsertSchemaDto; -import com.squidex.api.types.SchemaPropertiesDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.UpsertSchemaFieldDto; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SynchronizeSchemaDto.Builder.class) -public final class SynchronizeSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private final Optional noFieldDeletion; - - private final Optional noFieldRecreation; - - private SynchronizeSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished, - Optional noFieldDeletion, - Optional noFieldRecreation) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - this.noFieldDeletion = noFieldDeletion; - this.noFieldRecreation = noFieldRecreation; - } - - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; - } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; - } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; - } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; - } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; - } - - /** - * @return True, when fields should not be deleted. - */ - @JsonProperty("noFieldDeletion") - public Optional getNoFieldDeletion() { - return noFieldDeletion; - } - - /** - * @return True, when fields with different types should not be recreated. - */ - @JsonProperty("noFieldRecreation") - public Optional getNoFieldRecreation() { - return noFieldRecreation; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SynchronizeSchemaDto && equalTo((SynchronizeSchemaDto) other); - } - - private boolean equalTo(SynchronizeSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished) - && noFieldDeletion.equals(other.noFieldDeletion) - && noFieldRecreation.equals(other.noFieldRecreation); - } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished, - this.noFieldDeletion, - this.noFieldRecreation); - } - - @Override - public String toString() { - return "SynchronizeSchemaDto{" + "properties: " + properties + ", scripts: " + scripts - + ", fieldsInReferences: " + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " - + fields + ", previewUrls: " + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category - + ", isPublished: " + isPublished + ", noFieldDeletion: " + noFieldDeletion + ", noFieldRecreation: " - + noFieldRecreation + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional properties = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Optional noFieldDeletion = Optional.empty(); - - private Optional noFieldRecreation = Optional.empty(); - - private Builder() {} - - public Builder from(SynchronizeSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - noFieldDeletion(other.getNoFieldDeletion()); - noFieldRecreation(other.getNoFieldRecreation()); - return this; - } - - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional properties) { - this.properties = properties; - return this; - } - - public Builder properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public Builder scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - public Builder scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public Builder fields(Optional> fields) { - this.fields = fields; - return this; - } - - public Builder fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public Builder previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - public Builder previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { - this.category = category; - return this; - } - - public Builder category(String category) { - this.category = Optional.of(category); - return this; - } - - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public Builder isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - public Builder isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - @JsonSetter(value = "noFieldDeletion", nulls = Nulls.SKIP) - public Builder noFieldDeletion(Optional noFieldDeletion) { - this.noFieldDeletion = noFieldDeletion; - return this; - } - - public Builder noFieldDeletion(Boolean noFieldDeletion) { - this.noFieldDeletion = Optional.of(noFieldDeletion); - return this; - } - - @JsonSetter(value = "noFieldRecreation", nulls = Nulls.SKIP) - public Builder noFieldRecreation(Optional noFieldRecreation) { - this.noFieldRecreation = noFieldRecreation; - return this; - } - - public Builder noFieldRecreation(Boolean noFieldRecreation) { - this.noFieldRecreation = Optional.of(noFieldRecreation); - return this; - } - - public SynchronizeSchemaDto build() { - return new SynchronizeSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished, - noFieldDeletion, - noFieldRecreation); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java deleted file mode 100644 index 68eac75..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java +++ /dev/null @@ -1,253 +0,0 @@ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateSchemaDto.Builder.class) -public final class UpdateSchemaDto { - private final Optional label; - - private final Optional hints; - - private final Optional contentsSidebarUrl; - - private final Optional contentSidebarUrl; - - private final Optional contentEditorUrl; - - private final Optional validateOnPublish; - - private final Optional> tags; - - private UpdateSchemaDto( - Optional label, - Optional hints, - Optional contentsSidebarUrl, - Optional contentSidebarUrl, - Optional contentEditorUrl, - Optional validateOnPublish, - Optional> tags) { - this.label = label; - this.hints = hints; - this.contentsSidebarUrl = contentsSidebarUrl; - this.contentSidebarUrl = contentSidebarUrl; - this.contentEditorUrl = contentEditorUrl; - this.validateOnPublish = validateOnPublish; - this.tags = tags; - } - - /** - * @return Optional label for the editor. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return Hints to describe the schema. - */ - @JsonProperty("hints") - public Optional getHints() { - return hints; - } - - /** - * @return The url to a the sidebar plugin for content lists. - */ - @JsonProperty("contentsSidebarUrl") - public Optional getContentsSidebarUrl() { - return contentsSidebarUrl; - } - - /** - * @return The url to a the sidebar plugin for content items. - */ - @JsonProperty("contentSidebarUrl") - public Optional getContentSidebarUrl() { - return contentSidebarUrl; - } - - /** - * @return The url to the editor plugin. - */ - @JsonProperty("contentEditorUrl") - public Optional getContentEditorUrl() { - return contentEditorUrl; - } - - /** - * @return True to validate the content items on publish. - */ - @JsonProperty("validateOnPublish") - public Optional getValidateOnPublish() { - return validateOnPublish; - } - - /** - * @return Tags for automation processes. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSchemaDto && equalTo((UpdateSchemaDto) other); - } - - private boolean equalTo(UpdateSchemaDto other) { - return label.equals(other.label) - && hints.equals(other.hints) - && contentsSidebarUrl.equals(other.contentsSidebarUrl) - && contentSidebarUrl.equals(other.contentSidebarUrl) - && contentEditorUrl.equals(other.contentEditorUrl) - && validateOnPublish.equals(other.validateOnPublish) - && tags.equals(other.tags); - } - - @Override - public int hashCode() { - return Objects.hash( - this.label, - this.hints, - this.contentsSidebarUrl, - this.contentSidebarUrl, - this.contentEditorUrl, - this.validateOnPublish, - this.tags); - } - - @Override - public String toString() { - return "UpdateSchemaDto{" + "label: " + label + ", hints: " + hints + ", contentsSidebarUrl: " - + contentsSidebarUrl + ", contentSidebarUrl: " + contentSidebarUrl + ", contentEditorUrl: " - + contentEditorUrl + ", validateOnPublish: " + validateOnPublish + ", tags: " + tags + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional label = Optional.empty(); - - private Optional hints = Optional.empty(); - - private Optional contentsSidebarUrl = Optional.empty(); - - private Optional contentSidebarUrl = Optional.empty(); - - private Optional contentEditorUrl = Optional.empty(); - - private Optional validateOnPublish = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateSchemaDto other) { - label(other.getLabel()); - hints(other.getHints()); - contentsSidebarUrl(other.getContentsSidebarUrl()); - contentSidebarUrl(other.getContentSidebarUrl()); - contentEditorUrl(other.getContentEditorUrl()); - validateOnPublish(other.getValidateOnPublish()); - tags(other.getTags()); - return this; - } - - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public Builder label(Optional label) { - this.label = label; - return this; - } - - public Builder label(String label) { - this.label = Optional.of(label); - return this; - } - - @JsonSetter(value = "hints", nulls = Nulls.SKIP) - public Builder hints(Optional hints) { - this.hints = hints; - return this; - } - - public Builder hints(String hints) { - this.hints = Optional.of(hints); - return this; - } - - @JsonSetter(value = "contentsSidebarUrl", nulls = Nulls.SKIP) - public Builder contentsSidebarUrl(Optional contentsSidebarUrl) { - this.contentsSidebarUrl = contentsSidebarUrl; - return this; - } - - public Builder contentsSidebarUrl(String contentsSidebarUrl) { - this.contentsSidebarUrl = Optional.of(contentsSidebarUrl); - return this; - } - - @JsonSetter(value = "contentSidebarUrl", nulls = Nulls.SKIP) - public Builder contentSidebarUrl(Optional contentSidebarUrl) { - this.contentSidebarUrl = contentSidebarUrl; - return this; - } - - public Builder contentSidebarUrl(String contentSidebarUrl) { - this.contentSidebarUrl = Optional.of(contentSidebarUrl); - return this; - } - - @JsonSetter(value = "contentEditorUrl", nulls = Nulls.SKIP) - public Builder contentEditorUrl(Optional contentEditorUrl) { - this.contentEditorUrl = contentEditorUrl; - return this; - } - - public Builder contentEditorUrl(String contentEditorUrl) { - this.contentEditorUrl = Optional.of(contentEditorUrl); - return this; - } - - @JsonSetter(value = "validateOnPublish", nulls = Nulls.SKIP) - public Builder validateOnPublish(Optional validateOnPublish) { - this.validateOnPublish = validateOnPublish; - return this; - } - - public Builder validateOnPublish(Boolean validateOnPublish) { - this.validateOnPublish = Optional.of(validateOnPublish); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - public UpdateSchemaDto build() { - return new UpdateSchemaDto( - label, hints, contentsSidebarUrl, contentSidebarUrl, contentEditorUrl, validateOnPublish, tags); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/search/SearchClient.java b/src/main/java/com/squidex/api/resources/search/SearchClient.java deleted file mode 100644 index e08b4d9..0000000 --- a/src/main/java/com/squidex/api/resources/search/SearchClient.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.squidex.api.resources.search; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.search.requests.SearchGetSearchResultsRequest; -import com.squidex.api.types.SearchResultDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class SearchClient { - protected final ClientOptions clientOptions; - - public SearchClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getSearchResults(SearchGetSearchResultsRequest request) { - return getSearchResults(request, null); - } - - public List getSearchResults( - SearchGetSearchResultsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("search"); - if (request.getQuery().isPresent()) { - _httpUrl.addQueryParameter("query", request.getQuery().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java b/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java deleted file mode 100644 index b09f277..0000000 --- a/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.search.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SearchGetSearchResultsRequest.Builder.class) -public final class SearchGetSearchResultsRequest { - private final Optional query; - - private SearchGetSearchResultsRequest(Optional query) { - this.query = query; - } - - /** - * @return The search query. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SearchGetSearchResultsRequest && equalTo((SearchGetSearchResultsRequest) other); - } - - private boolean equalTo(SearchGetSearchResultsRequest other) { - return query.equals(other.query); - } - - @Override - public int hashCode() { - return Objects.hash(this.query); - } - - @Override - public String toString() { - return "SearchGetSearchResultsRequest{" + "query: " + query + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Builder() {} - - public Builder from(SearchGetSearchResultsRequest other) { - query(other.getQuery()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - public SearchGetSearchResultsRequest build() { - return new SearchGetSearchResultsRequest(query); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java b/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java deleted file mode 100644 index 281578c..0000000 --- a/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.squidex.api.resources.statistics; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.CallsUsageDtoDto; -import com.squidex.api.types.CurrentStorageDto; -import com.squidex.api.types.LogDownloadDto; -import com.squidex.api.types.StorageUsagePerDateDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class StatisticsClient { - protected final ClientOptions clientOptions; - - public StatisticsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public LogDownloadDto getLog() { - return getLog(null); - } - - public LogDownloadDto getLog(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/log") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), LogDownloadDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CallsUsageDtoDto getUsages(String fromDate, String toDate) { - return getUsages(fromDate, toDate, null); - } - - public CallsUsageDtoDto getUsages(String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/calls") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CallsUsageDtoDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CallsUsageDtoDto getUsagesForTeam(String team, String fromDate, String toDate) { - return getUsagesForTeam(team, fromDate, toDate, null); - } - - public CallsUsageDtoDto getUsagesForTeam( - String team, String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/calls") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CallsUsageDtoDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CurrentStorageDto getCurrentStorageSize() { - return getCurrentStorageSize(null); - } - - public CurrentStorageDto getCurrentStorageSize(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/storage/today") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CurrentStorageDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CurrentStorageDto getTeamCurrentStorageSizeForTeam(String team) { - return getTeamCurrentStorageSizeForTeam(team, null); - } - - public CurrentStorageDto getTeamCurrentStorageSizeForTeam(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/storage/today") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CurrentStorageDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getStorageSizes(String fromDate, String toDate) { - return getStorageSizes(fromDate, toDate, null); - } - - public List getStorageSizes(String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/storage") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getStorageSizesForTeam(String team, String fromDate, String toDate) { - return getStorageSizesForTeam(team, fromDate, toDate, null); - } - - public List getStorageSizesForTeam( - String team, String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/storage") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/TeamsClient.java b/src/main/java/com/squidex/api/resources/teams/TeamsClient.java deleted file mode 100644 index 4712232..0000000 --- a/src/main/java/com/squidex/api/resources/teams/TeamsClient.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.squidex.api.resources.teams; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.teams.requests.CreateTeamDto; -import com.squidex.api.resources.teams.requests.UpdateTeamDto; -import com.squidex.api.types.AssignContributorDto; -import com.squidex.api.types.ContributorsDto; -import com.squidex.api.types.TeamDto; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class TeamsClient { - protected final ClientOptions clientOptions; - - public TeamsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public ContributorsDto getContributors(String team) { - return getContributors(team, null); - } - - public ContributorsDto getContributors(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto postContributor(String team, AssignContributorDto request) { - return postContributor(team, request, null); - } - - public ContributorsDto postContributor(String team, AssignContributorDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .build(); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request _request = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteMyself(String team) { - return deleteMyself(team, null); - } - - public ContributorsDto deleteMyself(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors/me") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteContributor(String team, String id) { - return deleteContributor(team, id, null); - } - - public ContributorsDto deleteContributor(String team, String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getTeams() { - return getTeams(null); - } - - public List getTeams(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TeamDto postTeam(CreateTeamDto request) { - return postTeam(request, null); - } - - public TeamDto postTeam(CreateTeamDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TeamDto getTeam(String team) { - return getTeam(team, null); - } - - public TeamDto getTeam(String team, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TeamDto putTeam(String team, UpdateTeamDto request) { - return putTeam(team, request, null); - } - - public TeamDto putTeam(String team, UpdateTeamDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("name", request.getName()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java b/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java deleted file mode 100644 index 1fda985..0000000 --- a/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.teams.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateTeamDto.Builder.class) -public final class CreateTeamDto { - private final String name; - - private CreateTeamDto(String name) { - this.name = name; - } - - /** - * @return The name of the team. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateTeamDto && equalTo((CreateTeamDto) other); - } - - private boolean equalTo(CreateTeamDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return "CreateTeamDto{" + "name: " + name + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateTeamDto other); - } - - public interface _FinalStage { - CreateTeamDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(CreateTeamDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the team. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public CreateTeamDto build() { - return new CreateTeamDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java b/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java deleted file mode 100644 index f9b16d4..0000000 --- a/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.resources.teams.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateTeamDto.Builder.class) -public final class UpdateTeamDto { - private final String name; - - private UpdateTeamDto(String name) { - this.name = name; - } - - /** - * @return The name of the team. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateTeamDto && equalTo((UpdateTeamDto) other); - } - - private boolean equalTo(UpdateTeamDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return "UpdateTeamDto{" + "name: " + name + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(UpdateTeamDto other); - } - - public interface _FinalStage { - UpdateTeamDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(UpdateTeamDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the team. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public UpdateTeamDto build() { - return new UpdateTeamDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java b/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java deleted file mode 100644 index 882f159..0000000 --- a/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.squidex.api.resources.templates; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.TemplateDetailsDto; -import com.squidex.api.types.TemplatesDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class TemplatesClient { - protected final ClientOptions clientOptions; - - public TemplatesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public TemplatesDto getTemplates() { - return getTemplates(null); - } - - public TemplatesDto getTemplates(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/templates") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TemplatesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TemplateDetailsDto getTemplate(String name) { - return getTemplate(name, null); - } - - public TemplateDetailsDto getTemplate(String name, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/templates") - .addPathSegment(name) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TemplateDetailsDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java b/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java deleted file mode 100644 index cf79d4b..0000000 --- a/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.squidex.api.resources.translations; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.translations.requests.TranslateDto; -import com.squidex.api.types.TranslationDto; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class TranslationsClient { - protected final ClientOptions clientOptions; - - public TranslationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public TranslationDto postTranslation(TranslateDto request) { - return postTranslation(request, null); - } - - public TranslationDto postTranslation(TranslateDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("translations") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("text", request.getText()); - _requestBodyProperties.put("targetLanguage", request.getTargetLanguage()); - if (request.getSourceLanguage().isPresent()) { - _requestBodyProperties.put("sourceLanguage", request.getSourceLanguage()); - } - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TranslationDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java b/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java deleted file mode 100644 index 1f0a40a..0000000 --- a/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.squidex.api.resources.translations.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TranslateDto.Builder.class) -public final class TranslateDto { - private final String text; - - private final String targetLanguage; - - private final Optional sourceLanguage; - - private TranslateDto(String text, String targetLanguage, Optional sourceLanguage) { - this.text = text; - this.targetLanguage = targetLanguage; - this.sourceLanguage = sourceLanguage; - } - - /** - * @return The text to translate. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The target language. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("targetLanguage") - public String getTargetLanguage() { - return targetLanguage; - } - - /** - * @return The optional source language. - */ - @JsonProperty("sourceLanguage") - public Optional getSourceLanguage() { - return sourceLanguage; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TranslateDto && equalTo((TranslateDto) other); - } - - private boolean equalTo(TranslateDto other) { - return text.equals(other.text) - && targetLanguage.equals(other.targetLanguage) - && sourceLanguage.equals(other.sourceLanguage); - } - - @Override - public int hashCode() { - return Objects.hash(this.text, this.targetLanguage, this.sourceLanguage); - } - - @Override - public String toString() { - return "TranslateDto{" + "text: " + text + ", targetLanguage: " + targetLanguage + ", sourceLanguage: " - + sourceLanguage + "}"; - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - TargetLanguageStage text(String text); - - Builder from(TranslateDto other); - } - - public interface TargetLanguageStage { - _FinalStage targetLanguage(String targetLanguage); - } - - public interface _FinalStage { - TranslateDto build(); - - _FinalStage sourceLanguage(Optional sourceLanguage); - - _FinalStage sourceLanguage(String sourceLanguage); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, TargetLanguageStage, _FinalStage { - private String text; - - private String targetLanguage; - - private Optional sourceLanguage = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(TranslateDto other) { - text(other.getText()); - targetLanguage(other.getTargetLanguage()); - sourceLanguage(other.getSourceLanguage()); - return this; - } - - /** - *

The text to translate. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public TargetLanguageStage text(String text) { - this.text = text; - return this; - } - - /** - *

The target language. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("targetLanguage") - public _FinalStage targetLanguage(String targetLanguage) { - this.targetLanguage = targetLanguage; - return this; - } - - /** - *

The optional source language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage sourceLanguage(String sourceLanguage) { - this.sourceLanguage = Optional.of(sourceLanguage); - return this; - } - - @Override - @JsonSetter(value = "sourceLanguage", nulls = Nulls.SKIP) - public _FinalStage sourceLanguage(Optional sourceLanguage) { - this.sourceLanguage = sourceLanguage; - return this; - } - - @Override - public TranslateDto build() { - return new TranslateDto(text, targetLanguage, sourceLanguage); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java b/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java deleted file mode 100644 index 9810839..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java +++ /dev/null @@ -1,268 +0,0 @@ -package com.squidex.api.resources.usermanagement; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.usermanagement.requests.CreateUserDto; -import com.squidex.api.resources.usermanagement.requests.UpdateUserDto; -import com.squidex.api.resources.usermanagement.requests.UserManagementGetUsersRequest; -import com.squidex.api.types.UserDto; -import com.squidex.api.types.UsersDto; -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class UserManagementClient { - protected final ClientOptions clientOptions; - - public UserManagementClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public UsersDto getUsers(UserManagementGetUsersRequest request) { - return getUsers(request, null); - } - - public UsersDto getUsers(UserManagementGetUsersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management"); - if (request.getQuery().isPresent()) { - _httpUrl.addQueryParameter("query", request.getQuery().get()); - } - if (request.getSkip().isPresent()) { - _httpUrl.addQueryParameter("skip", request.getSkip().get().toString()); - } - if (request.getTake().isPresent()) { - _httpUrl.addQueryParameter("take", request.getTake().get().toString()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UsersDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto postUser(CreateUserDto request) { - return postUser(request, null); - } - - public UserDto postUser(CreateUserDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("email", request.getEmail()); - _requestBodyProperties.put("displayName", request.getDisplayName()); - _requestBodyProperties.put("password", request.getPassword()); - _requestBodyProperties.put("permissions", request.getPermissions()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("POST", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto getUser(String id) { - return getUser(id, null); - } - - public UserDto getUser(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto putUser(String id, UpdateUserDto request) { - return putUser(id, request, null); - } - - public UserDto putUser(String id, UpdateUserDto request, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - Map _requestBodyProperties = new HashMap<>(); - _requestBodyProperties.put("email", request.getEmail()); - _requestBodyProperties.put("displayName", request.getDisplayName()); - if (request.getPassword().isPresent()) { - _requestBodyProperties.put("password", request.getPassword()); - } - _requestBodyProperties.put("permissions", request.getPermissions()); - RequestBody _requestBody; - try { - _requestBody = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl) - .method("PUT", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteUser(String id) { - deleteUser(id, null); - } - - public void deleteUser(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return; - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto lockUser(String id) { - return lockUser(id, null); - } - - public UserDto lockUser(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .addPathSegments("lock") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto unlockUser(String id) { - return unlockUser(id, null); - } - - public UserDto unlockUser(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .addPathSegments("unlock") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java deleted file mode 100644 index e17f464..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java +++ /dev/null @@ -1,202 +0,0 @@ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateUserDto.Builder.class) -public final class CreateUserDto { - private final String email; - - private final String displayName; - - private final String password; - - private final List permissions; - - private CreateUserDto(String email, String displayName, String password, List permissions) { - this.email = email; - this.displayName = displayName; - this.password = password; - this.permissions = permissions; - } - - /** - * @return The email of the user. Unique value. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return The password of the user. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("password") - public String getPassword() { - return password; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateUserDto && equalTo((CreateUserDto) other); - } - - private boolean equalTo(CreateUserDto other) { - return email.equals(other.email) - && displayName.equals(other.displayName) - && password.equals(other.password) - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.email, this.displayName, this.password, this.permissions); - } - - @Override - public String toString() { - return "CreateUserDto{" + "email: " + email + ", displayName: " + displayName + ", password: " + password - + ", permissions: " + permissions + "}"; - } - - public static EmailStage builder() { - return new Builder(); - } - - public interface EmailStage { - DisplayNameStage email(String email); - - Builder from(CreateUserDto other); - } - - public interface DisplayNameStage { - PasswordStage displayName(String displayName); - } - - public interface PasswordStage { - _FinalStage password(String password); - } - - public interface _FinalStage { - CreateUserDto build(); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EmailStage, DisplayNameStage, PasswordStage, _FinalStage { - private String email; - - private String displayName; - - private String password; - - private List permissions = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(CreateUserDto other) { - email(other.getEmail()); - displayName(other.getDisplayName()); - password(other.getPassword()); - permissions(other.getPermissions()); - return this; - } - - /** - *

The email of the user. Unique value. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public PasswordStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

The password of the user. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("password") - public _FinalStage password(String password) { - this.password = password; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - @Override - public CreateUserDto build() { - return new CreateUserDto(email, displayName, password, permissions); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java deleted file mode 100644 index 873ca45..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateUserDto.Builder.class) -public final class UpdateUserDto { - private final String email; - - private final String displayName; - - private final Optional password; - - private final List permissions; - - private UpdateUserDto(String email, String displayName, Optional password, List permissions) { - this.email = email; - this.displayName = displayName; - this.password = password; - this.permissions = permissions; - } - - /** - * @return The email of the user. Unique value. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return The password of the user. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateUserDto && equalTo((UpdateUserDto) other); - } - - private boolean equalTo(UpdateUserDto other) { - return email.equals(other.email) - && displayName.equals(other.displayName) - && password.equals(other.password) - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.email, this.displayName, this.password, this.permissions); - } - - @Override - public String toString() { - return "UpdateUserDto{" + "email: " + email + ", displayName: " + displayName + ", password: " + password - + ", permissions: " + permissions + "}"; - } - - public static EmailStage builder() { - return new Builder(); - } - - public interface EmailStage { - DisplayNameStage email(String email); - - Builder from(UpdateUserDto other); - } - - public interface DisplayNameStage { - _FinalStage displayName(String displayName); - } - - public interface _FinalStage { - UpdateUserDto build(); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EmailStage, DisplayNameStage, _FinalStage { - private String email; - - private String displayName; - - private List permissions = new ArrayList<>(); - - private Optional password = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpdateUserDto other) { - email(other.getEmail()); - displayName(other.getDisplayName()); - password(other.getPassword()); - permissions(other.getPermissions()); - return this; - } - - /** - *

The email of the user. Unique value. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public _FinalStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The password of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - @Override - public UpdateUserDto build() { - return new UpdateUserDto(email, displayName, password, permissions); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java deleted file mode 100644 index 0cb8193..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java +++ /dev/null @@ -1,129 +0,0 @@ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserManagementGetUsersRequest.Builder.class) -public final class UserManagementGetUsersRequest { - private final Optional query; - - private final Optional skip; - - private final Optional take; - - private UserManagementGetUsersRequest(Optional query, Optional skip, Optional take) { - this.query = query; - this.skip = skip; - this.take = take; - } - - /** - * @return Optional query to search by email address or username. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The number of users to skip. - */ - @JsonProperty("skip") - public Optional getSkip() { - return skip; - } - - /** - * @return The number of users to return. - */ - @JsonProperty("take") - public Optional getTake() { - return take; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserManagementGetUsersRequest && equalTo((UserManagementGetUsersRequest) other); - } - - private boolean equalTo(UserManagementGetUsersRequest other) { - return query.equals(other.query) && skip.equals(other.skip) && take.equals(other.take); - } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.skip, this.take); - } - - @Override - public String toString() { - return "UserManagementGetUsersRequest{" + "query: " + query + ", skip: " + skip + ", take: " + take + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional take = Optional.empty(); - - private Builder() {} - - public Builder from(UserManagementGetUsersRequest other) { - query(other.getQuery()); - skip(other.getSkip()); - take(other.getTake()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Integer skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "take", nulls = Nulls.SKIP) - public Builder take(Optional take) { - this.take = take; - return this; - } - - public Builder take(Integer take) { - this.take = Optional.of(take); - return this; - } - - public UserManagementGetUsersRequest build() { - return new UserManagementGetUsersRequest(query, skip, take); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/users/UsersClient.java b/src/main/java/com/squidex/api/resources/users/UsersClient.java deleted file mode 100644 index 659acd4..0000000 --- a/src/main/java/com/squidex/api/resources/users/UsersClient.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.squidex.api.resources.users; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.users.requests.UsersGetUsersRequest; -import com.squidex.api.types.ResourcesDto; -import com.squidex.api.types.UserDto; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class UsersClient { - protected final ClientOptions clientOptions; - - public UsersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public ResourcesDto getUserResources() { - return getUserResources(null); - } - - public ResourcesDto getUserResources(RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ResourcesDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getUsers(UsersGetUsersRequest request) { - return getUsers(request, null); - } - - public List getUsers(UsersGetUsersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder _httpUrl = HttpUrl.parse( - this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users"); - if (request.getQuery().isPresent()) { - _httpUrl.addQueryParameter("query", request.getQuery().get()); - } - RequestBody _requestBody = null; - Request.Builder _requestBuilder = new Request.Builder() - .url(_httpUrl.build()) - .method("GET", _requestBody) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request _request = _requestBuilder.build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - _response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto getUser(String id) { - return getUser(id, null); - } - - public UserDto getUser(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(id) - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getUserPicture(String id) { - return getUserPicture(id, null); - } - - public InputStream getUserPicture(String id, RequestOptions requestOptions) { - HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(id) - .addPathSegments("picture") - .build(); - Request _request = new Request.Builder() - .url(_httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response _response = clientOptions.httpClient().newCall(_request).execute(); - if (_response.isSuccessful()) { - return _response.body().byteStream(); - } - throw new ApiError( - _response.code(), - ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java b/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java deleted file mode 100644 index 464af42..0000000 --- a/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.resources.users.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsersGetUsersRequest.Builder.class) -public final class UsersGetUsersRequest { - private final Optional query; - - private UsersGetUsersRequest(Optional query) { - this.query = query; - } - - /** - * @return The query to search the user by email address. Case invariant. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsersGetUsersRequest && equalTo((UsersGetUsersRequest) other); - } - - private boolean equalTo(UsersGetUsersRequest other) { - return query.equals(other.query); - } - - @Override - public int hashCode() { - return Objects.hash(this.query); - } - - @Override - public String toString() { - return "UsersGetUsersRequest{" + "query: " + query + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Builder() {} - - public Builder from(UsersGetUsersRequest other) { - query(other.getQuery()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - public UsersGetUsersRequest build() { - return new UsersGetUsersRequest(query); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ActionTypeEnum.java b/src/main/java/com/squidex/api/types/ActionTypeEnum.java deleted file mode 100644 index 881cfb0..0000000 --- a/src/main/java/com/squidex/api/types/ActionTypeEnum.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ActionTypeEnum { - BROADCAST("Broadcast"), - - USER("User"), - - GROUP("Group"); - - private final String value; - - ActionTypeEnum(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/AddFieldDto.java b/src/main/java/com/squidex/api/types/AddFieldDto.java deleted file mode 100644 index f324e3c..0000000 --- a/src/main/java/com/squidex/api/types/AddFieldDto.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddFieldDto.Builder.class) -public final class AddFieldDto { - private final String name; - - private final Optional partitioning; - - private final FieldPropertiesDto properties; - - private AddFieldDto(String name, Optional partitioning, FieldPropertiesDto properties) { - this.name = name; - this.partitioning = partitioning; - this.properties = properties; - } - - /** - * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Determines the optional partitioning of the field. - */ - @JsonProperty("partitioning") - public Optional getPartitioning() { - return partitioning; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddFieldDto && equalTo((AddFieldDto) other); - } - - private boolean equalTo(AddFieldDto other) { - return name.equals(other.name) - && partitioning.equals(other.partitioning) - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.partitioning, this.properties); - } - - @Override - public String toString() { - return "AddFieldDto{" + "name: " + name + ", partitioning: " + partitioning + ", properties: " + properties - + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - PropertiesStage name(String name); - - Builder from(AddFieldDto other); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - } - - public interface _FinalStage { - AddFieldDto build(); - - _FinalStage partitioning(Optional partitioning); - - _FinalStage partitioning(String partitioning); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - - private FieldPropertiesDto properties; - - private Optional partitioning = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AddFieldDto other) { - name(other.getName()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - return this; - } - - /** - *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

Determines the optional partitioning of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage partitioning(String partitioning) { - this.partitioning = Optional.of(partitioning); - return this; - } - - @Override - @JsonSetter(value = "partitioning", nulls = Nulls.SKIP) - public _FinalStage partitioning(Optional partitioning) { - this.partitioning = partitioning; - return this; - } - - @Override - public AddFieldDto build() { - return new AddFieldDto(name, partitioning, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java b/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java deleted file mode 100644 index 2bae9ba..0000000 --- a/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AlgoliaRuleActionDto.Builder.class) -public final class AlgoliaRuleActionDto { - private final String appId; - - private final String apiKey; - - private final String indexName; - - private final Optional document; - - private final Optional delete; - - private AlgoliaRuleActionDto( - String appId, String apiKey, String indexName, Optional document, Optional delete) { - this.appId = appId; - this.apiKey = apiKey; - this.indexName = indexName; - this.document = document; - this.delete = delete; - } - - /** - * @return The application ID. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("appId") - public String getAppId() { - return appId; - } - - /** - * @return The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The name of the index. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the entry. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AlgoliaRuleActionDto && equalTo((AlgoliaRuleActionDto) other); - } - - private boolean equalTo(AlgoliaRuleActionDto other) { - return appId.equals(other.appId) - && apiKey.equals(other.apiKey) - && indexName.equals(other.indexName) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.appId, this.apiKey, this.indexName, this.document, this.delete); - } - - @Override - public String toString() { - return "AlgoliaRuleActionDto{" + "appId: " + appId + ", apiKey: " + apiKey + ", indexName: " + indexName - + ", document: " + document + ", delete: " + delete + "}"; - } - - public static AppIdStage builder() { - return new Builder(); - } - - public interface AppIdStage { - ApiKeyStage appId(String appId); - - Builder from(AlgoliaRuleActionDto other); - } - - public interface ApiKeyStage { - IndexNameStage apiKey(String apiKey); - } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); - } - - public interface _FinalStage { - AlgoliaRuleActionDto build(); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppIdStage, ApiKeyStage, IndexNameStage, _FinalStage { - private String appId; - - private String apiKey; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AlgoliaRuleActionDto other) { - appId(other.getAppId()); - apiKey(other.getApiKey()); - indexName(other.getIndexName()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The application ID. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("appId") - public ApiKeyStage appId(String appId) { - this.appId = appId; - return this; - } - - /** - *

The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public IndexNameStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - *

The name of the index. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - *

The condition when to delete the entry.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - @Override - public AlgoliaRuleActionDto build() { - return new AlgoliaRuleActionDto(appId, apiKey, indexName, document, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AllContentsByPostDto.java b/src/main/java/com/squidex/api/types/AllContentsByPostDto.java deleted file mode 100644 index ad22c74..0000000 --- a/src/main/java/com/squidex/api/types/AllContentsByPostDto.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AllContentsByPostDto.Builder.class) -public final class AllContentsByPostDto { - private final Optional> ids; - - private final Optional scheduledFrom; - - private final Optional scheduledTo; - - private final Optional referencing; - - private final Optional references; - - private final Optional oData; - - private final Optional q; - - private AllContentsByPostDto( - Optional> ids, - Optional scheduledFrom, - Optional scheduledTo, - Optional referencing, - Optional references, - Optional oData, - Optional q) { - this.ids = ids; - this.scheduledFrom = scheduledFrom; - this.scheduledTo = scheduledTo; - this.referencing = referencing; - this.references = references; - this.oData = oData; - this.q = q; - } - - /** - * @return The list of ids to query. - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return The start of the schedule. - */ - @JsonProperty("scheduledFrom") - public Optional getScheduledFrom() { - return scheduledFrom; - } - - /** - * @return The end of the schedule. - */ - @JsonProperty("scheduledTo") - public Optional getScheduledTo() { - return scheduledTo; - } - - /** - * @return The ID of the referencing content item. - */ - @JsonProperty("referencing") - public Optional getReferencing() { - return referencing; - } - - /** - * @return The ID of the reference content item. - */ - @JsonProperty("references") - public Optional getReferences() { - return references; - } - - /** - * @return The optional odata query. - */ - @JsonProperty("oData") - public Optional getOData() { - return oData; - } - - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AllContentsByPostDto && equalTo((AllContentsByPostDto) other); - } - - private boolean equalTo(AllContentsByPostDto other) { - return ids.equals(other.ids) - && scheduledFrom.equals(other.scheduledFrom) - && scheduledTo.equals(other.scheduledTo) - && referencing.equals(other.referencing) - && references.equals(other.references) - && oData.equals(other.oData) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash( - this.ids, this.scheduledFrom, this.scheduledTo, this.referencing, this.references, this.oData, this.q); - } - - @Override - public String toString() { - return "AllContentsByPostDto{" + "ids: " + ids + ", scheduledFrom: " + scheduledFrom + ", scheduledTo: " - + scheduledTo + ", referencing: " + referencing + ", references: " + references + ", oData: " + oData - + ", q: " + q + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> ids = Optional.empty(); - - private Optional scheduledFrom = Optional.empty(); - - private Optional scheduledTo = Optional.empty(); - - private Optional referencing = Optional.empty(); - - private Optional references = Optional.empty(); - - private Optional oData = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(AllContentsByPostDto other) { - ids(other.getIds()); - scheduledFrom(other.getScheduledFrom()); - scheduledTo(other.getScheduledTo()); - referencing(other.getReferencing()); - references(other.getReferences()); - oData(other.getOData()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; - return this; - } - - public Builder ids(List ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "scheduledFrom", nulls = Nulls.SKIP) - public Builder scheduledFrom(Optional scheduledFrom) { - this.scheduledFrom = scheduledFrom; - return this; - } - - public Builder scheduledFrom(OffsetDateTime scheduledFrom) { - this.scheduledFrom = Optional.of(scheduledFrom); - return this; - } - - @JsonSetter(value = "scheduledTo", nulls = Nulls.SKIP) - public Builder scheduledTo(Optional scheduledTo) { - this.scheduledTo = scheduledTo; - return this; - } - - public Builder scheduledTo(OffsetDateTime scheduledTo) { - this.scheduledTo = Optional.of(scheduledTo); - return this; - } - - @JsonSetter(value = "referencing", nulls = Nulls.SKIP) - public Builder referencing(Optional referencing) { - this.referencing = referencing; - return this; - } - - public Builder referencing(String referencing) { - this.referencing = Optional.of(referencing); - return this; - } - - @JsonSetter(value = "references", nulls = Nulls.SKIP) - public Builder references(Optional references) { - this.references = references; - return this; - } - - public Builder references(String references) { - this.references = Optional.of(references); - return this; - } - - @JsonSetter(value = "oData", nulls = Nulls.SKIP) - public Builder oData(Optional oData) { - this.oData = oData; - return this; - } - - public Builder oData(String oData) { - this.oData = Optional.of(oData); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(Object q) { - this.q = Optional.of(q); - return this; - } - - public AllContentsByPostDto build() { - return new AllContentsByPostDto(ids, scheduledFrom, scheduledTo, referencing, references, oData, q); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AppDto.java b/src/main/java/com/squidex/api/types/AppDto.java deleted file mode 100644 index b473f22..0000000 --- a/src/main/java/com/squidex/api/types/AppDto.java +++ /dev/null @@ -1,622 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppDto.Builder.class) -public final class AppDto implements IResource { - private final Map links; - - private final String id; - - private final String name; - - private final Optional label; - - private final Optional description; - - private final int version; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final Optional teamId; - - private final List permissions; - - private final boolean canAccessApi; - - private final boolean canAccessContent; - - private final Optional roleName; - - private final Map roleProperties; - - private AppDto( - Map links, - String id, - String name, - Optional label, - Optional description, - int version, - OffsetDateTime created, - OffsetDateTime lastModified, - Optional teamId, - List permissions, - boolean canAccessApi, - boolean canAccessContent, - Optional roleName, - Map roleProperties) { - this.links = links; - this.id = id; - this.name = name; - this.label = label; - this.description = description; - this.version = version; - this.created = created; - this.lastModified = lastModified; - this.teamId = teamId; - this.permissions = permissions; - this.canAccessApi = canAccessApi; - this.canAccessContent = canAccessContent; - this.roleName = roleName; - this.roleProperties = roleProperties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the app. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the app. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The optional label of the app. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return The optional description of the app. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The timestamp when the app has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The timestamp when the app has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("teamId") - public Optional getTeamId() { - return teamId; - } - - /** - * @return The permission level of the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Indicates if the user can access the api. - */ - @JsonProperty("canAccessApi") - public boolean getCanAccessApi() { - return canAccessApi; - } - - /** - * @return Indicates if the user can access at least one content. - */ - @JsonProperty("canAccessContent") - public boolean getCanAccessContent() { - return canAccessContent; - } - - /** - * @return The role name of the user. - */ - @JsonProperty("roleName") - public Optional getRoleName() { - return roleName; - } - - /** - * @return The properties from the role. - */ - @JsonProperty("roleProperties") - public Map getRoleProperties() { - return roleProperties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppDto && equalTo((AppDto) other); - } - - private boolean equalTo(AppDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && label.equals(other.label) - && description.equals(other.description) - && version == other.version - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && teamId.equals(other.teamId) - && permissions.equals(other.permissions) - && canAccessApi == other.canAccessApi - && canAccessContent == other.canAccessContent - && roleName.equals(other.roleName) - && roleProperties.equals(other.roleProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.name, - this.label, - this.description, - this.version, - this.created, - this.lastModified, - this.teamId, - this.permissions, - this.canAccessApi, - this.canAccessContent, - this.roleName, - this.roleProperties); - } - - @Override - public String toString() { - return "AppDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", label: " + label - + ", description: " + description + ", version: " + version + ", created: " + created - + ", lastModified: " + lastModified + ", teamId: " + teamId + ", permissions: " + permissions - + ", canAccessApi: " + canAccessApi + ", canAccessContent: " + canAccessContent + ", roleName: " - + roleName + ", roleProperties: " + roleProperties + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - NameStage id(String id); - - Builder from(AppDto other); - } - - public interface NameStage { - VersionStage name(String name); - } - - public interface VersionStage { - CreatedStage version(int version); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - CanAccessApiStage lastModified(OffsetDateTime lastModified); - } - - public interface CanAccessApiStage { - CanAccessContentStage canAccessApi(boolean canAccessApi); - } - - public interface CanAccessContentStage { - _FinalStage canAccessContent(boolean canAccessContent); - } - - public interface _FinalStage { - AppDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage label(Optional label); - - _FinalStage label(String label); - - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage teamId(Optional teamId); - - _FinalStage teamId(String teamId); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - - _FinalStage roleName(Optional roleName); - - _FinalStage roleName(String roleName); - - _FinalStage roleProperties(Map roleProperties); - - _FinalStage putAllRoleProperties(Map roleProperties); - - _FinalStage roleProperties(String key, Object value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - NameStage, - VersionStage, - CreatedStage, - LastModifiedStage, - CanAccessApiStage, - CanAccessContentStage, - _FinalStage { - private String id; - - private String name; - - private int version; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private boolean canAccessApi; - - private boolean canAccessContent; - - private Map roleProperties = new LinkedHashMap<>(); - - private Optional roleName = Optional.empty(); - - private List permissions = new ArrayList<>(); - - private Optional teamId = Optional.empty(); - - private Optional description = Optional.empty(); - - private Optional label = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - label(other.getLabel()); - description(other.getDescription()); - version(other.getVersion()); - created(other.getCreated()); - lastModified(other.getLastModified()); - teamId(other.getTeamId()); - permissions(other.getPermissions()); - canAccessApi(other.getCanAccessApi()); - canAccessContent(other.getCanAccessContent()); - roleName(other.getRoleName()); - roleProperties(other.getRoleProperties()); - return this; - } - - /** - *

The ID of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; - } - - /** - *

The name of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public VersionStage name(String name) { - this.name = name; - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public CreatedStage version(int version) { - this.version = version; - return this; - } - - /** - *

The timestamp when the app has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The timestamp when the app has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public CanAccessApiStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

Indicates if the user can access the api.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canAccessApi") - public CanAccessContentStage canAccessApi(boolean canAccessApi) { - this.canAccessApi = canAccessApi; - return this; - } - - /** - *

Indicates if the user can access at least one content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canAccessContent") - public _FinalStage canAccessContent(boolean canAccessContent) { - this.canAccessContent = canAccessContent; - return this; - } - - /** - *

The properties from the role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleProperties(String key, Object value) { - this.roleProperties.put(key, value); - return this; - } - - /** - *

The properties from the role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllRoleProperties(Map roleProperties) { - this.roleProperties.putAll(roleProperties); - return this; - } - - @Override - @JsonSetter(value = "roleProperties", nulls = Nulls.SKIP) - public _FinalStage roleProperties(Map roleProperties) { - this.roleProperties.clear(); - this.roleProperties.putAll(roleProperties); - return this; - } - - /** - *

The role name of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleName(String roleName) { - this.roleName = Optional.of(roleName); - return this; - } - - @Override - @JsonSetter(value = "roleName", nulls = Nulls.SKIP) - public _FinalStage roleName(Optional roleName) { - this.roleName = roleName; - return this; - } - - /** - *

The permission level of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

The permission level of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The ID of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage teamId(String teamId) { - this.teamId = Optional.of(teamId); - return this; - } - - @Override - @JsonSetter(value = "teamId", nulls = Nulls.SKIP) - public _FinalStage teamId(Optional teamId) { - this.teamId = teamId; - return this; - } - - /** - *

The optional description of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage description(String description) { - this.description = Optional.of(description); - return this; - } - - @Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - /** - *

The optional label of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; - } - - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppDto build() { - return new AppDto( - links, - id, - name, - label, - description, - version, - created, - lastModified, - teamId, - permissions, - canAccessApi, - canAccessContent, - roleName, - roleProperties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AppLanguageDto.java b/src/main/java/com/squidex/api/types/AppLanguageDto.java deleted file mode 100644 index 51f7814..0000000 --- a/src/main/java/com/squidex/api/types/AppLanguageDto.java +++ /dev/null @@ -1,291 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppLanguageDto.Builder.class) -public final class AppLanguageDto implements IResource { - private final Map links; - - private final String iso2Code; - - private final String englishName; - - private final List fallback; - - private final boolean isMaster; - - private final boolean isOptional; - - private AppLanguageDto( - Map links, - String iso2Code, - String englishName, - List fallback, - boolean isMaster, - boolean isOptional) { - this.links = links; - this.iso2Code = iso2Code; - this.englishName = englishName; - this.fallback = fallback; - this.isMaster = isMaster; - this.isOptional = isOptional; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The iso code of the language. - */ - @JsonProperty("iso2Code") - public String getIso2Code() { - return iso2Code; - } - - /** - * @return The english name of the language. - */ - @JsonProperty("englishName") - public String getEnglishName() { - return englishName; - } - - /** - * @return The fallback languages. - */ - @JsonProperty("fallback") - public List getFallback() { - return fallback; - } - - /** - * @return Indicates if the language is the master language. - */ - @JsonProperty("isMaster") - public boolean getIsMaster() { - return isMaster; - } - - /** - * @return Indicates if the language is optional. - */ - @JsonProperty("isOptional") - public boolean getIsOptional() { - return isOptional; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppLanguageDto && equalTo((AppLanguageDto) other); - } - - private boolean equalTo(AppLanguageDto other) { - return links.equals(other.links) - && iso2Code.equals(other.iso2Code) - && englishName.equals(other.englishName) - && fallback.equals(other.fallback) - && isMaster == other.isMaster - && isOptional == other.isOptional; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.iso2Code, this.englishName, this.fallback, this.isMaster, this.isOptional); - } - - @Override - public String toString() { - return "AppLanguageDto{" + "links: " + links + ", iso2Code: " + iso2Code + ", englishName: " + englishName - + ", fallback: " + fallback + ", isMaster: " + isMaster + ", isOptional: " + isOptional + "}"; - } - - public static Iso2CodeStage builder() { - return new Builder(); - } - - public interface Iso2CodeStage { - EnglishNameStage iso2Code(String iso2Code); - - Builder from(AppLanguageDto other); - } - - public interface EnglishNameStage { - IsMasterStage englishName(String englishName); - } - - public interface IsMasterStage { - IsOptionalStage isMaster(boolean isMaster); - } - - public interface IsOptionalStage { - _FinalStage isOptional(boolean isOptional); - } - - public interface _FinalStage { - AppLanguageDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage fallback(List fallback); - - _FinalStage addFallback(String fallback); - - _FinalStage addAllFallback(List fallback); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements Iso2CodeStage, EnglishNameStage, IsMasterStage, IsOptionalStage, _FinalStage { - private String iso2Code; - - private String englishName; - - private boolean isMaster; - - private boolean isOptional; - - private List fallback = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppLanguageDto other) { - links(other.getLinks()); - iso2Code(other.getIso2Code()); - englishName(other.getEnglishName()); - fallback(other.getFallback()); - isMaster(other.getIsMaster()); - isOptional(other.getIsOptional()); - return this; - } - - /** - *

The iso code of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("iso2Code") - public EnglishNameStage iso2Code(String iso2Code) { - this.iso2Code = iso2Code; - return this; - } - - /** - *

The english name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("englishName") - public IsMasterStage englishName(String englishName) { - this.englishName = englishName; - return this; - } - - /** - *

Indicates if the language is the master language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isMaster") - public IsOptionalStage isMaster(boolean isMaster) { - this.isMaster = isMaster; - return this; - } - - /** - *

Indicates if the language is optional.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isOptional") - public _FinalStage isOptional(boolean isOptional) { - this.isOptional = isOptional; - return this; - } - - /** - *

The fallback languages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFallback(List fallback) { - this.fallback.addAll(fallback); - return this; - } - - /** - *

The fallback languages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFallback(String fallback) { - this.fallback.add(fallback); - return this; - } - - @Override - @JsonSetter(value = "fallback", nulls = Nulls.SKIP) - public _FinalStage fallback(List fallback) { - this.fallback.clear(); - this.fallback.addAll(fallback); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppLanguageDto build() { - return new AppLanguageDto(links, iso2Code, englishName, fallback, isMaster, isOptional); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AppLanguagesDto.java b/src/main/java/com/squidex/api/types/AppLanguagesDto.java deleted file mode 100644 index d61ed5a..0000000 --- a/src/main/java/com/squidex/api/types/AppLanguagesDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppLanguagesDto.Builder.class) -public final class AppLanguagesDto implements IResource { - private final Map links; - - private final List items; - - private AppLanguagesDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The languages. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppLanguagesDto && equalTo((AppLanguagesDto) other); - } - - private boolean equalTo(AppLanguagesDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "AppLanguagesDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(AppLanguagesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(AppLanguageDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public AppLanguagesDto build() { - return new AppLanguagesDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AppSettingsDto.java b/src/main/java/com/squidex/api/types/AppSettingsDto.java deleted file mode 100644 index ed4f86a..0000000 --- a/src/main/java/com/squidex/api/types/AppSettingsDto.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppSettingsDto.Builder.class) -public final class AppSettingsDto implements IResource { - private final Map links; - - private final List patterns; - - private final List editors; - - private final boolean hideScheduler; - - private final boolean hideDateTimeModeButton; - - private final int version; - - private AppSettingsDto( - Map links, - List patterns, - List editors, - boolean hideScheduler, - boolean hideDateTimeModeButton, - int version) { - this.links = links; - this.patterns = patterns; - this.editors = editors; - this.hideScheduler = hideScheduler; - this.hideDateTimeModeButton = hideDateTimeModeButton; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The configured app patterns. - */ - @JsonProperty("patterns") - public List getPatterns() { - return patterns; - } - - /** - * @return The configured UI editors. - */ - @JsonProperty("editors") - public List getEditors() { - return editors; - } - - /** - * @return Hide the scheduler for content items. - */ - @JsonProperty("hideScheduler") - public boolean getHideScheduler() { - return hideScheduler; - } - - /** - * @return Hide the datetime mode button. - */ - @JsonProperty("hideDateTimeModeButton") - public boolean getHideDateTimeModeButton() { - return hideDateTimeModeButton; - } - - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppSettingsDto && equalTo((AppSettingsDto) other); - } - - private boolean equalTo(AppSettingsDto other) { - return links.equals(other.links) - && patterns.equals(other.patterns) - && editors.equals(other.editors) - && hideScheduler == other.hideScheduler - && hideDateTimeModeButton == other.hideDateTimeModeButton - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.patterns, this.editors, this.hideScheduler, this.hideDateTimeModeButton, this.version); - } - - @Override - public String toString() { - return "AppSettingsDto{" + "links: " + links + ", patterns: " + patterns + ", editors: " + editors - + ", hideScheduler: " + hideScheduler + ", hideDateTimeModeButton: " + hideDateTimeModeButton - + ", version: " + version + "}"; - } - - public static HideSchedulerStage builder() { - return new Builder(); - } - - public interface HideSchedulerStage { - HideDateTimeModeButtonStage hideScheduler(boolean hideScheduler); - - Builder from(AppSettingsDto other); - } - - public interface HideDateTimeModeButtonStage { - VersionStage hideDateTimeModeButton(boolean hideDateTimeModeButton); - } - - public interface VersionStage { - _FinalStage version(int version); - } - - public interface _FinalStage { - AppSettingsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage patterns(List patterns); - - _FinalStage addPatterns(PatternDto patterns); - - _FinalStage addAllPatterns(List patterns); - - _FinalStage editors(List editors); - - _FinalStage addEditors(EditorDto editors); - - _FinalStage addAllEditors(List editors); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements HideSchedulerStage, HideDateTimeModeButtonStage, VersionStage, _FinalStage { - private boolean hideScheduler; - - private boolean hideDateTimeModeButton; - - private int version; - - private List editors = new ArrayList<>(); - - private List patterns = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppSettingsDto other) { - links(other.getLinks()); - patterns(other.getPatterns()); - editors(other.getEditors()); - hideScheduler(other.getHideScheduler()); - hideDateTimeModeButton(other.getHideDateTimeModeButton()); - version(other.getVersion()); - return this; - } - - /** - *

Hide the scheduler for content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hideScheduler") - public HideDateTimeModeButtonStage hideScheduler(boolean hideScheduler) { - this.hideScheduler = hideScheduler; - return this; - } - - /** - *

Hide the datetime mode button.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hideDateTimeModeButton") - public VersionStage hideDateTimeModeButton(boolean hideDateTimeModeButton) { - this.hideDateTimeModeButton = hideDateTimeModeButton; - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The configured UI editors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllEditors(List editors) { - this.editors.addAll(editors); - return this; - } - - /** - *

The configured UI editors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addEditors(EditorDto editors) { - this.editors.add(editors); - return this; - } - - @Override - @JsonSetter(value = "editors", nulls = Nulls.SKIP) - public _FinalStage editors(List editors) { - this.editors.clear(); - this.editors.addAll(editors); - return this; - } - - /** - *

The configured app patterns.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPatterns(List patterns) { - this.patterns.addAll(patterns); - return this; - } - - /** - *

The configured app patterns.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPatterns(PatternDto patterns) { - this.patterns.add(patterns); - return this; - } - - @Override - @JsonSetter(value = "patterns", nulls = Nulls.SKIP) - public _FinalStage patterns(List patterns) { - this.patterns.clear(); - this.patterns.addAll(patterns); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppSettingsDto build() { - return new AppSettingsDto(links, patterns, editors, hideScheduler, hideDateTimeModeButton, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java deleted file mode 100644 index e255c52..0000000 --- a/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ArrayFieldPropertiesDto.Builder.class) -public final class ArrayFieldPropertiesDto { - private final Optional minItems; - - private final Optional maxItems; - - private final Optional> uniqueFields; - - private ArrayFieldPropertiesDto( - Optional minItems, Optional maxItems, Optional> uniqueFields) { - this.minItems = minItems; - this.maxItems = maxItems; - this.uniqueFields = uniqueFields; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return The fields that must be unique. - */ - @JsonProperty("uniqueFields") - public Optional> getUniqueFields() { - return uniqueFields; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ArrayFieldPropertiesDto && equalTo((ArrayFieldPropertiesDto) other); - } - - private boolean equalTo(ArrayFieldPropertiesDto other) { - return minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && uniqueFields.equals(other.uniqueFields); - } - - @Override - public int hashCode() { - return Objects.hash(this.minItems, this.maxItems, this.uniqueFields); - } - - @Override - public String toString() { - return "ArrayFieldPropertiesDto{" + "minItems: " + minItems + ", maxItems: " + maxItems + ", uniqueFields: " - + uniqueFields + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional> uniqueFields = Optional.empty(); - - private Builder() {} - - public Builder from(ArrayFieldPropertiesDto other) { - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - uniqueFields(other.getUniqueFields()); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "uniqueFields", nulls = Nulls.SKIP) - public Builder uniqueFields(Optional> uniqueFields) { - this.uniqueFields = uniqueFields; - return this; - } - - public Builder uniqueFields(List uniqueFields) { - this.uniqueFields = Optional.of(uniqueFields); - return this; - } - - public ArrayFieldPropertiesDto build() { - return new ArrayFieldPropertiesDto(minItems, maxItems, uniqueFields); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java deleted file mode 100644 index abcbfb6..0000000 --- a/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetChangedRuleTriggerDto.Builder.class) -public final class AssetChangedRuleTriggerDto { - private final Optional condition; - - private AssetChangedRuleTriggerDto(Optional condition) { - this.condition = condition; - } - - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetChangedRuleTriggerDto && equalTo((AssetChangedRuleTriggerDto) other); - } - - private boolean equalTo(AssetChangedRuleTriggerDto other) { - return condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.condition); - } - - @Override - public String toString() { - return "AssetChangedRuleTriggerDto{" + "condition: " + condition + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - - private Builder() {} - - public Builder from(AssetChangedRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } - - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; - } - - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - public AssetChangedRuleTriggerDto build() { - return new AssetChangedRuleTriggerDto(condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetDto.java b/src/main/java/com/squidex/api/types/AssetDto.java deleted file mode 100644 index 697dba3..0000000 --- a/src/main/java/com/squidex/api/types/AssetDto.java +++ /dev/null @@ -1,976 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetDto.Builder.class) -public final class AssetDto implements IResource { - private final Map links; - - private final String id; - - private final String parentId; - - private final String fileName; - - private final Optional fileHash; - - private final boolean isProtected; - - private final String slug; - - private final String mimeType; - - private final String fileType; - - private final String metadataText; - - private final Optional editToken; - - private final Map metadata; - - private final Optional> tags; - - private final int fileSize; - - private final int fileVersion; - - private final AssetType type; - - private final String createdBy; - - private final String lastModifiedBy; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final Optional meta; - - private final boolean isImage; - - private final Optional pixelWidth; - - private final Optional pixelHeight; - - private AssetDto( - Map links, - String id, - String parentId, - String fileName, - Optional fileHash, - boolean isProtected, - String slug, - String mimeType, - String fileType, - String metadataText, - Optional editToken, - Map metadata, - Optional> tags, - int fileSize, - int fileVersion, - AssetType type, - String createdBy, - String lastModifiedBy, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - Optional meta, - boolean isImage, - Optional pixelWidth, - Optional pixelHeight) { - this.links = links; - this.id = id; - this.parentId = parentId; - this.fileName = fileName; - this.fileHash = fileHash; - this.isProtected = isProtected; - this.slug = slug; - this.mimeType = mimeType; - this.fileType = fileType; - this.metadataText = metadataText; - this.editToken = editToken; - this.metadata = metadata; - this.tags = tags; - this.fileSize = fileSize; - this.fileVersion = fileVersion; - this.type = type; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.meta = meta; - this.isImage = isImage; - this.pixelWidth = pixelWidth; - this.pixelHeight = pixelHeight; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the asset. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The ID of the parent folder. Empty for files without parent. - */ - @JsonProperty("parentId") - public String getParentId() { - return parentId; - } - - /** - * @return The file name. - */ - @JsonProperty("fileName") - public String getFileName() { - return fileName; - } - - /** - * @return The file hash. - */ - @JsonProperty("fileHash") - public Optional getFileHash() { - return fileHash; - } - - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public boolean getIsProtected() { - return isProtected; - } - - /** - * @return The slug. - */ - @JsonProperty("slug") - public String getSlug() { - return slug; - } - - /** - * @return The mime type. - */ - @JsonProperty("mimeType") - public String getMimeType() { - return mimeType; - } - - /** - * @return The file type. - */ - @JsonProperty("fileType") - public String getFileType() { - return fileType; - } - - /** - * @return The formatted text representation of the metadata. - */ - @JsonProperty("metadataText") - public String getMetadataText() { - return metadataText; - } - - /** - * @return The UI token. - */ - @JsonProperty("editToken") - public Optional getEditToken() { - return editToken; - } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Map getMetadata() { - return metadata; - } - - /** - * @return The asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The size of the file in bytes. - */ - @JsonProperty("fileSize") - public int getFileSize() { - return fileSize; - } - - /** - * @return The version of the file. - */ - @JsonProperty("fileVersion") - public int getFileVersion() { - return fileVersion; - } - - @JsonProperty("type") - public AssetType getType() { - return type; - } - - /** - * @return The user that has created the schema. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the asset. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The date and time when the asset has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the asset has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the asset. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @JsonProperty("_meta") - public Optional getMeta() { - return meta; - } - - /** - * @return Determines of the created file is an image. - */ - @JsonProperty("isImage") - public boolean getIsImage() { - return isImage; - } - - /** - * @return The width of the image in pixels if the asset is an image. - */ - @JsonProperty("pixelWidth") - public Optional getPixelWidth() { - return pixelWidth; - } - - /** - * @return The height of the image in pixels if the asset is an image. - */ - @JsonProperty("pixelHeight") - public Optional getPixelHeight() { - return pixelHeight; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetDto && equalTo((AssetDto) other); - } - - private boolean equalTo(AssetDto other) { - return links.equals(other.links) - && id.equals(other.id) - && parentId.equals(other.parentId) - && fileName.equals(other.fileName) - && fileHash.equals(other.fileHash) - && isProtected == other.isProtected - && slug.equals(other.slug) - && mimeType.equals(other.mimeType) - && fileType.equals(other.fileType) - && metadataText.equals(other.metadataText) - && editToken.equals(other.editToken) - && metadata.equals(other.metadata) - && tags.equals(other.tags) - && fileSize == other.fileSize - && fileVersion == other.fileVersion - && type.equals(other.type) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && meta.equals(other.meta) - && isImage == other.isImage - && pixelWidth.equals(other.pixelWidth) - && pixelHeight.equals(other.pixelHeight); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.parentId, - this.fileName, - this.fileHash, - this.isProtected, - this.slug, - this.mimeType, - this.fileType, - this.metadataText, - this.editToken, - this.metadata, - this.tags, - this.fileSize, - this.fileVersion, - this.type, - this.createdBy, - this.lastModifiedBy, - this.created, - this.lastModified, - this.version, - this.meta, - this.isImage, - this.pixelWidth, - this.pixelHeight); - } - - @Override - public String toString() { - return "AssetDto{" + "links: " + links + ", id: " + id + ", parentId: " + parentId + ", fileName: " + fileName - + ", fileHash: " + fileHash + ", isProtected: " + isProtected + ", slug: " + slug + ", mimeType: " - + mimeType + ", fileType: " + fileType + ", metadataText: " + metadataText + ", editToken: " + editToken - + ", metadata: " + metadata + ", tags: " + tags + ", fileSize: " + fileSize + ", fileVersion: " - + fileVersion + ", type: " + type + ", createdBy: " + createdBy + ", lastModifiedBy: " + lastModifiedBy - + ", created: " + created + ", lastModified: " + lastModified + ", version: " + version + ", meta: " - + meta + ", isImage: " + isImage + ", pixelWidth: " + pixelWidth + ", pixelHeight: " + pixelHeight - + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - ParentIdStage id(String id); - - Builder from(AssetDto other); - } - - public interface ParentIdStage { - FileNameStage parentId(String parentId); - } - - public interface FileNameStage { - IsProtectedStage fileName(String fileName); - } - - public interface IsProtectedStage { - SlugStage isProtected(boolean isProtected); - } - - public interface SlugStage { - MimeTypeStage slug(String slug); - } - - public interface MimeTypeStage { - FileTypeStage mimeType(String mimeType); - } - - public interface FileTypeStage { - MetadataTextStage fileType(String fileType); - } - - public interface MetadataTextStage { - FileSizeStage metadataText(String metadataText); - } - - public interface FileSizeStage { - FileVersionStage fileSize(int fileSize); - } - - public interface FileVersionStage { - TypeStage fileVersion(int fileVersion); - } - - public interface TypeStage { - CreatedByStage type(AssetType type); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - CreatedStage lastModifiedBy(String lastModifiedBy); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - IsImageStage version(int version); - } - - public interface IsImageStage { - _FinalStage isImage(boolean isImage); - } - - public interface _FinalStage { - AssetDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage fileHash(Optional fileHash); - - _FinalStage fileHash(String fileHash); - - _FinalStage editToken(Optional editToken); - - _FinalStage editToken(String editToken); - - _FinalStage metadata(Map metadata); - - _FinalStage putAllMetadata(Map metadata); - - _FinalStage metadata(String key, Object value); - - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); - - _FinalStage meta(Optional meta); - - _FinalStage meta(AssetMeta meta); - - _FinalStage pixelWidth(Optional pixelWidth); - - _FinalStage pixelWidth(Integer pixelWidth); - - _FinalStage pixelHeight(Optional pixelHeight); - - _FinalStage pixelHeight(Integer pixelHeight); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - ParentIdStage, - FileNameStage, - IsProtectedStage, - SlugStage, - MimeTypeStage, - FileTypeStage, - MetadataTextStage, - FileSizeStage, - FileVersionStage, - TypeStage, - CreatedByStage, - LastModifiedByStage, - CreatedStage, - LastModifiedStage, - VersionStage, - IsImageStage, - _FinalStage { - private String id; - - private String parentId; - - private String fileName; - - private boolean isProtected; - - private String slug; - - private String mimeType; - - private String fileType; - - private String metadataText; - - private int fileSize; - - private int fileVersion; - - private AssetType type; - - private String createdBy; - - private String lastModifiedBy; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private boolean isImage; - - private Optional pixelHeight = Optional.empty(); - - private Optional pixelWidth = Optional.empty(); - - private Optional meta = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Map metadata = new LinkedHashMap<>(); - - private Optional editToken = Optional.empty(); - - private Optional fileHash = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetDto other) { - links(other.getLinks()); - id(other.getId()); - parentId(other.getParentId()); - fileName(other.getFileName()); - fileHash(other.getFileHash()); - isProtected(other.getIsProtected()); - slug(other.getSlug()); - mimeType(other.getMimeType()); - fileType(other.getFileType()); - metadataText(other.getMetadataText()); - editToken(other.getEditToken()); - metadata(other.getMetadata()); - tags(other.getTags()); - fileSize(other.getFileSize()); - fileVersion(other.getFileVersion()); - type(other.getType()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - meta(other.getMeta()); - isImage(other.getIsImage()); - pixelWidth(other.getPixelWidth()); - pixelHeight(other.getPixelHeight()); - return this; - } - - /** - *

The ID of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public ParentIdStage id(String id) { - this.id = id; - return this; - } - - /** - *

The ID of the parent folder. Empty for files without parent.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("parentId") - public FileNameStage parentId(String parentId) { - this.parentId = parentId; - return this; - } - - /** - *

The file name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileName") - public IsProtectedStage fileName(String fileName) { - this.fileName = fileName; - return this; - } - - /** - *

True, when the asset is not public.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isProtected") - public SlugStage isProtected(boolean isProtected) { - this.isProtected = isProtected; - return this; - } - - /** - *

The slug.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("slug") - public MimeTypeStage slug(String slug) { - this.slug = slug; - return this; - } - - /** - *

The mime type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("mimeType") - public FileTypeStage mimeType(String mimeType) { - this.mimeType = mimeType; - return this; - } - - /** - *

The file type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileType") - public MetadataTextStage fileType(String fileType) { - this.fileType = fileType; - return this; - } - - /** - *

The formatted text representation of the metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("metadataText") - public FileSizeStage metadataText(String metadataText) { - this.metadataText = metadataText; - return this; - } - - /** - *

The size of the file in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileSize") - public FileVersionStage fileSize(int fileSize) { - this.fileSize = fileSize; - return this; - } - - /** - *

The version of the file.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileVersion") - public TypeStage fileVersion(int fileVersion) { - this.fileVersion = fileVersion; - return this; - } - - @Override - @JsonSetter("type") - public CreatedByStage type(AssetType type) { - this.type = type; - return this; - } - - /** - *

The user that has created the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public CreatedStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The date and time when the asset has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the asset has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public IsImageStage version(int version) { - this.version = version; - return this; - } - - /** - *

Determines of the created file is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isImage") - public _FinalStage isImage(boolean isImage) { - this.isImage = isImage; - return this; - } - - /** - *

The height of the image in pixels if the asset is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage pixelHeight(Integer pixelHeight) { - this.pixelHeight = Optional.of(pixelHeight); - return this; - } - - @Override - @JsonSetter(value = "pixelHeight", nulls = Nulls.SKIP) - public _FinalStage pixelHeight(Optional pixelHeight) { - this.pixelHeight = pixelHeight; - return this; - } - - /** - *

The width of the image in pixels if the asset is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage pixelWidth(Integer pixelWidth) { - this.pixelWidth = Optional.of(pixelWidth); - return this; - } - - @Override - @JsonSetter(value = "pixelWidth", nulls = Nulls.SKIP) - public _FinalStage pixelWidth(Optional pixelWidth) { - this.pixelWidth = pixelWidth; - return this; - } - - @Override - public _FinalStage meta(AssetMeta meta) { - this.meta = Optional.of(meta); - return this; - } - - @Override - @JsonSetter(value = "_meta", nulls = Nulls.SKIP) - public _FinalStage meta(Optional meta) { - this.meta = meta; - return this; - } - - /** - *

The asset tags.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - /** - *

The asset metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage metadata(String key, Object value) { - this.metadata.put(key, value); - return this; - } - - /** - *

The asset metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllMetadata(Map metadata) { - this.metadata.putAll(metadata); - return this; - } - - @Override - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public _FinalStage metadata(Map metadata) { - this.metadata.clear(); - this.metadata.putAll(metadata); - return this; - } - - /** - *

The UI token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage editToken(String editToken) { - this.editToken = Optional.of(editToken); - return this; - } - - @Override - @JsonSetter(value = "editToken", nulls = Nulls.SKIP) - public _FinalStage editToken(Optional editToken) { - this.editToken = editToken; - return this; - } - - /** - *

The file hash.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fileHash(String fileHash) { - this.fileHash = Optional.of(fileHash); - return this; - } - - @Override - @JsonSetter(value = "fileHash", nulls = Nulls.SKIP) - public _FinalStage fileHash(Optional fileHash) { - this.fileHash = fileHash; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetDto build() { - return new AssetDto( - links, - id, - parentId, - fileName, - fileHash, - isProtected, - slug, - mimeType, - fileType, - metadataText, - editToken, - metadata, - tags, - fileSize, - fileVersion, - type, - createdBy, - lastModifiedBy, - created, - lastModified, - version, - meta, - isImage, - pixelWidth, - pixelHeight); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetFolderDto.java b/src/main/java/com/squidex/api/types/AssetFolderDto.java deleted file mode 100644 index d7cf8bc..0000000 --- a/src/main/java/com/squidex/api/types/AssetFolderDto.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetFolderDto.Builder.class) -public final class AssetFolderDto implements IResource { - private final Map links; - - private final String id; - - private final String parentId; - - private final String folderName; - - private final int version; - - private AssetFolderDto( - Map links, String id, String parentId, String folderName, int version) { - this.links = links; - this.id = id; - this.parentId = parentId; - this.folderName = folderName; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the asset. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The ID of the parent folder. Empty for files without parent. - */ - @JsonProperty("parentId") - public String getParentId() { - return parentId; - } - - /** - * @return The folder name. - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - /** - * @return The version of the asset folder. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetFolderDto && equalTo((AssetFolderDto) other); - } - - private boolean equalTo(AssetFolderDto other) { - return links.equals(other.links) - && id.equals(other.id) - && parentId.equals(other.parentId) - && folderName.equals(other.folderName) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.parentId, this.folderName, this.version); - } - - @Override - public String toString() { - return "AssetFolderDto{" + "links: " + links + ", id: " + id + ", parentId: " + parentId + ", folderName: " - + folderName + ", version: " + version + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - ParentIdStage id(String id); - - Builder from(AssetFolderDto other); - } - - public interface ParentIdStage { - FolderNameStage parentId(String parentId); - } - - public interface FolderNameStage { - VersionStage folderName(String folderName); - } - - public interface VersionStage { - _FinalStage version(int version); - } - - public interface _FinalStage { - AssetFolderDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, ParentIdStage, FolderNameStage, VersionStage, _FinalStage { - private String id; - - private String parentId; - - private String folderName; - - private int version; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetFolderDto other) { - links(other.getLinks()); - id(other.getId()); - parentId(other.getParentId()); - folderName(other.getFolderName()); - version(other.getVersion()); - return this; - } - - /** - *

The ID of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public ParentIdStage id(String id) { - this.id = id; - return this; - } - - /** - *

The ID of the parent folder. Empty for files without parent.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("parentId") - public FolderNameStage parentId(String parentId) { - this.parentId = parentId; - return this; - } - - /** - *

The folder name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public VersionStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - /** - *

The version of the asset folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetFolderDto build() { - return new AssetFolderDto(links, id, parentId, folderName, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetFolderScope.java b/src/main/java/com/squidex/api/types/AssetFolderScope.java deleted file mode 100644 index f8eb04f..0000000 --- a/src/main/java/com/squidex/api/types/AssetFolderScope.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum AssetFolderScope { - PATH_AND_ITEMS("PathAndItems"), - - PATH("Path"), - - ITEMS("Items"); - - private final String value; - - AssetFolderScope(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/AssetFoldersDto.java b/src/main/java/com/squidex/api/types/AssetFoldersDto.java deleted file mode 100644 index 44d6ce6..0000000 --- a/src/main/java/com/squidex/api/types/AssetFoldersDto.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetFoldersDto.Builder.class) -public final class AssetFoldersDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private final List path; - - private AssetFoldersDto( - Map links, int total, List items, List path) { - this.links = links; - this.total = total; - this.items = items; - this.path = path; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of assets. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The assets folders. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The path to the current folder. - */ - @JsonProperty("path") - public List getPath() { - return path; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetFoldersDto && equalTo((AssetFoldersDto) other); - } - - private boolean equalTo(AssetFoldersDto other) { - return links.equals(other.links) - && total == other.total - && items.equals(other.items) - && path.equals(other.path); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items, this.path); - } - - @Override - public String toString() { - return "AssetFoldersDto{" + "links: " + links + ", total: " + total + ", items: " + items + ", path: " + path - + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(AssetFoldersDto other); - } - - public interface _FinalStage { - AssetFoldersDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(AssetFolderDto items); - - _FinalStage addAllItems(List items); - - _FinalStage path(List path); - - _FinalStage addPath(AssetFolderDto path); - - _FinalStage addAllPath(List path); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List path = new ArrayList<>(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetFoldersDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - path(other.getPath()); - return this; - } - - /** - *

The total number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The path to the current folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPath(List path) { - this.path.addAll(path); - return this; - } - - /** - *

The path to the current folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPath(AssetFolderDto path) { - this.path.add(path); - return this; - } - - @Override - @JsonSetter(value = "path", nulls = Nulls.SKIP) - public _FinalStage path(List path) { - this.path.clear(); - this.path.addAll(path); - return this; - } - - /** - *

The assets folders.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The assets folders.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(AssetFolderDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetFoldersDto build() { - return new AssetFoldersDto(links, total, items, path); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetMeta.java b/src/main/java/com/squidex/api/types/AssetMeta.java deleted file mode 100644 index e88d475..0000000 --- a/src/main/java/com/squidex/api/types/AssetMeta.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetMeta.Builder.class) -public final class AssetMeta { - private final String isDuplicate; - - private AssetMeta(String isDuplicate) { - this.isDuplicate = isDuplicate; - } - - /** - * @return Indicates whether the asset is a duplicate. - */ - @JsonProperty("isDuplicate") - public String getIsDuplicate() { - return isDuplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetMeta && equalTo((AssetMeta) other); - } - - private boolean equalTo(AssetMeta other) { - return isDuplicate.equals(other.isDuplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.isDuplicate); - } - - @Override - public String toString() { - return "AssetMeta{" + "isDuplicate: " + isDuplicate + "}"; - } - - public static IsDuplicateStage builder() { - return new Builder(); - } - - public interface IsDuplicateStage { - _FinalStage isDuplicate(String isDuplicate); - - Builder from(AssetMeta other); - } - - public interface _FinalStage { - AssetMeta build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsDuplicateStage, _FinalStage { - private String isDuplicate; - - private Builder() {} - - @Override - public Builder from(AssetMeta other) { - isDuplicate(other.getIsDuplicate()); - return this; - } - - /** - *

Indicates whether the asset is a duplicate.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDuplicate") - public _FinalStage isDuplicate(String isDuplicate) { - this.isDuplicate = isDuplicate; - return this; - } - - @Override - public AssetMeta build() { - return new AssetMeta(isDuplicate); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetPreviewMode.java b/src/main/java/com/squidex/api/types/AssetPreviewMode.java deleted file mode 100644 index 1c793c3..0000000 --- a/src/main/java/com/squidex/api/types/AssetPreviewMode.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum AssetPreviewMode { - IMAGE_AND_FILE_NAME("ImageAndFileName"), - - IMAGE("Image"), - - FILE_NAME("FileName"); - - private final String value; - - AssetPreviewMode(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/AssetScriptsDto.java b/src/main/java/com/squidex/api/types/AssetScriptsDto.java deleted file mode 100644 index 4f2a532..0000000 --- a/src/main/java/com/squidex/api/types/AssetScriptsDto.java +++ /dev/null @@ -1,415 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetScriptsDto.Builder.class) -public final class AssetScriptsDto implements IResource { - private final Map links; - - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional annotate; - - private final Optional move; - - private final Optional delete; - - private final int version; - - private AssetScriptsDto( - Map links, - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional annotate, - Optional move, - Optional delete, - int version) { - this.links = links; - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.annotate = annotate; - this.move = move; - this.delete = delete; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The script that is executed for each asset when querying assets. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all assets when querying assets. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating an asset. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when annotating a content. - */ - @JsonProperty("annotate") - public Optional getAnnotate() { - return annotate; - } - - /** - * @return The script that is executed when moving a content. - */ - @JsonProperty("move") - public Optional getMove() { - return move; - } - - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetScriptsDto && equalTo((AssetScriptsDto) other); - } - - private boolean equalTo(AssetScriptsDto other) { - return links.equals(other.links) - && query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && annotate.equals(other.annotate) - && move.equals(other.move) - && delete.equals(other.delete) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.query, - this.queryPre, - this.create, - this.update, - this.annotate, - this.move, - this.delete, - this.version); - } - - @Override - public String toString() { - return "AssetScriptsDto{" + "links: " + links + ", query: " + query + ", queryPre: " + queryPre + ", create: " - + create + ", update: " + update + ", annotate: " + annotate + ", move: " + move + ", delete: " + delete - + ", version: " + version + "}"; - } - - public static VersionStage builder() { - return new Builder(); - } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(AssetScriptsDto other); - } - - public interface _FinalStage { - AssetScriptsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage query(Optional query); - - _FinalStage query(String query); - - _FinalStage queryPre(Optional queryPre); - - _FinalStage queryPre(String queryPre); - - _FinalStage create(Optional create); - - _FinalStage create(String create); - - _FinalStage update(Optional update); - - _FinalStage update(String update); - - _FinalStage annotate(Optional annotate); - - _FinalStage annotate(String annotate); - - _FinalStage move(Optional move); - - _FinalStage move(String move); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private Optional delete = Optional.empty(); - - private Optional move = Optional.empty(); - - private Optional annotate = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional query = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetScriptsDto other) { - links(other.getLinks()); - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - annotate(other.getAnnotate()); - move(other.getMove()); - delete(other.getDelete()); - version(other.getVersion()); - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The script that is executed when deleting a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The script that is executed when moving a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage move(String move) { - this.move = Optional.of(move); - return this; - } - - @Override - @JsonSetter(value = "move", nulls = Nulls.SKIP) - public _FinalStage move(Optional move) { - this.move = move; - return this; - } - - /** - *

The script that is executed when annotating a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage annotate(String annotate) { - this.annotate = Optional.of(annotate); - return this; - } - - @Override - @JsonSetter(value = "annotate", nulls = Nulls.SKIP) - public _FinalStage annotate(Optional annotate) { - this.annotate = annotate; - return this; - } - - /** - *

The script that is executed when updating a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage update(String update) { - this.update = Optional.of(update); - return this; - } - - @Override - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public _FinalStage update(Optional update) { - this.update = update; - return this; - } - - /** - *

The script that is executed when creating an asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage create(String create) { - this.create = Optional.of(create); - return this; - } - - @Override - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public _FinalStage create(Optional create) { - this.create = create; - return this; - } - - /** - *

The script that is executed for all assets when querying assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @Override - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public _FinalStage queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - /** - *

The script that is executed for each asset when querying assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage query(String query) { - this.query = Optional.of(query); - return this; - } - - @Override - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public _FinalStage query(Optional query) { - this.query = query; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetScriptsDto build() { - return new AssetScriptsDto(links, query, queryPre, create, update, annotate, move, delete, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetType.java b/src/main/java/com/squidex/api/types/AssetType.java deleted file mode 100644 index e2d14c0..0000000 --- a/src/main/java/com/squidex/api/types/AssetType.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum AssetType { - UNKNOWN("Unknown"), - - IMAGE("Image"), - - AUDIO("Audio"), - - VIDEO("Video"); - - private final String value; - - AssetType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/AssetsDto.java b/src/main/java/com/squidex/api/types/AssetsDto.java deleted file mode 100644 index 195fd18..0000000 --- a/src/main/java/com/squidex/api/types/AssetsDto.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsDto.Builder.class) -public final class AssetsDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private AssetsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of assets. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The assets. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsDto && equalTo((AssetsDto) other); - } - - private boolean equalTo(AssetsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); - } - - @Override - public String toString() { - return "AssetsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(AssetsDto other); - } - - public interface _FinalStage { - AssetsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(AssetDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; - } - - /** - *

The total number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(AssetDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetsDto build() { - return new AssetsDto(links, total, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java deleted file mode 100644 index fac1027..0000000 --- a/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java +++ /dev/null @@ -1,662 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsFieldPropertiesDto.Builder.class) -public final class AssetsFieldPropertiesDto { - private final Optional previewMode; - - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional folderId; - - private final Optional previewFormat; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional minSize; - - private final Optional maxSize; - - private final Optional minWidth; - - private final Optional maxWidth; - - private final Optional minHeight; - - private final Optional maxHeight; - - private final Optional aspectWidth; - - private final Optional aspectHeight; - - private final Optional expectedType; - - private final Optional resolveFirst; - - private final Optional mustBeImage; - - private final Optional resolveImage; - - private final Optional> allowedExtensions; - - private final Optional allowDuplicates; - - private AssetsFieldPropertiesDto( - Optional previewMode, - Optional>> defaultValues, - Optional> defaultValue, - Optional folderId, - Optional previewFormat, - Optional minItems, - Optional maxItems, - Optional minSize, - Optional maxSize, - Optional minWidth, - Optional maxWidth, - Optional minHeight, - Optional maxHeight, - Optional aspectWidth, - Optional aspectHeight, - Optional expectedType, - Optional resolveFirst, - Optional mustBeImage, - Optional resolveImage, - Optional> allowedExtensions, - Optional allowDuplicates) { - this.previewMode = previewMode; - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.folderId = folderId; - this.previewFormat = previewFormat; - this.minItems = minItems; - this.maxItems = maxItems; - this.minSize = minSize; - this.maxSize = maxSize; - this.minWidth = minWidth; - this.maxWidth = maxWidth; - this.minHeight = minHeight; - this.maxHeight = maxHeight; - this.aspectWidth = aspectWidth; - this.aspectHeight = aspectHeight; - this.expectedType = expectedType; - this.resolveFirst = resolveFirst; - this.mustBeImage = mustBeImage; - this.resolveImage = resolveImage; - this.allowedExtensions = allowedExtensions; - this.allowDuplicates = allowDuplicates; - } - - @JsonProperty("previewMode") - public Optional getPreviewMode() { - return previewMode; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value as a list of asset ids. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The initial id to the folder. - */ - @JsonProperty("folderId") - public Optional getFolderId() { - return folderId; - } - - /** - * @return The preview format. - */ - @JsonProperty("previewFormat") - public Optional getPreviewFormat() { - return previewFormat; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return The minimum file size in bytes. - */ - @JsonProperty("minSize") - public Optional getMinSize() { - return minSize; - } - - /** - * @return The maximum file size in bytes. - */ - @JsonProperty("maxSize") - public Optional getMaxSize() { - return maxSize; - } - - /** - * @return The minimum image width in pixels. - */ - @JsonProperty("minWidth") - public Optional getMinWidth() { - return minWidth; - } - - /** - * @return The maximum image width in pixels. - */ - @JsonProperty("maxWidth") - public Optional getMaxWidth() { - return maxWidth; - } - - /** - * @return The minimum image height in pixels. - */ - @JsonProperty("minHeight") - public Optional getMinHeight() { - return minHeight; - } - - /** - * @return The maximum image height in pixels. - */ - @JsonProperty("maxHeight") - public Optional getMaxHeight() { - return maxHeight; - } - - /** - * @return The image aspect width in pixels. - */ - @JsonProperty("aspectWidth") - public Optional getAspectWidth() { - return aspectWidth; - } - - /** - * @return The image aspect height in pixels. - */ - @JsonProperty("aspectHeight") - public Optional getAspectHeight() { - return aspectHeight; - } - - @JsonProperty("expectedType") - public Optional getExpectedType() { - return expectedType; - } - - /** - * @return True to resolve first asset in the content list. - */ - @JsonProperty("resolveFirst") - public Optional getResolveFirst() { - return resolveFirst; - } - - /** - * @return True to resolve first image in the content list. - */ - @JsonProperty("mustBeImage") - public Optional getMustBeImage() { - return mustBeImage; - } - - /** - * @return True to resolve first image in the content list. - */ - @JsonProperty("resolveImage") - public Optional getResolveImage() { - return resolveImage; - } - - /** - * @return The allowed file extensions. - */ - @JsonProperty("allowedExtensions") - public Optional> getAllowedExtensions() { - return allowedExtensions; - } - - /** - * @return True, if duplicate values are allowed. - */ - @JsonProperty("allowDuplicates") - public Optional getAllowDuplicates() { - return allowDuplicates; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsFieldPropertiesDto && equalTo((AssetsFieldPropertiesDto) other); - } - - private boolean equalTo(AssetsFieldPropertiesDto other) { - return previewMode.equals(other.previewMode) - && defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && folderId.equals(other.folderId) - && previewFormat.equals(other.previewFormat) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && minSize.equals(other.minSize) - && maxSize.equals(other.maxSize) - && minWidth.equals(other.minWidth) - && maxWidth.equals(other.maxWidth) - && minHeight.equals(other.minHeight) - && maxHeight.equals(other.maxHeight) - && aspectWidth.equals(other.aspectWidth) - && aspectHeight.equals(other.aspectHeight) - && expectedType.equals(other.expectedType) - && resolveFirst.equals(other.resolveFirst) - && mustBeImage.equals(other.mustBeImage) - && resolveImage.equals(other.resolveImage) - && allowedExtensions.equals(other.allowedExtensions) - && allowDuplicates.equals(other.allowDuplicates); - } - - @Override - public int hashCode() { - return Objects.hash( - this.previewMode, - this.defaultValues, - this.defaultValue, - this.folderId, - this.previewFormat, - this.minItems, - this.maxItems, - this.minSize, - this.maxSize, - this.minWidth, - this.maxWidth, - this.minHeight, - this.maxHeight, - this.aspectWidth, - this.aspectHeight, - this.expectedType, - this.resolveFirst, - this.mustBeImage, - this.resolveImage, - this.allowedExtensions, - this.allowDuplicates); - } - - @Override - public String toString() { - return "AssetsFieldPropertiesDto{" + "previewMode: " + previewMode + ", defaultValues: " + defaultValues - + ", defaultValue: " + defaultValue + ", folderId: " + folderId + ", previewFormat: " + previewFormat - + ", minItems: " + minItems + ", maxItems: " + maxItems + ", minSize: " + minSize + ", maxSize: " - + maxSize + ", minWidth: " + minWidth + ", maxWidth: " + maxWidth + ", minHeight: " + minHeight - + ", maxHeight: " + maxHeight + ", aspectWidth: " + aspectWidth + ", aspectHeight: " + aspectHeight - + ", expectedType: " + expectedType + ", resolveFirst: " + resolveFirst + ", mustBeImage: " - + mustBeImage + ", resolveImage: " + resolveImage + ", allowedExtensions: " + allowedExtensions - + ", allowDuplicates: " + allowDuplicates + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional previewMode = Optional.empty(); - - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional folderId = Optional.empty(); - - private Optional previewFormat = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional minSize = Optional.empty(); - - private Optional maxSize = Optional.empty(); - - private Optional minWidth = Optional.empty(); - - private Optional maxWidth = Optional.empty(); - - private Optional minHeight = Optional.empty(); - - private Optional maxHeight = Optional.empty(); - - private Optional aspectWidth = Optional.empty(); - - private Optional aspectHeight = Optional.empty(); - - private Optional expectedType = Optional.empty(); - - private Optional resolveFirst = Optional.empty(); - - private Optional mustBeImage = Optional.empty(); - - private Optional resolveImage = Optional.empty(); - - private Optional> allowedExtensions = Optional.empty(); - - private Optional allowDuplicates = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsFieldPropertiesDto other) { - previewMode(other.getPreviewMode()); - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - folderId(other.getFolderId()); - previewFormat(other.getPreviewFormat()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - minSize(other.getMinSize()); - maxSize(other.getMaxSize()); - minWidth(other.getMinWidth()); - maxWidth(other.getMaxWidth()); - minHeight(other.getMinHeight()); - maxHeight(other.getMaxHeight()); - aspectWidth(other.getAspectWidth()); - aspectHeight(other.getAspectHeight()); - expectedType(other.getExpectedType()); - resolveFirst(other.getResolveFirst()); - mustBeImage(other.getMustBeImage()); - resolveImage(other.getResolveImage()); - allowedExtensions(other.getAllowedExtensions()); - allowDuplicates(other.getAllowDuplicates()); - return this; - } - - @JsonSetter(value = "previewMode", nulls = Nulls.SKIP) - public Builder previewMode(Optional previewMode) { - this.previewMode = previewMode; - return this; - } - - public Builder previewMode(AssetPreviewMode previewMode) { - this.previewMode = Optional.of(previewMode); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "folderId", nulls = Nulls.SKIP) - public Builder folderId(Optional folderId) { - this.folderId = folderId; - return this; - } - - public Builder folderId(String folderId) { - this.folderId = Optional.of(folderId); - return this; - } - - @JsonSetter(value = "previewFormat", nulls = Nulls.SKIP) - public Builder previewFormat(Optional previewFormat) { - this.previewFormat = previewFormat; - return this; - } - - public Builder previewFormat(String previewFormat) { - this.previewFormat = Optional.of(previewFormat); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "minSize", nulls = Nulls.SKIP) - public Builder minSize(Optional minSize) { - this.minSize = minSize; - return this; - } - - public Builder minSize(Integer minSize) { - this.minSize = Optional.of(minSize); - return this; - } - - @JsonSetter(value = "maxSize", nulls = Nulls.SKIP) - public Builder maxSize(Optional maxSize) { - this.maxSize = maxSize; - return this; - } - - public Builder maxSize(Integer maxSize) { - this.maxSize = Optional.of(maxSize); - return this; - } - - @JsonSetter(value = "minWidth", nulls = Nulls.SKIP) - public Builder minWidth(Optional minWidth) { - this.minWidth = minWidth; - return this; - } - - public Builder minWidth(Integer minWidth) { - this.minWidth = Optional.of(minWidth); - return this; - } - - @JsonSetter(value = "maxWidth", nulls = Nulls.SKIP) - public Builder maxWidth(Optional maxWidth) { - this.maxWidth = maxWidth; - return this; - } - - public Builder maxWidth(Integer maxWidth) { - this.maxWidth = Optional.of(maxWidth); - return this; - } - - @JsonSetter(value = "minHeight", nulls = Nulls.SKIP) - public Builder minHeight(Optional minHeight) { - this.minHeight = minHeight; - return this; - } - - public Builder minHeight(Integer minHeight) { - this.minHeight = Optional.of(minHeight); - return this; - } - - @JsonSetter(value = "maxHeight", nulls = Nulls.SKIP) - public Builder maxHeight(Optional maxHeight) { - this.maxHeight = maxHeight; - return this; - } - - public Builder maxHeight(Integer maxHeight) { - this.maxHeight = Optional.of(maxHeight); - return this; - } - - @JsonSetter(value = "aspectWidth", nulls = Nulls.SKIP) - public Builder aspectWidth(Optional aspectWidth) { - this.aspectWidth = aspectWidth; - return this; - } - - public Builder aspectWidth(Integer aspectWidth) { - this.aspectWidth = Optional.of(aspectWidth); - return this; - } - - @JsonSetter(value = "aspectHeight", nulls = Nulls.SKIP) - public Builder aspectHeight(Optional aspectHeight) { - this.aspectHeight = aspectHeight; - return this; - } - - public Builder aspectHeight(Integer aspectHeight) { - this.aspectHeight = Optional.of(aspectHeight); - return this; - } - - @JsonSetter(value = "expectedType", nulls = Nulls.SKIP) - public Builder expectedType(Optional expectedType) { - this.expectedType = expectedType; - return this; - } - - public Builder expectedType(AssetType expectedType) { - this.expectedType = Optional.of(expectedType); - return this; - } - - @JsonSetter(value = "resolveFirst", nulls = Nulls.SKIP) - public Builder resolveFirst(Optional resolveFirst) { - this.resolveFirst = resolveFirst; - return this; - } - - public Builder resolveFirst(Boolean resolveFirst) { - this.resolveFirst = Optional.of(resolveFirst); - return this; - } - - @JsonSetter(value = "mustBeImage", nulls = Nulls.SKIP) - public Builder mustBeImage(Optional mustBeImage) { - this.mustBeImage = mustBeImage; - return this; - } - - public Builder mustBeImage(Boolean mustBeImage) { - this.mustBeImage = Optional.of(mustBeImage); - return this; - } - - @JsonSetter(value = "resolveImage", nulls = Nulls.SKIP) - public Builder resolveImage(Optional resolveImage) { - this.resolveImage = resolveImage; - return this; - } - - public Builder resolveImage(Boolean resolveImage) { - this.resolveImage = Optional.of(resolveImage); - return this; - } - - @JsonSetter(value = "allowedExtensions", nulls = Nulls.SKIP) - public Builder allowedExtensions(Optional> allowedExtensions) { - this.allowedExtensions = allowedExtensions; - return this; - } - - public Builder allowedExtensions(List allowedExtensions) { - this.allowedExtensions = Optional.of(allowedExtensions); - return this; - } - - @JsonSetter(value = "allowDuplicates", nulls = Nulls.SKIP) - public Builder allowDuplicates(Optional allowDuplicates) { - this.allowDuplicates = allowDuplicates; - return this; - } - - public Builder allowDuplicates(Boolean allowDuplicates) { - this.allowDuplicates = Optional.of(allowDuplicates); - return this; - } - - public AssetsFieldPropertiesDto build() { - return new AssetsFieldPropertiesDto( - previewMode, - defaultValues, - defaultValue, - folderId, - previewFormat, - minItems, - maxItems, - minSize, - maxSize, - minWidth, - maxWidth, - minHeight, - maxHeight, - aspectWidth, - aspectHeight, - expectedType, - resolveFirst, - mustBeImage, - resolveImage, - allowedExtensions, - allowDuplicates); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AssignContributorDto.java b/src/main/java/com/squidex/api/types/AssignContributorDto.java deleted file mode 100644 index 0b90358..0000000 --- a/src/main/java/com/squidex/api/types/AssignContributorDto.java +++ /dev/null @@ -1,162 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssignContributorDto.Builder.class) -public final class AssignContributorDto { - private final String contributorId; - - private final Optional role; - - private final Optional invite; - - private AssignContributorDto(String contributorId, Optional role, Optional invite) { - this.contributorId = contributorId; - this.role = role; - this.invite = invite; - } - - /** - * @return The id or email of the user to add to the app. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("contributorId") - public String getContributorId() { - return contributorId; - } - - /** - * @return The role of the contributor. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - /** - * @return Set to true to invite the user if he does not exist. - */ - @JsonProperty("invite") - public Optional getInvite() { - return invite; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssignContributorDto && equalTo((AssignContributorDto) other); - } - - private boolean equalTo(AssignContributorDto other) { - return contributorId.equals(other.contributorId) && role.equals(other.role) && invite.equals(other.invite); - } - - @Override - public int hashCode() { - return Objects.hash(this.contributorId, this.role, this.invite); - } - - @Override - public String toString() { - return "AssignContributorDto{" + "contributorId: " + contributorId + ", role: " + role + ", invite: " + invite - + "}"; - } - - public static ContributorIdStage builder() { - return new Builder(); - } - - public interface ContributorIdStage { - _FinalStage contributorId(String contributorId); - - Builder from(AssignContributorDto other); - } - - public interface _FinalStage { - AssignContributorDto build(); - - _FinalStage role(Optional role); - - _FinalStage role(String role); - - _FinalStage invite(Optional invite); - - _FinalStage invite(Boolean invite); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ContributorIdStage, _FinalStage { - private String contributorId; - - private Optional invite = Optional.empty(); - - private Optional role = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AssignContributorDto other) { - contributorId(other.getContributorId()); - role(other.getRole()); - invite(other.getInvite()); - return this; - } - - /** - *

The id or email of the user to add to the app. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorId") - public _FinalStage contributorId(String contributorId) { - this.contributorId = contributorId; - return this; - } - - /** - *

Set to true to invite the user if he does not exist.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage invite(Boolean invite) { - this.invite = Optional.of(invite); - return this; - } - - @Override - @JsonSetter(value = "invite", nulls = Nulls.SKIP) - public _FinalStage invite(Optional invite) { - this.invite = invite; - return this; - } - - /** - *

The role of the contributor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } - - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } - - @Override - public AssignContributorDto build() { - return new AssignContributorDto(contributorId, role, invite); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java b/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java deleted file mode 100644 index df3a9d6..0000000 --- a/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AzureQueueRuleActionDto.Builder.class) -public final class AzureQueueRuleActionDto { - private final String connectionString; - - private final String queue; - - private final Optional payload; - - private AzureQueueRuleActionDto(String connectionString, String queue, Optional payload) { - this.connectionString = connectionString; - this.queue = queue; - this.payload = payload; - } - - /** - * @return The connection string to the storage account. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("connectionString") - public String getConnectionString() { - return connectionString; - } - - /** - * @return The name of the queue. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("queue") - public String getQueue() { - return queue; - } - - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AzureQueueRuleActionDto && equalTo((AzureQueueRuleActionDto) other); - } - - private boolean equalTo(AzureQueueRuleActionDto other) { - return connectionString.equals(other.connectionString) - && queue.equals(other.queue) - && payload.equals(other.payload); - } - - @Override - public int hashCode() { - return Objects.hash(this.connectionString, this.queue, this.payload); - } - - @Override - public String toString() { - return "AzureQueueRuleActionDto{" + "connectionString: " + connectionString + ", queue: " + queue - + ", payload: " + payload + "}"; - } - - public static ConnectionStringStage builder() { - return new Builder(); - } - - public interface ConnectionStringStage { - QueueStage connectionString(String connectionString); - - Builder from(AzureQueueRuleActionDto other); - } - - public interface QueueStage { - _FinalStage queue(String queue); - } - - public interface _FinalStage { - AzureQueueRuleActionDto build(); - - _FinalStage payload(Optional payload); - - _FinalStage payload(String payload); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ConnectionStringStage, QueueStage, _FinalStage { - private String connectionString; - - private String queue; - - private Optional payload = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AzureQueueRuleActionDto other) { - connectionString(other.getConnectionString()); - queue(other.getQueue()); - payload(other.getPayload()); - return this; - } - - /** - *

The connection string to the storage account. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("connectionString") - public QueueStage connectionString(String connectionString) { - this.connectionString = connectionString; - return this; - } - - /** - *

The name of the queue. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("queue") - public _FinalStage queue(String queue) { - this.queue = queue; - return this; - } - - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } - - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } - - @Override - public AzureQueueRuleActionDto build() { - return new AzureQueueRuleActionDto(connectionString, queue, payload); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BackupJobDto.java b/src/main/java/com/squidex/api/types/BackupJobDto.java deleted file mode 100644 index 3b11cff..0000000 --- a/src/main/java/com/squidex/api/types/BackupJobDto.java +++ /dev/null @@ -1,304 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupJobDto.Builder.class) -public final class BackupJobDto implements IResource { - private final Map links; - - private final String id; - - private final OffsetDateTime started; - - private final Optional stopped; - - private final int handledEvents; - - private final int handledAssets; - - private final JobStatus status; - - private BackupJobDto( - Map links, - String id, - OffsetDateTime started, - Optional stopped, - int handledEvents, - int handledAssets, - JobStatus status) { - this.links = links; - this.id = id; - this.started = started; - this.stopped = stopped; - this.handledEvents = handledEvents; - this.handledAssets = handledAssets; - this.status = status; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the backup job. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the job has been started. - */ - @JsonProperty("started") - public OffsetDateTime getStarted() { - return started; - } - - /** - * @return The time when the job has been stopped. - */ - @JsonProperty("stopped") - public Optional getStopped() { - return stopped; - } - - /** - * @return The number of handled events. - */ - @JsonProperty("handledEvents") - public int getHandledEvents() { - return handledEvents; - } - - /** - * @return The number of handled assets. - */ - @JsonProperty("handledAssets") - public int getHandledAssets() { - return handledAssets; - } - - @JsonProperty("status") - public JobStatus getStatus() { - return status; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupJobDto && equalTo((BackupJobDto) other); - } - - private boolean equalTo(BackupJobDto other) { - return links.equals(other.links) - && id.equals(other.id) - && started.equals(other.started) - && stopped.equals(other.stopped) - && handledEvents == other.handledEvents - && handledAssets == other.handledAssets - && status.equals(other.status); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.id, this.started, this.stopped, this.handledEvents, this.handledAssets, this.status); - } - - @Override - public String toString() { - return "BackupJobDto{" + "links: " + links + ", id: " + id + ", started: " + started + ", stopped: " + stopped - + ", handledEvents: " + handledEvents + ", handledAssets: " + handledAssets + ", status: " + status - + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - StartedStage id(String id); - - Builder from(BackupJobDto other); - } - - public interface StartedStage { - HandledEventsStage started(OffsetDateTime started); - } - - public interface HandledEventsStage { - HandledAssetsStage handledEvents(int handledEvents); - } - - public interface HandledAssetsStage { - StatusStage handledAssets(int handledAssets); - } - - public interface StatusStage { - _FinalStage status(JobStatus status); - } - - public interface _FinalStage { - BackupJobDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage stopped(Optional stopped); - - _FinalStage stopped(OffsetDateTime stopped); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, StartedStage, HandledEventsStage, HandledAssetsStage, StatusStage, _FinalStage { - private String id; - - private OffsetDateTime started; - - private int handledEvents; - - private int handledAssets; - - private JobStatus status; - - private Optional stopped = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(BackupJobDto other) { - links(other.getLinks()); - id(other.getId()); - started(other.getStarted()); - stopped(other.getStopped()); - handledEvents(other.getHandledEvents()); - handledAssets(other.getHandledAssets()); - status(other.getStatus()); - return this; - } - - /** - *

The ID of the backup job.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public StartedStage id(String id) { - this.id = id; - return this; - } - - /** - *

The time when the job has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("started") - public HandledEventsStage started(OffsetDateTime started) { - this.started = started; - return this; - } - - /** - *

The number of handled events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handledEvents") - public HandledAssetsStage handledEvents(int handledEvents) { - this.handledEvents = handledEvents; - return this; - } - - /** - *

The number of handled assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handledAssets") - public StatusStage handledAssets(int handledAssets) { - this.handledAssets = handledAssets; - return this; - } - - @Override - @JsonSetter("status") - public _FinalStage status(JobStatus status) { - this.status = status; - return this; - } - - /** - *

The time when the job has been stopped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage stopped(OffsetDateTime stopped) { - this.stopped = Optional.of(stopped); - return this; - } - - @Override - @JsonSetter(value = "stopped", nulls = Nulls.SKIP) - public _FinalStage stopped(Optional stopped) { - this.stopped = stopped; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public BackupJobDto build() { - return new BackupJobDto(links, id, started, stopped, handledEvents, handledAssets, status); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BackupJobsDto.java b/src/main/java/com/squidex/api/types/BackupJobsDto.java deleted file mode 100644 index 9e51be8..0000000 --- a/src/main/java/com/squidex/api/types/BackupJobsDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupJobsDto.Builder.class) -public final class BackupJobsDto implements IResource { - private final Map links; - - private final List items; - - private BackupJobsDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The backups. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupJobsDto && equalTo((BackupJobsDto) other); - } - - private boolean equalTo(BackupJobsDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "BackupJobsDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(BackupJobsDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(BackupJobDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public BackupJobsDto build() { - return new BackupJobsDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BooleanFieldEditor.java b/src/main/java/com/squidex/api/types/BooleanFieldEditor.java deleted file mode 100644 index c49a17d..0000000 --- a/src/main/java/com/squidex/api/types/BooleanFieldEditor.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum BooleanFieldEditor { - CHECKBOX("Checkbox"), - - TOGGLE("Toggle"); - - private final String value; - - BooleanFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java deleted file mode 100644 index e6da4d6..0000000 --- a/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BooleanFieldPropertiesDto.Builder.class) -public final class BooleanFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional defaultValue; - - private final Optional inlineEditable; - - private final Optional editor; - - private BooleanFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional inlineEditable, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.inlineEditable = inlineEditable; - this.editor = editor; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanFieldPropertiesDto && equalTo((BooleanFieldPropertiesDto) other); - } - - private boolean equalTo(BooleanFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && inlineEditable.equals(other.inlineEditable) - && editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash(this.defaultValues, this.defaultValue, this.inlineEditable, this.editor); - } - - @Override - public String toString() { - return "BooleanFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", inlineEditable: " + inlineEditable + ", editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional inlineEditable = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(BooleanFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - inlineEditable(other.getInlineEditable()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(Boolean defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; - } - - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(BooleanFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public BooleanFieldPropertiesDto build() { - return new BooleanFieldPropertiesDto(defaultValues, defaultValue, inlineEditable, editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BulkResultDto.java b/src/main/java/com/squidex/api/types/BulkResultDto.java deleted file mode 100644 index 22fc0f4..0000000 --- a/src/main/java/com/squidex/api/types/BulkResultDto.java +++ /dev/null @@ -1,193 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkResultDto.Builder.class) -public final class BulkResultDto { - private final Optional error; - - private final int jobIndex; - - private final Optional id; - - private final Optional contentId; - - private BulkResultDto(Optional error, int jobIndex, Optional id, Optional contentId) { - this.error = error; - this.jobIndex = jobIndex; - this.id = id; - this.contentId = contentId; - } - - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The index of the bulk job where the result belongs to. The order can change. - */ - @JsonProperty("jobIndex") - public int getJobIndex() { - return jobIndex; - } - - /** - * @return The ID of the entity that has been handled successfully or not. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The ID of the entity that has been handled successfully or not. - */ - @JsonProperty("contentId") - public Optional getContentId() { - return contentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkResultDto && equalTo((BulkResultDto) other); - } - - private boolean equalTo(BulkResultDto other) { - return error.equals(other.error) - && jobIndex == other.jobIndex - && id.equals(other.id) - && contentId.equals(other.contentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.error, this.jobIndex, this.id, this.contentId); - } - - @Override - public String toString() { - return "BulkResultDto{" + "error: " + error + ", jobIndex: " + jobIndex + ", id: " + id + ", contentId: " - + contentId + "}"; - } - - public static JobIndexStage builder() { - return new Builder(); - } - - public interface JobIndexStage { - _FinalStage jobIndex(int jobIndex); - - Builder from(BulkResultDto other); - } - - public interface _FinalStage { - BulkResultDto build(); - - _FinalStage error(Optional error); - - _FinalStage error(ErrorDto error); - - _FinalStage id(Optional id); - - _FinalStage id(String id); - - _FinalStage contentId(Optional contentId); - - _FinalStage contentId(String contentId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements JobIndexStage, _FinalStage { - private int jobIndex; - - private Optional contentId = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional error = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(BulkResultDto other) { - error(other.getError()); - jobIndex(other.getJobIndex()); - id(other.getId()); - contentId(other.getContentId()); - return this; - } - - /** - *

The index of the bulk job where the result belongs to. The order can change.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("jobIndex") - public _FinalStage jobIndex(int jobIndex) { - this.jobIndex = jobIndex; - return this; - } - - /** - *

The ID of the entity that has been handled successfully or not.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentId(String contentId) { - this.contentId = Optional.of(contentId); - return this; - } - - @Override - @JsonSetter(value = "contentId", nulls = Nulls.SKIP) - public _FinalStage contentId(Optional contentId) { - this.contentId = contentId; - return this; - } - - /** - *

The ID of the entity that has been handled successfully or not.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage id(String id) { - this.id = Optional.of(id); - return this; - } - - @Override - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - @Override - public _FinalStage error(ErrorDto error) { - this.error = Optional.of(error); - return this; - } - - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - @Override - public BulkResultDto build() { - return new BulkResultDto(error, jobIndex, id, contentId); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java deleted file mode 100644 index 5a7152f..0000000 --- a/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum BulkUpdateAssetType { - ANNOTATE("Annotate"), - - MOVE("Move"), - - DELETE("Delete"); - - private final String value; - - BulkUpdateAssetType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java deleted file mode 100644 index b42c177..0000000 --- a/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java +++ /dev/null @@ -1,335 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateAssetsJobDto.Builder.class) -public final class BulkUpdateAssetsJobDto { - private final Optional id; - - private final Optional type; - - private final Optional parentId; - - private final Optional fileName; - - private final Optional slug; - - private final Optional isProtected; - - private final Optional> tags; - - private final Optional> metadata; - - private final Optional permanent; - - private final Optional expectedVersion; - - private BulkUpdateAssetsJobDto( - Optional id, - Optional type, - Optional parentId, - Optional fileName, - Optional slug, - Optional isProtected, - Optional> tags, - Optional> metadata, - Optional permanent, - Optional expectedVersion) { - this.id = id; - this.type = type; - this.parentId = parentId; - this.fileName = fileName; - this.slug = slug; - this.isProtected = isProtected; - this.tags = tags; - this.metadata = metadata; - this.permanent = permanent; - this.expectedVersion = expectedVersion; - } - - /** - * @return An optional ID of the asset to update. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The new name of the asset. - */ - @JsonProperty("fileName") - public Optional getFileName() { - return fileName; - } - - /** - * @return The new slug of the asset. - */ - @JsonProperty("slug") - public Optional getSlug() { - return slug; - } - - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public Optional getIsProtected() { - return isProtected; - } - - /** - * @return The new asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Optional> getMetadata() { - return metadata; - } - - /** - * @return True to delete the asset permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - /** - * @return The expected version. - */ - @JsonProperty("expectedVersion") - public Optional getExpectedVersion() { - return expectedVersion; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateAssetsJobDto && equalTo((BulkUpdateAssetsJobDto) other); - } - - private boolean equalTo(BulkUpdateAssetsJobDto other) { - return id.equals(other.id) - && type.equals(other.type) - && parentId.equals(other.parentId) - && fileName.equals(other.fileName) - && slug.equals(other.slug) - && isProtected.equals(other.isProtected) - && tags.equals(other.tags) - && metadata.equals(other.metadata) - && permanent.equals(other.permanent) - && expectedVersion.equals(other.expectedVersion); - } - - @Override - public int hashCode() { - return Objects.hash( - this.id, - this.type, - this.parentId, - this.fileName, - this.slug, - this.isProtected, - this.tags, - this.metadata, - this.permanent, - this.expectedVersion); - } - - @Override - public String toString() { - return "BulkUpdateAssetsJobDto{" + "id: " + id + ", type: " + type + ", parentId: " + parentId + ", fileName: " - + fileName + ", slug: " + slug + ", isProtected: " + isProtected + ", tags: " + tags + ", metadata: " - + metadata + ", permanent: " + permanent + ", expectedVersion: " + expectedVersion + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional id = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional parentId = Optional.empty(); - - private Optional fileName = Optional.empty(); - - private Optional slug = Optional.empty(); - - private Optional isProtected = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> metadata = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Optional expectedVersion = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateAssetsJobDto other) { - id(other.getId()); - type(other.getType()); - parentId(other.getParentId()); - fileName(other.getFileName()); - slug(other.getSlug()); - isProtected(other.getIsProtected()); - tags(other.getTags()); - metadata(other.getMetadata()); - permanent(other.getPermanent()); - expectedVersion(other.getExpectedVersion()); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(BulkUpdateAssetType type) { - this.type = Optional.of(type); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "fileName", nulls = Nulls.SKIP) - public Builder fileName(Optional fileName) { - this.fileName = fileName; - return this; - } - - public Builder fileName(String fileName) { - this.fileName = Optional.of(fileName); - return this; - } - - @JsonSetter(value = "slug", nulls = Nulls.SKIP) - public Builder slug(Optional slug) { - this.slug = slug; - return this; - } - - public Builder slug(String slug) { - this.slug = Optional.of(slug); - return this; - } - - @JsonSetter(value = "isProtected", nulls = Nulls.SKIP) - public Builder isProtected(Optional isProtected) { - this.isProtected = isProtected; - return this; - } - - public Builder isProtected(Boolean isProtected) { - this.isProtected = Optional.of(isProtected); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional> metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Map metadata) { - this.metadata = Optional.of(metadata); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - @JsonSetter(value = "expectedVersion", nulls = Nulls.SKIP) - public Builder expectedVersion(Optional expectedVersion) { - this.expectedVersion = expectedVersion; - return this; - } - - public Builder expectedVersion(Integer expectedVersion) { - this.expectedVersion = Optional.of(expectedVersion); - return this; - } - - public BulkUpdateAssetsJobDto build() { - return new BulkUpdateAssetsJobDto( - id, type, parentId, fileName, slug, isProtected, tags, metadata, permanent, expectedVersion); - } - } -} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentType.java b/src/main/java/com/squidex/api/types/BulkUpdateContentType.java deleted file mode 100644 index 4aa076e..0000000 --- a/src/main/java/com/squidex/api/types/BulkUpdateContentType.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum BulkUpdateContentType { - UPSERT("Upsert"), - - CHANGE_STATUS("ChangeStatus"), - - CREATE("Create"), - - DELETE("Delete"), - - PATCH("Patch"), - - UPDATE("Update"), - - VALIDATE("Validate"); - - private final String value; - - BulkUpdateContentType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java deleted file mode 100644 index 9c85444..0000000 --- a/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java +++ /dev/null @@ -1,358 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateContentsJobDto.Builder.class) -public final class BulkUpdateContentsJobDto { - private final Optional query; - - private final Optional id; - - private final Optional>> data; - - private final Optional status; - - private final Optional dueTime; - - private final Optional type; - - private final Optional schema; - - private final Optional patch; - - private final Optional permanent; - - private final Optional expectedCount; - - private final Optional expectedVersion; - - private BulkUpdateContentsJobDto( - Optional query, - Optional id, - Optional>> data, - Optional status, - Optional dueTime, - Optional type, - Optional schema, - Optional patch, - Optional permanent, - Optional expectedCount, - Optional expectedVersion) { - this.query = query; - this.id = id; - this.data = data; - this.status = status; - this.dueTime = dueTime; - this.type = type; - this.schema = schema; - this.patch = patch; - this.permanent = permanent; - this.expectedCount = expectedCount; - this.expectedVersion = expectedVersion; - } - - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return An optional ID of the content to update. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - @JsonProperty("data") - public Optional>> getData() { - return data; - } - - /** - * @return The new status when the type is set to 'ChangeStatus' or 'Upsert'. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return The due time. - */ - @JsonProperty("dueTime") - public Optional getDueTime() { - return dueTime; - } - - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return The optional schema id or name. - */ - @JsonProperty("schema") - public Optional getSchema() { - return schema; - } - - /** - * @return Makes the update as patch. - */ - @JsonProperty("patch") - public Optional getPatch() { - return patch; - } - - /** - * @return True to delete the content permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - /** - * @return The number of expected items. Set it to a higher number to update multiple items when a query is defined. - */ - @JsonProperty("expectedCount") - public Optional getExpectedCount() { - return expectedCount; - } - - /** - * @return The expected version. - */ - @JsonProperty("expectedVersion") - public Optional getExpectedVersion() { - return expectedVersion; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateContentsJobDto && equalTo((BulkUpdateContentsJobDto) other); - } - - private boolean equalTo(BulkUpdateContentsJobDto other) { - return query.equals(other.query) - && id.equals(other.id) - && data.equals(other.data) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && type.equals(other.type) - && schema.equals(other.schema) - && patch.equals(other.patch) - && permanent.equals(other.permanent) - && expectedCount.equals(other.expectedCount) - && expectedVersion.equals(other.expectedVersion); - } - - @Override - public int hashCode() { - return Objects.hash( - this.query, - this.id, - this.data, - this.status, - this.dueTime, - this.type, - this.schema, - this.patch, - this.permanent, - this.expectedCount, - this.expectedVersion); - } - - @Override - public String toString() { - return "BulkUpdateContentsJobDto{" + "query: " + query + ", id: " + id + ", data: " + data + ", status: " - + status + ", dueTime: " + dueTime + ", type: " + type + ", schema: " + schema + ", patch: " + patch - + ", permanent: " + permanent + ", expectedCount: " + expectedCount + ", expectedVersion: " - + expectedVersion + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional>> data = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional dueTime = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional schema = Optional.empty(); - - private Optional patch = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Optional expectedCount = Optional.empty(); - - private Optional expectedVersion = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateContentsJobDto other) { - query(other.getQuery()); - id(other.getId()); - data(other.getData()); - status(other.getStatus()); - dueTime(other.getDueTime()); - type(other.getType()); - schema(other.getSchema()); - patch(other.getPatch()); - permanent(other.getPermanent()); - expectedCount(other.getExpectedCount()); - expectedVersion(other.getExpectedVersion()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(QueryJsonDto query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "data", nulls = Nulls.SKIP) - public Builder data(Optional>> data) { - this.data = data; - return this; - } - - public Builder data(Map> data) { - this.data = Optional.of(data); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "dueTime", nulls = Nulls.SKIP) - public Builder dueTime(Optional dueTime) { - this.dueTime = dueTime; - return this; - } - - public Builder dueTime(OffsetDateTime dueTime) { - this.dueTime = Optional.of(dueTime); - return this; - } - - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(BulkUpdateContentType type) { - this.type = Optional.of(type); - return this; - } - - @JsonSetter(value = "schema", nulls = Nulls.SKIP) - public Builder schema(Optional schema) { - this.schema = schema; - return this; - } - - public Builder schema(String schema) { - this.schema = Optional.of(schema); - return this; - } - - @JsonSetter(value = "patch", nulls = Nulls.SKIP) - public Builder patch(Optional patch) { - this.patch = patch; - return this; - } - - public Builder patch(Boolean patch) { - this.patch = Optional.of(patch); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - @JsonSetter(value = "expectedCount", nulls = Nulls.SKIP) - public Builder expectedCount(Optional expectedCount) { - this.expectedCount = expectedCount; - return this; - } - - public Builder expectedCount(Integer expectedCount) { - this.expectedCount = Optional.of(expectedCount); - return this; - } - - @JsonSetter(value = "expectedVersion", nulls = Nulls.SKIP) - public Builder expectedVersion(Optional expectedVersion) { - this.expectedVersion = expectedVersion; - return this; - } - - public Builder expectedVersion(Integer expectedVersion) { - this.expectedVersion = Optional.of(expectedVersion); - return this; - } - - public BulkUpdateContentsJobDto build() { - return new BulkUpdateContentsJobDto( - query, id, data, status, dueTime, type, schema, patch, permanent, expectedCount, expectedVersion); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java b/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java deleted file mode 100644 index 1ced41e..0000000 --- a/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java +++ /dev/null @@ -1,391 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CallsUsageDtoDto.Builder.class) -public final class CallsUsageDtoDto { - private final int totalCalls; - - private final int totalBytes; - - private final int monthCalls; - - private final int monthBytes; - - private final int blockingApiCalls; - - private final int allowedBytes; - - private final int allowedCalls; - - private final double averageElapsedMs; - - private final Map> details; - - private CallsUsageDtoDto( - int totalCalls, - int totalBytes, - int monthCalls, - int monthBytes, - int blockingApiCalls, - int allowedBytes, - int allowedCalls, - double averageElapsedMs, - Map> details) { - this.totalCalls = totalCalls; - this.totalBytes = totalBytes; - this.monthCalls = monthCalls; - this.monthBytes = monthBytes; - this.blockingApiCalls = blockingApiCalls; - this.allowedBytes = allowedBytes; - this.allowedCalls = allowedCalls; - this.averageElapsedMs = averageElapsedMs; - this.details = details; - } - - /** - * @return The total number of API calls. - */ - @JsonProperty("totalCalls") - public int getTotalCalls() { - return totalCalls; - } - - /** - * @return The total number of bytes transferred. - */ - @JsonProperty("totalBytes") - public int getTotalBytes() { - return totalBytes; - } - - /** - * @return The total number of API calls this month. - */ - @JsonProperty("monthCalls") - public int getMonthCalls() { - return monthCalls; - } - - /** - * @return The total number of bytes transferred this month. - */ - @JsonProperty("monthBytes") - public int getMonthBytes() { - return monthBytes; - } - - /** - * @return The amount of calls that will block the app. - */ - @JsonProperty("blockingApiCalls") - public int getBlockingApiCalls() { - return blockingApiCalls; - } - - /** - * @return The included API traffic. - */ - @JsonProperty("allowedBytes") - public int getAllowedBytes() { - return allowedBytes; - } - - /** - * @return The included API calls. - */ - @JsonProperty("allowedCalls") - public int getAllowedCalls() { - return allowedCalls; - } - - /** - * @return The average duration in milliseconds. - */ - @JsonProperty("averageElapsedMs") - public double getAverageElapsedMs() { - return averageElapsedMs; - } - - /** - * @return The statistics by date and group. - */ - @JsonProperty("details") - public Map> getDetails() { - return details; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CallsUsageDtoDto && equalTo((CallsUsageDtoDto) other); - } - - private boolean equalTo(CallsUsageDtoDto other) { - return totalCalls == other.totalCalls - && totalBytes == other.totalBytes - && monthCalls == other.monthCalls - && monthBytes == other.monthBytes - && blockingApiCalls == other.blockingApiCalls - && allowedBytes == other.allowedBytes - && allowedCalls == other.allowedCalls - && averageElapsedMs == other.averageElapsedMs - && details.equals(other.details); - } - - @Override - public int hashCode() { - return Objects.hash( - this.totalCalls, - this.totalBytes, - this.monthCalls, - this.monthBytes, - this.blockingApiCalls, - this.allowedBytes, - this.allowedCalls, - this.averageElapsedMs, - this.details); - } - - @Override - public String toString() { - return "CallsUsageDtoDto{" + "totalCalls: " + totalCalls + ", totalBytes: " + totalBytes + ", monthCalls: " - + monthCalls + ", monthBytes: " + monthBytes + ", blockingApiCalls: " + blockingApiCalls - + ", allowedBytes: " + allowedBytes + ", allowedCalls: " + allowedCalls + ", averageElapsedMs: " - + averageElapsedMs + ", details: " + details + "}"; - } - - public static TotalCallsStage builder() { - return new Builder(); - } - - public interface TotalCallsStage { - TotalBytesStage totalCalls(int totalCalls); - - Builder from(CallsUsageDtoDto other); - } - - public interface TotalBytesStage { - MonthCallsStage totalBytes(int totalBytes); - } - - public interface MonthCallsStage { - MonthBytesStage monthCalls(int monthCalls); - } - - public interface MonthBytesStage { - BlockingApiCallsStage monthBytes(int monthBytes); - } - - public interface BlockingApiCallsStage { - AllowedBytesStage blockingApiCalls(int blockingApiCalls); - } - - public interface AllowedBytesStage { - AllowedCallsStage allowedBytes(int allowedBytes); - } - - public interface AllowedCallsStage { - AverageElapsedMsStage allowedCalls(int allowedCalls); - } - - public interface AverageElapsedMsStage { - _FinalStage averageElapsedMs(double averageElapsedMs); - } - - public interface _FinalStage { - CallsUsageDtoDto build(); - - _FinalStage details(Map> details); - - _FinalStage putAllDetails(Map> details); - - _FinalStage details(String key, List value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements TotalCallsStage, - TotalBytesStage, - MonthCallsStage, - MonthBytesStage, - BlockingApiCallsStage, - AllowedBytesStage, - AllowedCallsStage, - AverageElapsedMsStage, - _FinalStage { - private int totalCalls; - - private int totalBytes; - - private int monthCalls; - - private int monthBytes; - - private int blockingApiCalls; - - private int allowedBytes; - - private int allowedCalls; - - private double averageElapsedMs; - - private Map> details = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(CallsUsageDtoDto other) { - totalCalls(other.getTotalCalls()); - totalBytes(other.getTotalBytes()); - monthCalls(other.getMonthCalls()); - monthBytes(other.getMonthBytes()); - blockingApiCalls(other.getBlockingApiCalls()); - allowedBytes(other.getAllowedBytes()); - allowedCalls(other.getAllowedCalls()); - averageElapsedMs(other.getAverageElapsedMs()); - details(other.getDetails()); - return this; - } - - /** - *

The total number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCalls") - public TotalBytesStage totalCalls(int totalCalls) { - this.totalCalls = totalCalls; - return this; - } - - /** - *

The total number of bytes transferred.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalBytes") - public MonthCallsStage totalBytes(int totalBytes) { - this.totalBytes = totalBytes; - return this; - } - - /** - *

The total number of API calls this month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("monthCalls") - public MonthBytesStage monthCalls(int monthCalls) { - this.monthCalls = monthCalls; - return this; - } - - /** - *

The total number of bytes transferred this month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("monthBytes") - public BlockingApiCallsStage monthBytes(int monthBytes) { - this.monthBytes = monthBytes; - return this; - } - - /** - *

The amount of calls that will block the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("blockingApiCalls") - public AllowedBytesStage blockingApiCalls(int blockingApiCalls) { - this.blockingApiCalls = blockingApiCalls; - return this; - } - - /** - *

The included API traffic.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowedBytes") - public AllowedCallsStage allowedBytes(int allowedBytes) { - this.allowedBytes = allowedBytes; - return this; - } - - /** - *

The included API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowedCalls") - public AverageElapsedMsStage allowedCalls(int allowedCalls) { - this.allowedCalls = allowedCalls; - return this; - } - - /** - *

The average duration in milliseconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("averageElapsedMs") - public _FinalStage averageElapsedMs(double averageElapsedMs) { - this.averageElapsedMs = averageElapsedMs; - return this; - } - - /** - *

The statistics by date and group.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage details(String key, List value) { - this.details.put(key, value); - return this; - } - - /** - *

The statistics by date and group.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllDetails(Map> details) { - this.details.putAll(details); - return this; - } - - @Override - @JsonSetter(value = "details", nulls = Nulls.SKIP) - public _FinalStage details(Map> details) { - this.details.clear(); - this.details.putAll(details); - return this; - } - - @Override - public CallsUsageDtoDto build() { - return new CallsUsageDtoDto( - totalCalls, - totalBytes, - monthCalls, - monthBytes, - blockingApiCalls, - allowedBytes, - allowedCalls, - averageElapsedMs, - details); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java b/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java deleted file mode 100644 index 1f6d6ed..0000000 --- a/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java +++ /dev/null @@ -1,181 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CallsUsagePerDateDto.Builder.class) -public final class CallsUsagePerDateDto { - private final String date; - - private final int totalCalls; - - private final int totalBytes; - - private final double averageElapsedMs; - - private CallsUsagePerDateDto(String date, int totalCalls, int totalBytes, double averageElapsedMs) { - this.date = date; - this.totalCalls = totalCalls; - this.totalBytes = totalBytes; - this.averageElapsedMs = averageElapsedMs; - } - - /** - * @return The date when the usage was tracked. - */ - @JsonProperty("date") - public String getDate() { - return date; - } - - /** - * @return The total number of API calls. - */ - @JsonProperty("totalCalls") - public int getTotalCalls() { - return totalCalls; - } - - /** - * @return The total number of bytes transferred. - */ - @JsonProperty("totalBytes") - public int getTotalBytes() { - return totalBytes; - } - - /** - * @return The average duration in milliseconds. - */ - @JsonProperty("averageElapsedMs") - public double getAverageElapsedMs() { - return averageElapsedMs; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CallsUsagePerDateDto && equalTo((CallsUsagePerDateDto) other); - } - - private boolean equalTo(CallsUsagePerDateDto other) { - return date.equals(other.date) - && totalCalls == other.totalCalls - && totalBytes == other.totalBytes - && averageElapsedMs == other.averageElapsedMs; - } - - @Override - public int hashCode() { - return Objects.hash(this.date, this.totalCalls, this.totalBytes, this.averageElapsedMs); - } - - @Override - public String toString() { - return "CallsUsagePerDateDto{" + "date: " + date + ", totalCalls: " + totalCalls + ", totalBytes: " + totalBytes - + ", averageElapsedMs: " + averageElapsedMs + "}"; - } - - public static DateStage builder() { - return new Builder(); - } - - public interface DateStage { - TotalCallsStage date(String date); - - Builder from(CallsUsagePerDateDto other); - } - - public interface TotalCallsStage { - TotalBytesStage totalCalls(int totalCalls); - } - - public interface TotalBytesStage { - AverageElapsedMsStage totalBytes(int totalBytes); - } - - public interface AverageElapsedMsStage { - _FinalStage averageElapsedMs(double averageElapsedMs); - } - - public interface _FinalStage { - CallsUsagePerDateDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DateStage, TotalCallsStage, TotalBytesStage, AverageElapsedMsStage, _FinalStage { - private String date; - - private int totalCalls; - - private int totalBytes; - - private double averageElapsedMs; - - private Builder() {} - - @Override - public Builder from(CallsUsagePerDateDto other) { - date(other.getDate()); - totalCalls(other.getTotalCalls()); - totalBytes(other.getTotalBytes()); - averageElapsedMs(other.getAverageElapsedMs()); - return this; - } - - /** - *

The date when the usage was tracked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("date") - public TotalCallsStage date(String date) { - this.date = date; - return this; - } - - /** - *

The total number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCalls") - public TotalBytesStage totalCalls(int totalCalls) { - this.totalCalls = totalCalls; - return this; - } - - /** - *

The total number of bytes transferred.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalBytes") - public AverageElapsedMsStage totalBytes(int totalBytes) { - this.totalBytes = totalBytes; - return this; - } - - /** - *

The average duration in milliseconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("averageElapsedMs") - public _FinalStage averageElapsedMs(double averageElapsedMs) { - this.averageElapsedMs = averageElapsedMs; - return this; - } - - @Override - public CallsUsagePerDateDto build() { - return new CallsUsagePerDateDto(date, totalCalls, totalBytes, averageElapsedMs); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ChangePlanDto.java b/src/main/java/com/squidex/api/types/ChangePlanDto.java deleted file mode 100644 index b4995f0..0000000 --- a/src/main/java/com/squidex/api/types/ChangePlanDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangePlanDto.Builder.class) -public final class ChangePlanDto { - private final String planId; - - private ChangePlanDto(String planId) { - this.planId = planId; - } - - /** - * @return The new plan id. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("planId") - public String getPlanId() { - return planId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangePlanDto && equalTo((ChangePlanDto) other); - } - - private boolean equalTo(ChangePlanDto other) { - return planId.equals(other.planId); - } - - @Override - public int hashCode() { - return Objects.hash(this.planId); - } - - @Override - public String toString() { - return "ChangePlanDto{" + "planId: " + planId + "}"; - } - - public static PlanIdStage builder() { - return new Builder(); - } - - public interface PlanIdStage { - _FinalStage planId(String planId); - - Builder from(ChangePlanDto other); - } - - public interface _FinalStage { - ChangePlanDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PlanIdStage, _FinalStage { - private String planId; - - private Builder() {} - - @Override - public Builder from(ChangePlanDto other) { - planId(other.getPlanId()); - return this; - } - - /** - *

The new plan id. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("planId") - public _FinalStage planId(String planId) { - this.planId = planId; - return this; - } - - @Override - public ChangePlanDto build() { - return new ChangePlanDto(planId); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ClientDto.java b/src/main/java/com/squidex/api/types/ClientDto.java deleted file mode 100644 index ca4fdd6..0000000 --- a/src/main/java/com/squidex/api/types/ClientDto.java +++ /dev/null @@ -1,354 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ClientDto.Builder.class) -public final class ClientDto implements IResource { - private final Map links; - - private final String id; - - private final String secret; - - private final String name; - - private final Optional role; - - private final int apiCallsLimit; - - private final int apiTrafficLimit; - - private final boolean allowAnonymous; - - private ClientDto( - Map links, - String id, - String secret, - String name, - Optional role, - int apiCallsLimit, - int apiTrafficLimit, - boolean allowAnonymous) { - this.links = links; - this.id = id; - this.secret = secret; - this.name = name; - this.role = role; - this.apiCallsLimit = apiCallsLimit; - this.apiTrafficLimit = apiTrafficLimit; - this.allowAnonymous = allowAnonymous; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The client id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The client secret. - */ - @JsonProperty("secret") - public String getSecret() { - return secret; - } - - /** - * @return The client name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The role of the client. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - /** - * @return The number of allowed api calls per month for this client. - */ - @JsonProperty("apiCallsLimit") - public int getApiCallsLimit() { - return apiCallsLimit; - } - - /** - * @return The number of allowed api traffic bytes per month for this client. - */ - @JsonProperty("apiTrafficLimit") - public int getApiTrafficLimit() { - return apiTrafficLimit; - } - - /** - * @return True to allow anonymous access without an access token for this client. - */ - @JsonProperty("allowAnonymous") - public boolean getAllowAnonymous() { - return allowAnonymous; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ClientDto && equalTo((ClientDto) other); - } - - private boolean equalTo(ClientDto other) { - return links.equals(other.links) - && id.equals(other.id) - && secret.equals(other.secret) - && name.equals(other.name) - && role.equals(other.role) - && apiCallsLimit == other.apiCallsLimit - && apiTrafficLimit == other.apiTrafficLimit - && allowAnonymous == other.allowAnonymous; - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.secret, - this.name, - this.role, - this.apiCallsLimit, - this.apiTrafficLimit, - this.allowAnonymous); - } - - @Override - public String toString() { - return "ClientDto{" + "links: " + links + ", id: " + id + ", secret: " + secret + ", name: " + name + ", role: " - + role + ", apiCallsLimit: " + apiCallsLimit + ", apiTrafficLimit: " + apiTrafficLimit - + ", allowAnonymous: " + allowAnonymous + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - SecretStage id(String id); - - Builder from(ClientDto other); - } - - public interface SecretStage { - NameStage secret(String secret); - } - - public interface NameStage { - ApiCallsLimitStage name(String name); - } - - public interface ApiCallsLimitStage { - ApiTrafficLimitStage apiCallsLimit(int apiCallsLimit); - } - - public interface ApiTrafficLimitStage { - AllowAnonymousStage apiTrafficLimit(int apiTrafficLimit); - } - - public interface AllowAnonymousStage { - _FinalStage allowAnonymous(boolean allowAnonymous); - } - - public interface _FinalStage { - ClientDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage role(Optional role); - - _FinalStage role(String role); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - SecretStage, - NameStage, - ApiCallsLimitStage, - ApiTrafficLimitStage, - AllowAnonymousStage, - _FinalStage { - private String id; - - private String secret; - - private String name; - - private int apiCallsLimit; - - private int apiTrafficLimit; - - private boolean allowAnonymous; - - private Optional role = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ClientDto other) { - links(other.getLinks()); - id(other.getId()); - secret(other.getSecret()); - name(other.getName()); - role(other.getRole()); - apiCallsLimit(other.getApiCallsLimit()); - apiTrafficLimit(other.getApiTrafficLimit()); - allowAnonymous(other.getAllowAnonymous()); - return this; - } - - /** - *

The client id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public SecretStage id(String id) { - this.id = id; - return this; - } - - /** - *

The client secret.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("secret") - public NameStage secret(String secret) { - this.secret = secret; - return this; - } - - /** - *

The client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public ApiCallsLimitStage name(String name) { - this.name = name; - return this; - } - - /** - *

The number of allowed api calls per month for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiCallsLimit") - public ApiTrafficLimitStage apiCallsLimit(int apiCallsLimit) { - this.apiCallsLimit = apiCallsLimit; - return this; - } - - /** - *

The number of allowed api traffic bytes per month for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiTrafficLimit") - public AllowAnonymousStage apiTrafficLimit(int apiTrafficLimit) { - this.apiTrafficLimit = apiTrafficLimit; - return this; - } - - /** - *

True to allow anonymous access without an access token for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowAnonymous") - public _FinalStage allowAnonymous(boolean allowAnonymous) { - this.allowAnonymous = allowAnonymous; - return this; - } - - /** - *

The role of the client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } - - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ClientDto build() { - return new ClientDto(links, id, secret, name, role, apiCallsLimit, apiTrafficLimit, allowAnonymous); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ClientsDto.java b/src/main/java/com/squidex/api/types/ClientsDto.java deleted file mode 100644 index 1d94d79..0000000 --- a/src/main/java/com/squidex/api/types/ClientsDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ClientsDto.Builder.class) -public final class ClientsDto implements IResource { - private final Map links; - - private final List items; - - private ClientsDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The clients. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ClientsDto && equalTo((ClientsDto) other); - } - - private boolean equalTo(ClientsDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "ClientsDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(ClientsDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(ClientDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public ClientsDto build() { - return new ClientsDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CommentDto.java b/src/main/java/com/squidex/api/types/CommentDto.java deleted file mode 100644 index 00a0baf..0000000 --- a/src/main/java/com/squidex/api/types/CommentDto.java +++ /dev/null @@ -1,219 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentDto.Builder.class) -public final class CommentDto { - private final String id; - - private final OffsetDateTime time; - - private final String user; - - private final String text; - - private final Optional url; - - private CommentDto(String id, OffsetDateTime time, String user, String text, Optional url) { - this.id = id; - this.time = time; - this.user = user; - this.text = text; - this.url = url; - } - - /** - * @return The ID of the comment. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the comment was created or updated last. - */ - @JsonProperty("time") - public OffsetDateTime getTime() { - return time; - } - - /** - * @return The user who created or updated the comment. - */ - @JsonProperty("user") - public String getUser() { - return user; - } - - /** - * @return The text of the comment. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The url where the comment is created. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentDto && equalTo((CommentDto) other); - } - - private boolean equalTo(CommentDto other) { - return id.equals(other.id) - && time.equals(other.time) - && user.equals(other.user) - && text.equals(other.text) - && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.id, this.time, this.user, this.text, this.url); - } - - @Override - public String toString() { - return "CommentDto{" + "id: " + id + ", time: " + time + ", user: " + user + ", text: " + text + ", url: " + url - + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TimeStage id(String id); - - Builder from(CommentDto other); - } - - public interface TimeStage { - UserStage time(OffsetDateTime time); - } - - public interface UserStage { - TextStage user(String user); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - CommentDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, TimeStage, UserStage, TextStage, _FinalStage { - private String id; - - private OffsetDateTime time; - - private String user; - - private String text; - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentDto other) { - id(other.getId()); - time(other.getTime()); - user(other.getUser()); - text(other.getText()); - url(other.getUrl()); - return this; - } - - /** - *

The ID of the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public TimeStage id(String id) { - this.id = id; - return this; - } - - /** - *

The time when the comment was created or updated last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("time") - public UserStage time(OffsetDateTime time) { - this.time = time; - return this; - } - - /** - *

The user who created or updated the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("user") - public TextStage user(String user) { - this.user = user; - return this; - } - - /** - *

The text of the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

The url where the comment is created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public CommentDto build() { - return new CommentDto(id, time, user, text, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CommentRuleActionDto.java b/src/main/java/com/squidex/api/types/CommentRuleActionDto.java deleted file mode 100644 index cb2ae0f..0000000 --- a/src/main/java/com/squidex/api/types/CommentRuleActionDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentRuleActionDto.Builder.class) -public final class CommentRuleActionDto { - private final String text; - - private final Optional client; - - private CommentRuleActionDto(String text, Optional client) { - this.text = text; - this.client = client; - } - - /** - * @return The comment text. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public Optional getClient() { - return client; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentRuleActionDto && equalTo((CommentRuleActionDto) other); - } - - private boolean equalTo(CommentRuleActionDto other) { - return text.equals(other.text) && client.equals(other.client); - } - - @Override - public int hashCode() { - return Objects.hash(this.text, this.client); - } - - @Override - public String toString() { - return "CommentRuleActionDto{" + "text: " + text + ", client: " + client + "}"; - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - _FinalStage text(String text); - - Builder from(CommentRuleActionDto other); - } - - public interface _FinalStage { - CommentRuleActionDto build(); - - _FinalStage client(Optional client); - - _FinalStage client(String client); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - private Optional client = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentRuleActionDto other) { - text(other.getText()); - client(other.getClient()); - return this; - } - - /** - *

The comment text. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage client(String client) { - this.client = Optional.of(client); - return this; - } - - @Override - @JsonSetter(value = "client", nulls = Nulls.SKIP) - public _FinalStage client(Optional client) { - this.client = client; - return this; - } - - @Override - public CommentRuleActionDto build() { - return new CommentRuleActionDto(text, client); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java b/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java deleted file mode 100644 index 7cc86e1..0000000 --- a/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentRuleTriggerDto.Builder.class) -public final class CommentRuleTriggerDto { - private final Optional condition; - - private CommentRuleTriggerDto(Optional condition) { - this.condition = condition; - } - - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentRuleTriggerDto && equalTo((CommentRuleTriggerDto) other); - } - - private boolean equalTo(CommentRuleTriggerDto other) { - return condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.condition); - } - - @Override - public String toString() { - return "CommentRuleTriggerDto{" + "condition: " + condition + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - - private Builder() {} - - public Builder from(CommentRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } - - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; - } - - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - public CommentRuleTriggerDto build() { - return new CommentRuleTriggerDto(condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CommentsDto.java b/src/main/java/com/squidex/api/types/CommentsDto.java deleted file mode 100644 index cfb554b..0000000 --- a/src/main/java/com/squidex/api/types/CommentsDto.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentsDto.Builder.class) -public final class CommentsDto { - private final Optional> createdComments; - - private final Optional> updatedComments; - - private final Optional> deletedComments; - - private final int version; - - private CommentsDto( - Optional> createdComments, - Optional> updatedComments, - Optional> deletedComments, - int version) { - this.createdComments = createdComments; - this.updatedComments = updatedComments; - this.deletedComments = deletedComments; - this.version = version; - } - - /** - * @return The created comments including the updates. - */ - @JsonProperty("createdComments") - public Optional> getCreatedComments() { - return createdComments; - } - - /** - * @return The updates comments since the last version. - */ - @JsonProperty("updatedComments") - public Optional> getUpdatedComments() { - return updatedComments; - } - - /** - * @return The deleted comments since the last version. - */ - @JsonProperty("deletedComments") - public Optional> getDeletedComments() { - return deletedComments; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentsDto && equalTo((CommentsDto) other); - } - - private boolean equalTo(CommentsDto other) { - return createdComments.equals(other.createdComments) - && updatedComments.equals(other.updatedComments) - && deletedComments.equals(other.deletedComments) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.createdComments, this.updatedComments, this.deletedComments, this.version); - } - - @Override - public String toString() { - return "CommentsDto{" + "createdComments: " + createdComments + ", updatedComments: " + updatedComments - + ", deletedComments: " + deletedComments + ", version: " + version + "}"; - } - - public static VersionStage builder() { - return new Builder(); - } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(CommentsDto other); - } - - public interface _FinalStage { - CommentsDto build(); - - _FinalStage createdComments(Optional> createdComments); - - _FinalStage createdComments(List createdComments); - - _FinalStage updatedComments(Optional> updatedComments); - - _FinalStage updatedComments(List updatedComments); - - _FinalStage deletedComments(Optional> deletedComments); - - _FinalStage deletedComments(List deletedComments); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private Optional> deletedComments = Optional.empty(); - - private Optional> updatedComments = Optional.empty(); - - private Optional> createdComments = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentsDto other) { - createdComments(other.getCreatedComments()); - updatedComments(other.getUpdatedComments()); - deletedComments(other.getDeletedComments()); - version(other.getVersion()); - return this; - } - - /** - *

The current version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The deleted comments since the last version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage deletedComments(List deletedComments) { - this.deletedComments = Optional.of(deletedComments); - return this; - } - - @Override - @JsonSetter(value = "deletedComments", nulls = Nulls.SKIP) - public _FinalStage deletedComments(Optional> deletedComments) { - this.deletedComments = deletedComments; - return this; - } - - /** - *

The updates comments since the last version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage updatedComments(List updatedComments) { - this.updatedComments = Optional.of(updatedComments); - return this; - } - - @Override - @JsonSetter(value = "updatedComments", nulls = Nulls.SKIP) - public _FinalStage updatedComments(Optional> updatedComments) { - this.updatedComments = updatedComments; - return this; - } - - /** - *

The created comments including the updates.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage createdComments(List createdComments) { - this.createdComments = Optional.of(createdComments); - return this; - } - - @Override - @JsonSetter(value = "createdComments", nulls = Nulls.SKIP) - public _FinalStage createdComments(Optional> createdComments) { - this.createdComments = createdComments; - return this; - } - - @Override - public CommentsDto build() { - return new CommentsDto(createdComments, updatedComments, deletedComments, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java deleted file mode 100644 index bd5f1ef..0000000 --- a/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ComponentFieldPropertiesDto.Builder.class) -public final class ComponentFieldPropertiesDto { - private final Optional> schemaIds; - - private ComponentFieldPropertiesDto(Optional> schemaIds) { - this.schemaIds = schemaIds; - } - - /** - * @return The ID of the embedded schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentFieldPropertiesDto && equalTo((ComponentFieldPropertiesDto) other); - } - - private boolean equalTo(ComponentFieldPropertiesDto other) { - return schemaIds.equals(other.schemaIds); - } - - @Override - public int hashCode() { - return Objects.hash(this.schemaIds); - } - - @Override - public String toString() { - return "ComponentFieldPropertiesDto{" + "schemaIds: " + schemaIds + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> schemaIds = Optional.empty(); - - private Builder() {} - - public Builder from(ComponentFieldPropertiesDto other) { - schemaIds(other.getSchemaIds()); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - public ComponentFieldPropertiesDto build() { - return new ComponentFieldPropertiesDto(schemaIds); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java deleted file mode 100644 index ae846fe..0000000 --- a/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ComponentsFieldPropertiesDto.Builder.class) -public final class ComponentsFieldPropertiesDto { - private final Optional minItems; - - private final Optional maxItems; - - private final Optional> schemaIds; - - private final Optional> uniqueFields; - - private ComponentsFieldPropertiesDto( - Optional minItems, - Optional maxItems, - Optional> schemaIds, - Optional> uniqueFields) { - this.minItems = minItems; - this.maxItems = maxItems; - this.schemaIds = schemaIds; - this.uniqueFields = uniqueFields; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return The ID of the embedded schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return The fields that must be unique. - */ - @JsonProperty("uniqueFields") - public Optional> getUniqueFields() { - return uniqueFields; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentsFieldPropertiesDto && equalTo((ComponentsFieldPropertiesDto) other); - } - - private boolean equalTo(ComponentsFieldPropertiesDto other) { - return minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && schemaIds.equals(other.schemaIds) - && uniqueFields.equals(other.uniqueFields); - } - - @Override - public int hashCode() { - return Objects.hash(this.minItems, this.maxItems, this.schemaIds, this.uniqueFields); - } - - @Override - public String toString() { - return "ComponentsFieldPropertiesDto{" + "minItems: " + minItems + ", maxItems: " + maxItems + ", schemaIds: " - + schemaIds + ", uniqueFields: " + uniqueFields + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Optional> uniqueFields = Optional.empty(); - - private Builder() {} - - public Builder from(ComponentsFieldPropertiesDto other) { - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - schemaIds(other.getSchemaIds()); - uniqueFields(other.getUniqueFields()); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @JsonSetter(value = "uniqueFields", nulls = Nulls.SKIP) - public Builder uniqueFields(Optional> uniqueFields) { - this.uniqueFields = uniqueFields; - return this; - } - - public Builder uniqueFields(List uniqueFields) { - this.uniqueFields = Optional.of(uniqueFields); - return this; - } - - public ComponentsFieldPropertiesDto build() { - return new ComponentsFieldPropertiesDto(minItems, maxItems, schemaIds, uniqueFields); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java deleted file mode 100644 index 593b83e..0000000 --- a/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentChangedRuleTriggerDto.Builder.class) -public final class ContentChangedRuleTriggerDto { - private final Optional> schemas; - - private final Optional> referencedSchemas; - - private final boolean handleAll; - - private ContentChangedRuleTriggerDto( - Optional> schemas, - Optional> referencedSchemas, - boolean handleAll) { - this.schemas = schemas; - this.referencedSchemas = referencedSchemas; - this.handleAll = handleAll; - } - - /** - * @return The schema settings. - */ - @JsonProperty("schemas") - public Optional> getSchemas() { - return schemas; - } - - /** - * @return The schema references. - */ - @JsonProperty("referencedSchemas") - public Optional> getReferencedSchemas() { - return referencedSchemas; - } - - /** - * @return Determines whether the trigger should handle all content changes events. - */ - @JsonProperty("handleAll") - public boolean getHandleAll() { - return handleAll; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentChangedRuleTriggerDto && equalTo((ContentChangedRuleTriggerDto) other); - } - - private boolean equalTo(ContentChangedRuleTriggerDto other) { - return schemas.equals(other.schemas) - && referencedSchemas.equals(other.referencedSchemas) - && handleAll == other.handleAll; - } - - @Override - public int hashCode() { - return Objects.hash(this.schemas, this.referencedSchemas, this.handleAll); - } - - @Override - public String toString() { - return "ContentChangedRuleTriggerDto{" + "schemas: " + schemas + ", referencedSchemas: " + referencedSchemas - + ", handleAll: " + handleAll + "}"; - } - - public static HandleAllStage builder() { - return new Builder(); - } - - public interface HandleAllStage { - _FinalStage handleAll(boolean handleAll); - - Builder from(ContentChangedRuleTriggerDto other); - } - - public interface _FinalStage { - ContentChangedRuleTriggerDto build(); - - _FinalStage schemas(Optional> schemas); - - _FinalStage schemas(List schemas); - - _FinalStage referencedSchemas(Optional> referencedSchemas); - - _FinalStage referencedSchemas(List referencedSchemas); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HandleAllStage, _FinalStage { - private boolean handleAll; - - private Optional> referencedSchemas = Optional.empty(); - - private Optional> schemas = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentChangedRuleTriggerDto other) { - schemas(other.getSchemas()); - referencedSchemas(other.getReferencedSchemas()); - handleAll(other.getHandleAll()); - return this; - } - - /** - *

Determines whether the trigger should handle all content changes events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handleAll") - public _FinalStage handleAll(boolean handleAll) { - this.handleAll = handleAll; - return this; - } - - /** - *

The schema references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referencedSchemas(List referencedSchemas) { - this.referencedSchemas = Optional.of(referencedSchemas); - return this; - } - - @Override - @JsonSetter(value = "referencedSchemas", nulls = Nulls.SKIP) - public _FinalStage referencedSchemas(Optional> referencedSchemas) { - this.referencedSchemas = referencedSchemas; - return this; - } - - /** - *

The schema settings.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemas(List schemas) { - this.schemas = Optional.of(schemas); - return this; - } - - @Override - @JsonSetter(value = "schemas", nulls = Nulls.SKIP) - public _FinalStage schemas(Optional> schemas) { - this.schemas = schemas; - return this; - } - - @Override - public ContentChangedRuleTriggerDto build() { - return new ContentChangedRuleTriggerDto(schemas, referencedSchemas, handleAll); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContentDto.java b/src/main/java/com/squidex/api/types/ContentDto.java deleted file mode 100644 index 086c5ee..0000000 --- a/src/main/java/com/squidex/api/types/ContentDto.java +++ /dev/null @@ -1,790 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentDto.Builder.class) -public final class ContentDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final Object data; - - private final Optional>> referenceData; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final String status; - - private final Optional newStatus; - - private final String statusColor; - - private final Optional newStatusColor; - - private final Optional editToken; - - private final Optional scheduleJob; - - private final String schemaId; - - private final Optional schemaName; - - private final Optional schemaDisplayName; - - private final Optional> referenceFields; - - private final boolean isDeleted; - - private final int version; - - private ContentDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - Object data, - Optional>> referenceData, - OffsetDateTime created, - OffsetDateTime lastModified, - String status, - Optional newStatus, - String statusColor, - Optional newStatusColor, - Optional editToken, - Optional scheduleJob, - String schemaId, - Optional schemaName, - Optional schemaDisplayName, - Optional> referenceFields, - boolean isDeleted, - int version) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.data = data; - this.referenceData = referenceData; - this.created = created; - this.lastModified = lastModified; - this.status = status; - this.newStatus = newStatus; - this.statusColor = statusColor; - this.newStatusColor = newStatusColor; - this.editToken = editToken; - this.scheduleJob = scheduleJob; - this.schemaId = schemaId; - this.schemaName = schemaName; - this.schemaDisplayName = schemaDisplayName; - this.referenceFields = referenceFields; - this.isDeleted = isDeleted; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The if of the content item. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the content item. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the content item. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - @JsonProperty("data") - public Object getData() { - return data; - } - - @JsonProperty("referenceData") - public Optional>> getReferenceData() { - return referenceData; - } - - /** - * @return The date and time when the content item has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the content item has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The status of the content. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The new status of the content. - */ - @JsonProperty("newStatus") - public Optional getNewStatus() { - return newStatus; - } - - /** - * @return The color of the status. - */ - @JsonProperty("statusColor") - public String getStatusColor() { - return statusColor; - } - - /** - * @return The color of the new status. - */ - @JsonProperty("newStatusColor") - public Optional getNewStatusColor() { - return newStatusColor; - } - - /** - * @return The UI token. - */ - @JsonProperty("editToken") - public Optional getEditToken() { - return editToken; - } - - @JsonProperty("scheduleJob") - public Optional getScheduleJob() { - return scheduleJob; - } - - /** - * @return The ID of the schema. - */ - @JsonProperty("schemaId") - public String getSchemaId() { - return schemaId; - } - - /** - * @return The name of the schema. - */ - @JsonProperty("schemaName") - public Optional getSchemaName() { - return schemaName; - } - - /** - * @return The display name of the schema. - */ - @JsonProperty("schemaDisplayName") - public Optional getSchemaDisplayName() { - return schemaDisplayName; - } - - /** - * @return The reference fields. - */ - @JsonProperty("referenceFields") - public Optional> getReferenceFields() { - return referenceFields; - } - - /** - * @return Indicates whether the content is deleted. - */ - @JsonProperty("isDeleted") - public boolean getIsDeleted() { - return isDeleted; - } - - /** - * @return The version of the content. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentDto && equalTo((ContentDto) other); - } - - private boolean equalTo(ContentDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && data.equals(other.data) - && referenceData.equals(other.referenceData) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && status.equals(other.status) - && newStatus.equals(other.newStatus) - && statusColor.equals(other.statusColor) - && newStatusColor.equals(other.newStatusColor) - && editToken.equals(other.editToken) - && scheduleJob.equals(other.scheduleJob) - && schemaId.equals(other.schemaId) - && schemaName.equals(other.schemaName) - && schemaDisplayName.equals(other.schemaDisplayName) - && referenceFields.equals(other.referenceFields) - && isDeleted == other.isDeleted - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.data, - this.referenceData, - this.created, - this.lastModified, - this.status, - this.newStatus, - this.statusColor, - this.newStatusColor, - this.editToken, - this.scheduleJob, - this.schemaId, - this.schemaName, - this.schemaDisplayName, - this.referenceFields, - this.isDeleted, - this.version); - } - - @Override - public String toString() { - return "ContentDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " - + lastModifiedBy + ", data: " + data + ", referenceData: " + referenceData + ", created: " + created - + ", lastModified: " + lastModified + ", status: " + status + ", newStatus: " + newStatus - + ", statusColor: " + statusColor + ", newStatusColor: " + newStatusColor + ", editToken: " + editToken - + ", scheduleJob: " + scheduleJob + ", schemaId: " + schemaId + ", schemaName: " + schemaName - + ", schemaDisplayName: " + schemaDisplayName + ", referenceFields: " + referenceFields - + ", isDeleted: " + isDeleted + ", version: " + version + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(ContentDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - DataStage lastModifiedBy(String lastModifiedBy); - } - - public interface DataStage { - CreatedStage data(Object data); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - StatusStage lastModified(OffsetDateTime lastModified); - } - - public interface StatusStage { - StatusColorStage status(String status); - } - - public interface StatusColorStage { - SchemaIdStage statusColor(String statusColor); - } - - public interface SchemaIdStage { - IsDeletedStage schemaId(String schemaId); - } - - public interface IsDeletedStage { - VersionStage isDeleted(boolean isDeleted); - } - - public interface VersionStage { - _FinalStage version(int version); - } - - public interface _FinalStage { - ContentDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage referenceData(Optional>> referenceData); - - _FinalStage referenceData(Map> referenceData); - - _FinalStage newStatus(Optional newStatus); - - _FinalStage newStatus(String newStatus); - - _FinalStage newStatusColor(Optional newStatusColor); - - _FinalStage newStatusColor(String newStatusColor); - - _FinalStage editToken(Optional editToken); - - _FinalStage editToken(String editToken); - - _FinalStage scheduleJob(Optional scheduleJob); - - _FinalStage scheduleJob(ScheduleJobDto scheduleJob); - - _FinalStage schemaName(Optional schemaName); - - _FinalStage schemaName(String schemaName); - - _FinalStage schemaDisplayName(Optional schemaDisplayName); - - _FinalStage schemaDisplayName(String schemaDisplayName); - - _FinalStage referenceFields(Optional> referenceFields); - - _FinalStage referenceFields(List referenceFields); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - DataStage, - CreatedStage, - LastModifiedStage, - StatusStage, - StatusColorStage, - SchemaIdStage, - IsDeletedStage, - VersionStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private Object data; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private String status; - - private String statusColor; - - private String schemaId; - - private boolean isDeleted; - - private int version; - - private Optional> referenceFields = Optional.empty(); - - private Optional schemaDisplayName = Optional.empty(); - - private Optional schemaName = Optional.empty(); - - private Optional scheduleJob = Optional.empty(); - - private Optional editToken = Optional.empty(); - - private Optional newStatusColor = Optional.empty(); - - private Optional newStatus = Optional.empty(); - - private Optional>> referenceData = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContentDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - data(other.getData()); - referenceData(other.getReferenceData()); - created(other.getCreated()); - lastModified(other.getLastModified()); - status(other.getStatus()); - newStatus(other.getNewStatus()); - statusColor(other.getStatusColor()); - newStatusColor(other.getNewStatusColor()); - editToken(other.getEditToken()); - scheduleJob(other.getScheduleJob()); - schemaId(other.getSchemaId()); - schemaName(other.getSchemaName()); - schemaDisplayName(other.getSchemaDisplayName()); - referenceFields(other.getReferenceFields()); - isDeleted(other.getIsDeleted()); - version(other.getVersion()); - return this; - } - - /** - *

The if of the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public DataStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - @Override - @JsonSetter("data") - public CreatedStage data(Object data) { - this.data = data; - return this; - } - - /** - *

The date and time when the content item has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the content item has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public StatusStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The status of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public StatusColorStage status(String status) { - this.status = status; - return this; - } - - /** - *

The color of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("statusColor") - public SchemaIdStage statusColor(String statusColor) { - this.statusColor = statusColor; - return this; - } - - /** - *

The ID of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("schemaId") - public IsDeletedStage schemaId(String schemaId) { - this.schemaId = schemaId; - return this; - } - - /** - *

Indicates whether the content is deleted.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDeleted") - public VersionStage isDeleted(boolean isDeleted) { - this.isDeleted = isDeleted; - return this; - } - - /** - *

The version of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The reference fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referenceFields(List referenceFields) { - this.referenceFields = Optional.of(referenceFields); - return this; - } - - @Override - @JsonSetter(value = "referenceFields", nulls = Nulls.SKIP) - public _FinalStage referenceFields(Optional> referenceFields) { - this.referenceFields = referenceFields; - return this; - } - - /** - *

The display name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaDisplayName(String schemaDisplayName) { - this.schemaDisplayName = Optional.of(schemaDisplayName); - return this; - } - - @Override - @JsonSetter(value = "schemaDisplayName", nulls = Nulls.SKIP) - public _FinalStage schemaDisplayName(Optional schemaDisplayName) { - this.schemaDisplayName = schemaDisplayName; - return this; - } - - /** - *

The name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaName(String schemaName) { - this.schemaName = Optional.of(schemaName); - return this; - } - - @Override - @JsonSetter(value = "schemaName", nulls = Nulls.SKIP) - public _FinalStage schemaName(Optional schemaName) { - this.schemaName = schemaName; - return this; - } - - @Override - public _FinalStage scheduleJob(ScheduleJobDto scheduleJob) { - this.scheduleJob = Optional.of(scheduleJob); - return this; - } - - @Override - @JsonSetter(value = "scheduleJob", nulls = Nulls.SKIP) - public _FinalStage scheduleJob(Optional scheduleJob) { - this.scheduleJob = scheduleJob; - return this; - } - - /** - *

The UI token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage editToken(String editToken) { - this.editToken = Optional.of(editToken); - return this; - } - - @Override - @JsonSetter(value = "editToken", nulls = Nulls.SKIP) - public _FinalStage editToken(Optional editToken) { - this.editToken = editToken; - return this; - } - - /** - *

The color of the new status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage newStatusColor(String newStatusColor) { - this.newStatusColor = Optional.of(newStatusColor); - return this; - } - - @Override - @JsonSetter(value = "newStatusColor", nulls = Nulls.SKIP) - public _FinalStage newStatusColor(Optional newStatusColor) { - this.newStatusColor = newStatusColor; - return this; - } - - /** - *

The new status of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage newStatus(String newStatus) { - this.newStatus = Optional.of(newStatus); - return this; - } - - @Override - @JsonSetter(value = "newStatus", nulls = Nulls.SKIP) - public _FinalStage newStatus(Optional newStatus) { - this.newStatus = newStatus; - return this; - } - - @Override - public _FinalStage referenceData(Map> referenceData) { - this.referenceData = Optional.of(referenceData); - return this; - } - - @Override - @JsonSetter(value = "referenceData", nulls = Nulls.SKIP) - public _FinalStage referenceData(Optional>> referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContentDto build() { - return new ContentDto( - links, - id, - createdBy, - lastModifiedBy, - data, - referenceData, - created, - lastModified, - status, - newStatus, - statusColor, - newStatusColor, - editToken, - scheduleJob, - schemaId, - schemaName, - schemaDisplayName, - referenceFields, - isDeleted, - version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContentsDto.java b/src/main/java/com/squidex/api/types/ContentsDto.java deleted file mode 100644 index 86316b7..0000000 --- a/src/main/java/com/squidex/api/types/ContentsDto.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDto.Builder.class) -public final class ContentsDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private final List statuses; - - private ContentsDto( - Map links, int total, List items, List statuses) { - this.links = links; - this.total = total; - this.items = items; - this.statuses = statuses; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of content items. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The content items. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The possible statuses. - */ - @JsonProperty("statuses") - public List getStatuses() { - return statuses; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDto && equalTo((ContentsDto) other); - } - - private boolean equalTo(ContentsDto other) { - return links.equals(other.links) - && total == other.total - && items.equals(other.items) - && statuses.equals(other.statuses); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items, this.statuses); - } - - @Override - public String toString() { - return "ContentsDto{" + "links: " + links + ", total: " + total + ", items: " + items + ", statuses: " - + statuses + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(ContentsDto other); - } - - public interface _FinalStage { - ContentsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(ContentDto items); - - _FinalStage addAllItems(List items); - - _FinalStage statuses(List statuses); - - _FinalStage addStatuses(StatusInfoDto statuses); - - _FinalStage addAllStatuses(List statuses); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List statuses = new ArrayList<>(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContentsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - statuses(other.getStatuses()); - return this; - } - - /** - *

The total number of content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The possible statuses.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllStatuses(List statuses) { - this.statuses.addAll(statuses); - return this; - } - - /** - *

The possible statuses.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addStatuses(StatusInfoDto statuses) { - this.statuses.add(statuses); - return this; - } - - @Override - @JsonSetter(value = "statuses", nulls = Nulls.SKIP) - public _FinalStage statuses(List statuses) { - this.statuses.clear(); - this.statuses.addAll(statuses); - return this; - } - - /** - *

The content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(ContentDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContentsDto build() { - return new ContentsDto(links, total, items, statuses); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContributorDto.java b/src/main/java/com/squidex/api/types/ContributorDto.java deleted file mode 100644 index 433bc37..0000000 --- a/src/main/java/com/squidex/api/types/ContributorDto.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorDto.Builder.class) -public final class ContributorDto implements IResource { - private final Map links; - - private final String contributorId; - - private final String contributorName; - - private final String contributorEmail; - - private final Optional role; - - private ContributorDto( - Map links, - String contributorId, - String contributorName, - String contributorEmail, - Optional role) { - this.links = links; - this.contributorId = contributorId; - this.contributorName = contributorName; - this.contributorEmail = contributorEmail; - this.role = role; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the user that contributes to the app. - */ - @JsonProperty("contributorId") - public String getContributorId() { - return contributorId; - } - - /** - * @return The display name. - */ - @JsonProperty("contributorName") - public String getContributorName() { - return contributorName; - } - - /** - * @return The email address. - */ - @JsonProperty("contributorEmail") - public String getContributorEmail() { - return contributorEmail; - } - - /** - * @return The role of the contributor. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorDto && equalTo((ContributorDto) other); - } - - private boolean equalTo(ContributorDto other) { - return links.equals(other.links) - && contributorId.equals(other.contributorId) - && contributorName.equals(other.contributorName) - && contributorEmail.equals(other.contributorEmail) - && role.equals(other.role); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.contributorId, this.contributorName, this.contributorEmail, this.role); - } - - @Override - public String toString() { - return "ContributorDto{" + "links: " + links + ", contributorId: " + contributorId + ", contributorName: " - + contributorName + ", contributorEmail: " + contributorEmail + ", role: " + role + "}"; - } - - public static ContributorIdStage builder() { - return new Builder(); - } - - public interface ContributorIdStage { - ContributorNameStage contributorId(String contributorId); - - Builder from(ContributorDto other); - } - - public interface ContributorNameStage { - ContributorEmailStage contributorName(String contributorName); - } - - public interface ContributorEmailStage { - _FinalStage contributorEmail(String contributorEmail); - } - - public interface _FinalStage { - ContributorDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage role(Optional role); - - _FinalStage role(String role); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements ContributorIdStage, ContributorNameStage, ContributorEmailStage, _FinalStage { - private String contributorId; - - private String contributorName; - - private String contributorEmail; - - private Optional role = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContributorDto other) { - links(other.getLinks()); - contributorId(other.getContributorId()); - contributorName(other.getContributorName()); - contributorEmail(other.getContributorEmail()); - role(other.getRole()); - return this; - } - - /** - *

The ID of the user that contributes to the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorId") - public ContributorNameStage contributorId(String contributorId) { - this.contributorId = contributorId; - return this; - } - - /** - *

The display name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorName") - public ContributorEmailStage contributorName(String contributorName) { - this.contributorName = contributorName; - return this; - } - - /** - *

The email address.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorEmail") - public _FinalStage contributorEmail(String contributorEmail) { - this.contributorEmail = contributorEmail; - return this; - } - - /** - *

The role of the contributor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } - - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContributorDto build() { - return new ContributorDto(links, contributorId, contributorName, contributorEmail, role); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContributorsDto.java b/src/main/java/com/squidex/api/types/ContributorsDto.java deleted file mode 100644 index 5396335..0000000 --- a/src/main/java/com/squidex/api/types/ContributorsDto.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorsDto.Builder.class) -public final class ContributorsDto implements IResource { - private final Map links; - - private final List items; - - private final int maxContributors; - - private final Optional meta; - - private ContributorsDto( - Map links, - List items, - int maxContributors, - Optional meta) { - this.links = links; - this.items = items; - this.maxContributors = maxContributors; - this.meta = meta; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The contributors. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The maximum number of allowed contributors. - */ - @JsonProperty("maxContributors") - public int getMaxContributors() { - return maxContributors; - } - - @JsonProperty("_meta") - public Optional getMeta() { - return meta; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorsDto && equalTo((ContributorsDto) other); - } - - private boolean equalTo(ContributorsDto other) { - return links.equals(other.links) - && items.equals(other.items) - && maxContributors == other.maxContributors - && meta.equals(other.meta); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.maxContributors, this.meta); - } - - @Override - public String toString() { - return "ContributorsDto{" + "links: " + links + ", items: " + items + ", maxContributors: " + maxContributors - + ", meta: " + meta + "}"; - } - - public static MaxContributorsStage builder() { - return new Builder(); - } - - public interface MaxContributorsStage { - _FinalStage maxContributors(int maxContributors); - - Builder from(ContributorsDto other); - } - - public interface _FinalStage { - ContributorsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(ContributorDto items); - - _FinalStage addAllItems(List items); - - _FinalStage meta(Optional meta); - - _FinalStage meta(ContributorsMetadata meta); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MaxContributorsStage, _FinalStage { - private int maxContributors; - - private Optional meta = Optional.empty(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContributorsDto other) { - links(other.getLinks()); - items(other.getItems()); - maxContributors(other.getMaxContributors()); - meta(other.getMeta()); - return this; - } - - /** - *

The maximum number of allowed contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxContributors") - public _FinalStage maxContributors(int maxContributors) { - this.maxContributors = maxContributors; - return this; - } - - @Override - public _FinalStage meta(ContributorsMetadata meta) { - this.meta = Optional.of(meta); - return this; - } - - @Override - @JsonSetter(value = "_meta", nulls = Nulls.SKIP) - public _FinalStage meta(Optional meta) { - this.meta = meta; - return this; - } - - /** - *

The contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(ContributorDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContributorsDto build() { - return new ContributorsDto(links, items, maxContributors, meta); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ContributorsMetadata.java b/src/main/java/com/squidex/api/types/ContributorsMetadata.java deleted file mode 100644 index b5809aa..0000000 --- a/src/main/java/com/squidex/api/types/ContributorsMetadata.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorsMetadata.Builder.class) -public final class ContributorsMetadata { - private final String isInvited; - - private ContributorsMetadata(String isInvited) { - this.isInvited = isInvited; - } - - /** - * @return Indicates whether the user has been invited. - */ - @JsonProperty("isInvited") - public String getIsInvited() { - return isInvited; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorsMetadata && equalTo((ContributorsMetadata) other); - } - - private boolean equalTo(ContributorsMetadata other) { - return isInvited.equals(other.isInvited); - } - - @Override - public int hashCode() { - return Objects.hash(this.isInvited); - } - - @Override - public String toString() { - return "ContributorsMetadata{" + "isInvited: " + isInvited + "}"; - } - - public static IsInvitedStage builder() { - return new Builder(); - } - - public interface IsInvitedStage { - _FinalStage isInvited(String isInvited); - - Builder from(ContributorsMetadata other); - } - - public interface _FinalStage { - ContributorsMetadata build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsInvitedStage, _FinalStage { - private String isInvited; - - private Builder() {} - - @Override - public Builder from(ContributorsMetadata other) { - isInvited(other.getIsInvited()); - return this; - } - - /** - *

Indicates whether the user has been invited.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isInvited") - public _FinalStage isInvited(String isInvited) { - this.isInvited = isInvited; - return this; - } - - @Override - public ContributorsMetadata build() { - return new ContributorsMetadata(isInvited); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java b/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java deleted file mode 100644 index 8b91ded..0000000 --- a/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java +++ /dev/null @@ -1,180 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateContentRuleActionDto.Builder.class) -public final class CreateContentRuleActionDto { - private final String data; - - private final String schema; - - private final String client; - - private final boolean publish; - - private CreateContentRuleActionDto(String data, String schema, String client, boolean publish) { - this.data = data; - this.schema = schema; - this.client = client; - this.publish = publish; - } - - /** - * @return The content data. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("data") - public String getData() { - return data; - } - - /** - * @return The name of the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("schema") - public String getSchema() { - return schema; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public String getClient() { - return client; - } - - /** - * @return Publish the content. - */ - @JsonProperty("publish") - public boolean getPublish() { - return publish; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateContentRuleActionDto && equalTo((CreateContentRuleActionDto) other); - } - - private boolean equalTo(CreateContentRuleActionDto other) { - return data.equals(other.data) - && schema.equals(other.schema) - && client.equals(other.client) - && publish == other.publish; - } - - @Override - public int hashCode() { - return Objects.hash(this.data, this.schema, this.client, this.publish); - } - - @Override - public String toString() { - return "CreateContentRuleActionDto{" + "data: " + data + ", schema: " + schema + ", client: " + client - + ", publish: " + publish + "}"; - } - - public static DataStage builder() { - return new Builder(); - } - - public interface DataStage { - SchemaStage data(String data); - - Builder from(CreateContentRuleActionDto other); - } - - public interface SchemaStage { - ClientStage schema(String schema); - } - - public interface ClientStage { - PublishStage client(String client); - } - - public interface PublishStage { - _FinalStage publish(boolean publish); - } - - public interface _FinalStage { - CreateContentRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, SchemaStage, ClientStage, PublishStage, _FinalStage { - private String data; - - private String schema; - - private String client; - - private boolean publish; - - private Builder() {} - - @Override - public Builder from(CreateContentRuleActionDto other) { - data(other.getData()); - schema(other.getSchema()); - client(other.getClient()); - publish(other.getPublish()); - return this; - } - - /** - *

The content data. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("data") - public SchemaStage data(String data) { - this.data = data; - return this; - } - - /** - *

The name of the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("schema") - public ClientStage schema(String schema) { - this.schema = schema; - return this; - } - - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("client") - public PublishStage client(String client) { - this.client = client; - return this; - } - - /** - *

Publish the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("publish") - public _FinalStage publish(boolean publish) { - this.publish = publish; - return this; - } - - @Override - public CreateContentRuleActionDto build() { - return new CreateContentRuleActionDto(data, schema, client, publish); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CreateRuleDto.java b/src/main/java/com/squidex/api/types/CreateRuleDto.java deleted file mode 100644 index 04a01c3..0000000 --- a/src/main/java/com/squidex/api/types/CreateRuleDto.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateRuleDto.Builder.class) -public final class CreateRuleDto { - private final RuleTriggerDto trigger; - - private final RuleActionDto action; - - private CreateRuleDto(RuleTriggerDto trigger, RuleActionDto action) { - this.trigger = trigger; - this.action = action; - } - - @JsonProperty("trigger") - public RuleTriggerDto getTrigger() { - return trigger; - } - - @JsonProperty("action") - public RuleActionDto getAction() { - return action; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateRuleDto && equalTo((CreateRuleDto) other); - } - - private boolean equalTo(CreateRuleDto other) { - return trigger.equals(other.trigger) && action.equals(other.action); - } - - @Override - public int hashCode() { - return Objects.hash(this.trigger, this.action); - } - - @Override - public String toString() { - return "CreateRuleDto{" + "trigger: " + trigger + ", action: " + action + "}"; - } - - public static TriggerStage builder() { - return new Builder(); - } - - public interface TriggerStage { - ActionStage trigger(RuleTriggerDto trigger); - - Builder from(CreateRuleDto other); - } - - public interface ActionStage { - _FinalStage action(RuleActionDto action); - } - - public interface _FinalStage { - CreateRuleDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TriggerStage, ActionStage, _FinalStage { - private RuleTriggerDto trigger; - - private RuleActionDto action; - - private Builder() {} - - @Override - public Builder from(CreateRuleDto other) { - trigger(other.getTrigger()); - action(other.getAction()); - return this; - } - - @Override - @JsonSetter("trigger") - public ActionStage trigger(RuleTriggerDto trigger) { - this.trigger = trigger; - return this; - } - - @Override - @JsonSetter("action") - public _FinalStage action(RuleActionDto action) { - this.action = action; - return this; - } - - @Override - public CreateRuleDto build() { - return new CreateRuleDto(trigger, action); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CurrentStorageDto.java b/src/main/java/com/squidex/api/types/CurrentStorageDto.java deleted file mode 100644 index 0df3b3b..0000000 --- a/src/main/java/com/squidex/api/types/CurrentStorageDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CurrentStorageDto.Builder.class) -public final class CurrentStorageDto { - private final int size; - - private final int maxAllowed; - - private CurrentStorageDto(int size, int maxAllowed) { - this.size = size; - this.maxAllowed = maxAllowed; - } - - /** - * @return The size in bytes. - */ - @JsonProperty("size") - public int getSize() { - return size; - } - - /** - * @return The maximum allowed asset size. - */ - @JsonProperty("maxAllowed") - public int getMaxAllowed() { - return maxAllowed; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CurrentStorageDto && equalTo((CurrentStorageDto) other); - } - - private boolean equalTo(CurrentStorageDto other) { - return size == other.size && maxAllowed == other.maxAllowed; - } - - @Override - public int hashCode() { - return Objects.hash(this.size, this.maxAllowed); - } - - @Override - public String toString() { - return "CurrentStorageDto{" + "size: " + size + ", maxAllowed: " + maxAllowed + "}"; - } - - public static SizeStage builder() { - return new Builder(); - } - - public interface SizeStage { - MaxAllowedStage size(int size); - - Builder from(CurrentStorageDto other); - } - - public interface MaxAllowedStage { - _FinalStage maxAllowed(int maxAllowed); - } - - public interface _FinalStage { - CurrentStorageDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SizeStage, MaxAllowedStage, _FinalStage { - private int size; - - private int maxAllowed; - - private Builder() {} - - @Override - public Builder from(CurrentStorageDto other) { - size(other.getSize()); - maxAllowed(other.getMaxAllowed()); - return this; - } - - /** - *

The size in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("size") - public MaxAllowedStage size(int size) { - this.size = size; - return this; - } - - /** - *

The maximum allowed asset size.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxAllowed") - public _FinalStage maxAllowed(int maxAllowed) { - this.maxAllowed = maxAllowed; - return this; - } - - @Override - public CurrentStorageDto build() { - return new CurrentStorageDto(size, maxAllowed); - } - } -} diff --git a/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java b/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java deleted file mode 100644 index c184d17..0000000 --- a/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum DateTimeCalculatedDefaultValue { - NOW("Now"), - - TODAY("Today"); - - private final String value; - - DateTimeCalculatedDefaultValue(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java b/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java deleted file mode 100644 index 6117e56..0000000 --- a/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum DateTimeFieldEditor { - DATE("Date"), - - DATE_TIME("DateTime"); - - private final String value; - - DateTimeFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java deleted file mode 100644 index 314110e..0000000 --- a/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DateTimeFieldPropertiesDto.Builder.class) -public final class DateTimeFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional defaultValue; - - private final Optional maxValue; - - private final Optional minValue; - - private final Optional format; - - private final Optional editor; - - private final Optional calculatedDefaultValue; - - private DateTimeFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional maxValue, - Optional minValue, - Optional format, - Optional editor, - Optional calculatedDefaultValue) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.maxValue = maxValue; - this.minValue = minValue; - this.format = format; - this.editor = editor; - this.calculatedDefaultValue = calculatedDefaultValue; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The maximum allowed value for the field value. - */ - @JsonProperty("maxValue") - public Optional getMaxValue() { - return maxValue; - } - - /** - * @return The minimum allowed value for the field value. - */ - @JsonProperty("minValue") - public Optional getMinValue() { - return minValue; - } - - /** - * @return The format pattern when displayed in the UI. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @JsonProperty("calculatedDefaultValue") - public Optional getCalculatedDefaultValue() { - return calculatedDefaultValue; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DateTimeFieldPropertiesDto && equalTo((DateTimeFieldPropertiesDto) other); - } - - private boolean equalTo(DateTimeFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && maxValue.equals(other.maxValue) - && minValue.equals(other.minValue) - && format.equals(other.format) - && editor.equals(other.editor) - && calculatedDefaultValue.equals(other.calculatedDefaultValue); - } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.maxValue, - this.minValue, - this.format, - this.editor, - this.calculatedDefaultValue); - } - - @Override - public String toString() { - return "DateTimeFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", maxValue: " + maxValue + ", minValue: " + minValue + ", format: " + format + ", editor: " + editor - + ", calculatedDefaultValue: " + calculatedDefaultValue + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional maxValue = Optional.empty(); - - private Optional minValue = Optional.empty(); - - private Optional format = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Optional calculatedDefaultValue = Optional.empty(); - - private Builder() {} - - public Builder from(DateTimeFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - maxValue(other.getMaxValue()); - minValue(other.getMinValue()); - format(other.getFormat()); - editor(other.getEditor()); - calculatedDefaultValue(other.getCalculatedDefaultValue()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(OffsetDateTime defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "maxValue", nulls = Nulls.SKIP) - public Builder maxValue(Optional maxValue) { - this.maxValue = maxValue; - return this; - } - - public Builder maxValue(OffsetDateTime maxValue) { - this.maxValue = Optional.of(maxValue); - return this; - } - - @JsonSetter(value = "minValue", nulls = Nulls.SKIP) - public Builder minValue(Optional minValue) { - this.minValue = minValue; - return this; - } - - public Builder minValue(OffsetDateTime minValue) { - this.minValue = Optional.of(minValue); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(String format) { - this.format = Optional.of(format); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(DateTimeFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - @JsonSetter(value = "calculatedDefaultValue", nulls = Nulls.SKIP) - public Builder calculatedDefaultValue(Optional calculatedDefaultValue) { - this.calculatedDefaultValue = calculatedDefaultValue; - return this; - } - - public Builder calculatedDefaultValue(DateTimeCalculatedDefaultValue calculatedDefaultValue) { - this.calculatedDefaultValue = Optional.of(calculatedDefaultValue); - return this; - } - - public DateTimeFieldPropertiesDto build() { - return new DateTimeFieldPropertiesDto( - defaultValues, defaultValue, maxValue, minValue, format, editor, calculatedDefaultValue); - } - } -} diff --git a/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java b/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java deleted file mode 100644 index ef55f31..0000000 --- a/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java +++ /dev/null @@ -1,297 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DiscourseRuleActionDto.Builder.class) -public final class DiscourseRuleActionDto { - private final String url; - - private final String apiKey; - - private final String apiUsername; - - private final String text; - - private final Optional title; - - private final Optional topic; - - private final Optional category; - - private DiscourseRuleActionDto( - String url, - String apiKey, - String apiUsername, - String text, - Optional title, - Optional topic, - Optional category) { - this.url = url; - this.apiKey = apiKey; - this.apiUsername = apiUsername; - this.text = text; - this.title = title; - this.topic = topic; - this.category = category; - } - - /** - * @return The url to the discourse server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - /** - * @return The api key to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The api username to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("apiUsername") - public String getApiUsername() { - return apiUsername; - } - - /** - * @return The text as markdown. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The optional title when creating new topics. - */ - @JsonProperty("title") - public Optional getTitle() { - return title; - } - - /** - * @return The optional topic id. - */ - @JsonProperty("topic") - public Optional getTopic() { - return topic; - } - - /** - * @return The optional category id. - */ - @JsonProperty("category") - public Optional getCategory() { - return category; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DiscourseRuleActionDto && equalTo((DiscourseRuleActionDto) other); - } - - private boolean equalTo(DiscourseRuleActionDto other) { - return url.equals(other.url) - && apiKey.equals(other.apiKey) - && apiUsername.equals(other.apiUsername) - && text.equals(other.text) - && title.equals(other.title) - && topic.equals(other.topic) - && category.equals(other.category); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.apiKey, this.apiUsername, this.text, this.title, this.topic, this.category); - } - - @Override - public String toString() { - return "DiscourseRuleActionDto{" + "url: " + url + ", apiKey: " + apiKey + ", apiUsername: " + apiUsername - + ", text: " + text + ", title: " + title + ", topic: " + topic + ", category: " + category + "}"; - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - ApiKeyStage url(String url); - - Builder from(DiscourseRuleActionDto other); - } - - public interface ApiKeyStage { - ApiUsernameStage apiKey(String apiKey); - } - - public interface ApiUsernameStage { - TextStage apiUsername(String apiUsername); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - DiscourseRuleActionDto build(); - - _FinalStage title(Optional title); - - _FinalStage title(String title); - - _FinalStage topic(Optional topic); - - _FinalStage topic(Integer topic); - - _FinalStage category(Optional category); - - _FinalStage category(Integer category); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, ApiKeyStage, ApiUsernameStage, TextStage, _FinalStage { - private String url; - - private String apiKey; - - private String apiUsername; - - private String text; - - private Optional category = Optional.empty(); - - private Optional topic = Optional.empty(); - - private Optional title = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(DiscourseRuleActionDto other) { - url(other.getUrl()); - apiKey(other.getApiKey()); - apiUsername(other.getApiUsername()); - text(other.getText()); - title(other.getTitle()); - topic(other.getTopic()); - category(other.getCategory()); - return this; - } - - /** - *

The url to the discourse server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public ApiKeyStage url(String url) { - this.url = url; - return this; - } - - /** - *

The api key to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public ApiUsernameStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - *

The api username to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiUsername") - public TextStage apiUsername(String apiUsername) { - this.apiUsername = apiUsername; - return this; - } - - /** - *

The text as markdown. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

The optional category id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(Integer category) { - this.category = Optional.of(category); - return this; - } - - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; - } - - /** - *

The optional topic id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage topic(Integer topic) { - this.topic = Optional.of(topic); - return this; - } - - @Override - @JsonSetter(value = "topic", nulls = Nulls.SKIP) - public _FinalStage topic(Optional topic) { - this.topic = topic; - return this; - } - - /** - *

The optional title when creating new topics.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage title(String title) { - this.title = Optional.of(title); - return this; - } - - @Override - @JsonSetter(value = "title", nulls = Nulls.SKIP) - public _FinalStage title(Optional title) { - this.title = title; - return this; - } - - @Override - public DiscourseRuleActionDto build() { - return new DiscourseRuleActionDto(url, apiKey, apiUsername, text, title, topic, category); - } - } -} diff --git a/src/main/java/com/squidex/api/types/EditorDto.java b/src/main/java/com/squidex/api/types/EditorDto.java deleted file mode 100644 index bfb2fff..0000000 --- a/src/main/java/com/squidex/api/types/EditorDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EditorDto.Builder.class) -public final class EditorDto { - private final String name; - - private final String url; - - private EditorDto(String name, String url) { - this.name = name; - this.url = url; - } - - /** - * @return The name of the editor. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The url to the editor. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EditorDto && equalTo((EditorDto) other); - } - - private boolean equalTo(EditorDto other) { - return name.equals(other.name) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.url); - } - - @Override - public String toString() { - return "EditorDto{" + "name: " + name + ", url: " + url + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - UrlStage name(String name); - - Builder from(EditorDto other); - } - - public interface UrlStage { - _FinalStage url(String url); - } - - public interface _FinalStage { - EditorDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, UrlStage, _FinalStage { - private String name; - - private String url; - - private Builder() {} - - @Override - public Builder from(EditorDto other) { - name(other.getName()); - url(other.getUrl()); - return this; - } - - /** - *

The name of the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public UrlStage name(String name) { - this.name = name; - return this; - } - - /** - *

The url to the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; - } - - @Override - public EditorDto build() { - return new EditorDto(name, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java deleted file mode 100644 index a3d9a98..0000000 --- a/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ElasticSearchRuleActionDto.Builder.class) -public final class ElasticSearchRuleActionDto { - private final String host; - - private final String indexName; - - private final Optional username; - - private final Optional password; - - private final Optional document; - - private final Optional delete; - - private ElasticSearchRuleActionDto( - String host, - String indexName, - Optional username, - Optional password, - Optional document, - Optional delete) { - this.host = host; - this.indexName = indexName; - this.username = username; - this.password = password; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional username. - */ - @JsonProperty("username") - public Optional getUsername() { - return username; - } - - /** - * @return The optional password. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElasticSearchRuleActionDto && equalTo((ElasticSearchRuleActionDto) other); - } - - private boolean equalTo(ElasticSearchRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && username.equals(other.username) - && password.equals(other.password) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.username, this.password, this.document, this.delete); - } - - @Override - public String toString() { - return "ElasticSearchRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", username: " + username - + ", password: " + password + ", document: " + document + ", delete: " + delete + "}"; - } - - public static HostStage builder() { - return new Builder(); - } - - public interface HostStage { - IndexNameStage host(String host); - - Builder from(ElasticSearchRuleActionDto other); - } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); - } - - public interface _FinalStage { - ElasticSearchRuleActionDto build(); - - _FinalStage username(Optional username); - - _FinalStage username(String username); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, _FinalStage { - private String host; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Optional password = Optional.empty(); - - private Optional username = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ElasticSearchRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - username(other.getUsername()); - password(other.getPassword()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; - } - - /** - *

The name of the index. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - /** - *

The optional password.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - /** - *

The optional username.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage username(String username) { - this.username = Optional.of(username); - return this; - } - - @Override - @JsonSetter(value = "username", nulls = Nulls.SKIP) - public _FinalStage username(Optional username) { - this.username = username; - return this; - } - - @Override - public ElasticSearchRuleActionDto build() { - return new ElasticSearchRuleActionDto(host, indexName, username, password, document, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/types/EmailRuleActionDto.java b/src/main/java/com/squidex/api/types/EmailRuleActionDto.java deleted file mode 100644 index 016e726..0000000 --- a/src/main/java/com/squidex/api/types/EmailRuleActionDto.java +++ /dev/null @@ -1,335 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EmailRuleActionDto.Builder.class) -public final class EmailRuleActionDto { - private final String serverHost; - - private final int serverPort; - - private final String serverUsername; - - private final String serverPassword; - - private final String messageFrom; - - private final String messageTo; - - private final String messageSubject; - - private final String messageBody; - - private EmailRuleActionDto( - String serverHost, - int serverPort, - String serverUsername, - String serverPassword, - String messageFrom, - String messageTo, - String messageSubject, - String messageBody) { - this.serverHost = serverHost; - this.serverPort = serverPort; - this.serverUsername = serverUsername; - this.serverPassword = serverPassword; - this.messageFrom = messageFrom; - this.messageTo = messageTo; - this.messageSubject = messageSubject; - this.messageBody = messageBody; - } - - /** - * @return The IP address or host to the SMTP server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("serverHost") - public String getServerHost() { - return serverHost; - } - - /** - * @return The port to the SMTP server. - */ - @JsonProperty("serverPort") - public int getServerPort() { - return serverPort; - } - - /** - * @return The username for the SMTP server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("serverUsername") - public String getServerUsername() { - return serverUsername; - } - - /** - * @return The password for the SMTP server. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("serverPassword") - public String getServerPassword() { - return serverPassword; - } - - /** - * @return The email sending address. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("messageFrom") - public String getMessageFrom() { - return messageFrom; - } - - /** - * @return The email message will be sent to. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("messageTo") - public String getMessageTo() { - return messageTo; - } - - /** - * @return The subject line for this email message. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("messageSubject") - public String getMessageSubject() { - return messageSubject; - } - - /** - * @return The message body. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("messageBody") - public String getMessageBody() { - return messageBody; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EmailRuleActionDto && equalTo((EmailRuleActionDto) other); - } - - private boolean equalTo(EmailRuleActionDto other) { - return serverHost.equals(other.serverHost) - && serverPort == other.serverPort - && serverUsername.equals(other.serverUsername) - && serverPassword.equals(other.serverPassword) - && messageFrom.equals(other.messageFrom) - && messageTo.equals(other.messageTo) - && messageSubject.equals(other.messageSubject) - && messageBody.equals(other.messageBody); - } - - @Override - public int hashCode() { - return Objects.hash( - this.serverHost, - this.serverPort, - this.serverUsername, - this.serverPassword, - this.messageFrom, - this.messageTo, - this.messageSubject, - this.messageBody); - } - - @Override - public String toString() { - return "EmailRuleActionDto{" + "serverHost: " + serverHost + ", serverPort: " + serverPort - + ", serverUsername: " + serverUsername + ", serverPassword: " + serverPassword + ", messageFrom: " - + messageFrom + ", messageTo: " + messageTo + ", messageSubject: " + messageSubject + ", messageBody: " - + messageBody + "}"; - } - - public static ServerHostStage builder() { - return new Builder(); - } - - public interface ServerHostStage { - ServerPortStage serverHost(String serverHost); - - Builder from(EmailRuleActionDto other); - } - - public interface ServerPortStage { - ServerUsernameStage serverPort(int serverPort); - } - - public interface ServerUsernameStage { - ServerPasswordStage serverUsername(String serverUsername); - } - - public interface ServerPasswordStage { - MessageFromStage serverPassword(String serverPassword); - } - - public interface MessageFromStage { - MessageToStage messageFrom(String messageFrom); - } - - public interface MessageToStage { - MessageSubjectStage messageTo(String messageTo); - } - - public interface MessageSubjectStage { - MessageBodyStage messageSubject(String messageSubject); - } - - public interface MessageBodyStage { - _FinalStage messageBody(String messageBody); - } - - public interface _FinalStage { - EmailRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements ServerHostStage, - ServerPortStage, - ServerUsernameStage, - ServerPasswordStage, - MessageFromStage, - MessageToStage, - MessageSubjectStage, - MessageBodyStage, - _FinalStage { - private String serverHost; - - private int serverPort; - - private String serverUsername; - - private String serverPassword; - - private String messageFrom; - - private String messageTo; - - private String messageSubject; - - private String messageBody; - - private Builder() {} - - @Override - public Builder from(EmailRuleActionDto other) { - serverHost(other.getServerHost()); - serverPort(other.getServerPort()); - serverUsername(other.getServerUsername()); - serverPassword(other.getServerPassword()); - messageFrom(other.getMessageFrom()); - messageTo(other.getMessageTo()); - messageSubject(other.getMessageSubject()); - messageBody(other.getMessageBody()); - return this; - } - - /** - *

The IP address or host to the SMTP server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverHost") - public ServerPortStage serverHost(String serverHost) { - this.serverHost = serverHost; - return this; - } - - /** - *

The port to the SMTP server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverPort") - public ServerUsernameStage serverPort(int serverPort) { - this.serverPort = serverPort; - return this; - } - - /** - *

The username for the SMTP server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverUsername") - public ServerPasswordStage serverUsername(String serverUsername) { - this.serverUsername = serverUsername; - return this; - } - - /** - *

The password for the SMTP server. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverPassword") - public MessageFromStage serverPassword(String serverPassword) { - this.serverPassword = serverPassword; - return this; - } - - /** - *

The email sending address. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageFrom") - public MessageToStage messageFrom(String messageFrom) { - this.messageFrom = messageFrom; - return this; - } - - /** - *

The email message will be sent to. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageTo") - public MessageSubjectStage messageTo(String messageTo) { - this.messageTo = messageTo; - return this; - } - - /** - *

The subject line for this email message. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageSubject") - public MessageBodyStage messageSubject(String messageSubject) { - this.messageSubject = messageSubject; - return this; - } - - /** - *

The message body. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageBody") - public _FinalStage messageBody(String messageBody) { - this.messageBody = messageBody; - return this; - } - - @Override - public EmailRuleActionDto build() { - return new EmailRuleActionDto( - serverHost, - serverPort, - serverUsername, - serverPassword, - messageFrom, - messageTo, - messageSubject, - messageBody); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ErrorDto.java b/src/main/java/com/squidex/api/types/ErrorDto.java deleted file mode 100644 index d1db2cb..0000000 --- a/src/main/java/com/squidex/api/types/ErrorDto.java +++ /dev/null @@ -1,273 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ErrorDto.Builder.class) -public final class ErrorDto { - private final String message; - - private final Optional errorCode; - - private final Optional traceId; - - private final Optional type; - - private final Optional> details; - - private final int statusCode; - - private ErrorDto( - String message, - Optional errorCode, - Optional traceId, - Optional type, - Optional> details, - int statusCode) { - this.message = message; - this.errorCode = errorCode; - this.traceId = traceId; - this.type = type; - this.details = details; - this.statusCode = statusCode; - } - - /** - * @return Error message. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - /** - * @return The error code. - */ - @JsonProperty("errorCode") - public Optional getErrorCode() { - return errorCode; - } - - /** - * @return The optional trace id. - */ - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - /** - * @return Link to the error details. - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return Detailed error messages. - */ - @JsonProperty("details") - public Optional> getDetails() { - return details; - } - - /** - * @return Status code of the http response. - */ - @JsonProperty("statusCode") - public int getStatusCode() { - return statusCode; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ErrorDto && equalTo((ErrorDto) other); - } - - private boolean equalTo(ErrorDto other) { - return message.equals(other.message) - && errorCode.equals(other.errorCode) - && traceId.equals(other.traceId) - && type.equals(other.type) - && details.equals(other.details) - && statusCode == other.statusCode; - } - - @Override - public int hashCode() { - return Objects.hash(this.message, this.errorCode, this.traceId, this.type, this.details, this.statusCode); - } - - @Override - public String toString() { - return "ErrorDto{" + "message: " + message + ", errorCode: " + errorCode + ", traceId: " + traceId + ", type: " - + type + ", details: " + details + ", statusCode: " + statusCode + "}"; - } - - public static MessageStage builder() { - return new Builder(); - } - - public interface MessageStage { - StatusCodeStage message(String message); - - Builder from(ErrorDto other); - } - - public interface StatusCodeStage { - _FinalStage statusCode(int statusCode); - } - - public interface _FinalStage { - ErrorDto build(); - - _FinalStage errorCode(Optional errorCode); - - _FinalStage errorCode(String errorCode); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage type(Optional type); - - _FinalStage type(String type); - - _FinalStage details(Optional> details); - - _FinalStage details(List details); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MessageStage, StatusCodeStage, _FinalStage { - private String message; - - private int statusCode; - - private Optional> details = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional errorCode = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ErrorDto other) { - message(other.getMessage()); - errorCode(other.getErrorCode()); - traceId(other.getTraceId()); - type(other.getType()); - details(other.getDetails()); - statusCode(other.getStatusCode()); - return this; - } - - /** - *

Error message. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("message") - public StatusCodeStage message(String message) { - this.message = message; - return this; - } - - /** - *

Status code of the http response.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("statusCode") - public _FinalStage statusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - /** - *

Detailed error messages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage details(List details) { - this.details = Optional.of(details); - return this; - } - - @Override - @JsonSetter(value = "details", nulls = Nulls.SKIP) - public _FinalStage details(Optional> details) { - this.details = details; - return this; - } - - /** - *

Link to the error details.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage type(String type) { - this.type = Optional.of(type); - return this; - } - - @Override - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public _FinalStage type(Optional type) { - this.type = type; - return this; - } - - /** - *

The optional trace id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.of(traceId); - return this; - } - - @Override - @JsonSetter(value = "traceId", nulls = Nulls.SKIP) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - /** - *

The error code.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage errorCode(String errorCode) { - this.errorCode = Optional.of(errorCode); - return this; - } - - @Override - @JsonSetter(value = "errorCode", nulls = Nulls.SKIP) - public _FinalStage errorCode(Optional errorCode) { - this.errorCode = errorCode; - return this; - } - - @Override - public ErrorDto build() { - return new ErrorDto(message, errorCode, traceId, type, details, statusCode); - } - } -} diff --git a/src/main/java/com/squidex/api/types/EventConsumerDto.java b/src/main/java/com/squidex/api/types/EventConsumerDto.java deleted file mode 100644 index f4efc6a..0000000 --- a/src/main/java/com/squidex/api/types/EventConsumerDto.java +++ /dev/null @@ -1,314 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EventConsumerDto.Builder.class) -public final class EventConsumerDto implements IResource { - private final Map links; - - private final boolean isStopped; - - private final boolean isResetting; - - private final int count; - - private final String name; - - private final Optional error; - - private final Optional position; - - private EventConsumerDto( - Map links, - boolean isStopped, - boolean isResetting, - int count, - String name, - Optional error, - Optional position) { - this.links = links; - this.isStopped = isStopped; - this.isResetting = isResetting; - this.count = count; - this.name = name; - this.error = error; - this.position = position; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return Indicates if the event consumer has been started. - */ - @JsonProperty("isStopped") - public boolean getIsStopped() { - return isStopped; - } - - /** - * @return Indicates if the event consumer is resetting at the moment. - */ - @JsonProperty("isResetting") - public boolean getIsResetting() { - return isResetting; - } - - /** - * @return The number of handled events. - */ - @JsonProperty("count") - public int getCount() { - return count; - } - - /** - * @return The name of the event consumer. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The error details if the event consumer has been stopped after a failure. - */ - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The position within the vent stream. - */ - @JsonProperty("position") - public Optional getPosition() { - return position; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EventConsumerDto && equalTo((EventConsumerDto) other); - } - - private boolean equalTo(EventConsumerDto other) { - return links.equals(other.links) - && isStopped == other.isStopped - && isResetting == other.isResetting - && count == other.count - && name.equals(other.name) - && error.equals(other.error) - && position.equals(other.position); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.isStopped, this.isResetting, this.count, this.name, this.error, this.position); - } - - @Override - public String toString() { - return "EventConsumerDto{" + "links: " + links + ", isStopped: " + isStopped + ", isResetting: " + isResetting - + ", count: " + count + ", name: " + name + ", error: " + error + ", position: " + position + "}"; - } - - public static IsStoppedStage builder() { - return new Builder(); - } - - public interface IsStoppedStage { - IsResettingStage isStopped(boolean isStopped); - - Builder from(EventConsumerDto other); - } - - public interface IsResettingStage { - CountStage isResetting(boolean isResetting); - } - - public interface CountStage { - NameStage count(int count); - } - - public interface NameStage { - _FinalStage name(String name); - } - - public interface _FinalStage { - EventConsumerDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage error(Optional error); - - _FinalStage error(String error); - - _FinalStage position(Optional position); - - _FinalStage position(String position); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsStoppedStage, IsResettingStage, CountStage, NameStage, _FinalStage { - private boolean isStopped; - - private boolean isResetting; - - private int count; - - private String name; - - private Optional position = Optional.empty(); - - private Optional error = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(EventConsumerDto other) { - links(other.getLinks()); - isStopped(other.getIsStopped()); - isResetting(other.getIsResetting()); - count(other.getCount()); - name(other.getName()); - error(other.getError()); - position(other.getPosition()); - return this; - } - - /** - *

Indicates if the event consumer has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isStopped") - public IsResettingStage isStopped(boolean isStopped) { - this.isStopped = isStopped; - return this; - } - - /** - *

Indicates if the event consumer is resetting at the moment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isResetting") - public CountStage isResetting(boolean isResetting) { - this.isResetting = isResetting; - return this; - } - - /** - *

The number of handled events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("count") - public NameStage count(int count) { - this.count = count; - return this; - } - - /** - *

The name of the event consumer. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

The position within the vent stream.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage position(String position) { - this.position = Optional.of(position); - return this; - } - - @Override - @JsonSetter(value = "position", nulls = Nulls.SKIP) - public _FinalStage position(Optional position) { - this.position = position; - return this; - } - - /** - *

The error details if the event consumer has been stopped after a failure.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage error(String error) { - this.error = Optional.of(error); - return this; - } - - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public EventConsumerDto build() { - return new EventConsumerDto(links, isStopped, isResetting, count, name, error, position); - } - } -} diff --git a/src/main/java/com/squidex/api/types/EventConsumersDto.java b/src/main/java/com/squidex/api/types/EventConsumersDto.java deleted file mode 100644 index bf4fcc6..0000000 --- a/src/main/java/com/squidex/api/types/EventConsumersDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EventConsumersDto.Builder.class) -public final class EventConsumersDto implements IResource { - private final Map links; - - private final List items; - - private EventConsumersDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The event consumers. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EventConsumersDto && equalTo((EventConsumersDto) other); - } - - private boolean equalTo(EventConsumersDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "EventConsumersDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(EventConsumersDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(EventConsumerDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public EventConsumersDto build() { - return new EventConsumersDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java b/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java deleted file mode 100644 index 90bfbc0..0000000 --- a/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FastlyRuleActionDto.Builder.class) -public final class FastlyRuleActionDto { - private final String apiKey; - - private final String serviceId; - - private FastlyRuleActionDto(String apiKey, String serviceId) { - this.apiKey = apiKey; - this.serviceId = serviceId; - } - - /** - * @return The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The ID of the fastly service. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("serviceId") - public String getServiceId() { - return serviceId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FastlyRuleActionDto && equalTo((FastlyRuleActionDto) other); - } - - private boolean equalTo(FastlyRuleActionDto other) { - return apiKey.equals(other.apiKey) && serviceId.equals(other.serviceId); - } - - @Override - public int hashCode() { - return Objects.hash(this.apiKey, this.serviceId); - } - - @Override - public String toString() { - return "FastlyRuleActionDto{" + "apiKey: " + apiKey + ", serviceId: " + serviceId + "}"; - } - - public static ApiKeyStage builder() { - return new Builder(); - } - - public interface ApiKeyStage { - ServiceIdStage apiKey(String apiKey); - - Builder from(FastlyRuleActionDto other); - } - - public interface ServiceIdStage { - _FinalStage serviceId(String serviceId); - } - - public interface _FinalStage { - FastlyRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ApiKeyStage, ServiceIdStage, _FinalStage { - private String apiKey; - - private String serviceId; - - private Builder() {} - - @Override - public Builder from(FastlyRuleActionDto other) { - apiKey(other.getApiKey()); - serviceId(other.getServiceId()); - return this; - } - - /** - *

The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public ServiceIdStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - *

The ID of the fastly service. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serviceId") - public _FinalStage serviceId(String serviceId) { - this.serviceId = serviceId; - return this; - } - - @Override - public FastlyRuleActionDto build() { - return new FastlyRuleActionDto(apiKey, serviceId); - } - } -} diff --git a/src/main/java/com/squidex/api/types/FeatureDto.java b/src/main/java/com/squidex/api/types/FeatureDto.java deleted file mode 100644 index f688811..0000000 --- a/src/main/java/com/squidex/api/types/FeatureDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FeatureDto.Builder.class) -public final class FeatureDto { - private final String name; - - private final String text; - - private FeatureDto(String name, String text) { - this.name = name; - this.text = text; - } - - /** - * @return The name of the feature. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The description text. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FeatureDto && equalTo((FeatureDto) other); - } - - private boolean equalTo(FeatureDto other) { - return name.equals(other.name) && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.text); - } - - @Override - public String toString() { - return "FeatureDto{" + "name: " + name + ", text: " + text + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - TextStage name(String name); - - Builder from(FeatureDto other); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - FeatureDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TextStage, _FinalStage { - private String name; - - private String text; - - private Builder() {} - - @Override - public Builder from(FeatureDto other) { - name(other.getName()); - text(other.getText()); - return this; - } - - /** - *

The name of the feature.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TextStage name(String name) { - this.name = name; - return this; - } - - /** - *

The description text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - @Override - public FeatureDto build() { - return new FeatureDto(name, text); - } - } -} diff --git a/src/main/java/com/squidex/api/types/FeaturesDto.java b/src/main/java/com/squidex/api/types/FeaturesDto.java deleted file mode 100644 index d553138..0000000 --- a/src/main/java/com/squidex/api/types/FeaturesDto.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FeaturesDto.Builder.class) -public final class FeaturesDto { - private final List features; - - private final int version; - - private FeaturesDto(List features, int version) { - this.features = features; - this.version = version; - } - - /** - * @return The latest features. - */ - @JsonProperty("features") - public List getFeatures() { - return features; - } - - /** - * @return The recent version. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FeaturesDto && equalTo((FeaturesDto) other); - } - - private boolean equalTo(FeaturesDto other) { - return features.equals(other.features) && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.features, this.version); - } - - @Override - public String toString() { - return "FeaturesDto{" + "features: " + features + ", version: " + version + "}"; - } - - public static VersionStage builder() { - return new Builder(); - } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(FeaturesDto other); - } - - public interface _FinalStage { - FeaturesDto build(); - - _FinalStage features(List features); - - _FinalStage addFeatures(FeatureDto features); - - _FinalStage addAllFeatures(List features); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private List features = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(FeaturesDto other) { - features(other.getFeatures()); - version(other.getVersion()); - return this; - } - - /** - *

The recent version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The latest features.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFeatures(List features) { - this.features.addAll(features); - return this; - } - - /** - *

The latest features.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFeatures(FeatureDto features) { - this.features.add(features); - return this; - } - - @Override - @JsonSetter(value = "features", nulls = Nulls.SKIP) - public _FinalStage features(List features) { - this.features.clear(); - this.features.addAll(features); - return this; - } - - @Override - public FeaturesDto build() { - return new FeaturesDto(features, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/FieldDto.java b/src/main/java/com/squidex/api/types/FieldDto.java deleted file mode 100644 index 9f8e6dd..0000000 --- a/src/main/java/com/squidex/api/types/FieldDto.java +++ /dev/null @@ -1,381 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FieldDto.Builder.class) -public final class FieldDto implements IResource { - private final Map links; - - private final int fieldId; - - private final String name; - - private final boolean isHidden; - - private final boolean isLocked; - - private final boolean isDisabled; - - private final String partitioning; - - private final FieldPropertiesDto properties; - - private final Optional> nested; - - private FieldDto( - Map links, - int fieldId, - String name, - boolean isHidden, - boolean isLocked, - boolean isDisabled, - String partitioning, - FieldPropertiesDto properties, - Optional> nested) { - this.links = links; - this.fieldId = fieldId; - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.partitioning = partitioning; - this.properties = properties; - this.nested = nested; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the field. - */ - @JsonProperty("fieldId") - public int getFieldId() { - return fieldId; - } - - /** - * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public boolean getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public boolean getIsDisabled() { - return isDisabled; - } - - /** - * @return Defines the partitioning of the field. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("partitioning") - public String getPartitioning() { - return partitioning; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - /** - * @return The nested fields. - */ - @JsonProperty("nested") - public Optional> getNested() { - return nested; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldDto && equalTo((FieldDto) other); - } - - private boolean equalTo(FieldDto other) { - return links.equals(other.links) - && fieldId == other.fieldId - && name.equals(other.name) - && isHidden == other.isHidden - && isLocked == other.isLocked - && isDisabled == other.isDisabled - && partitioning.equals(other.partitioning) - && properties.equals(other.properties) - && nested.equals(other.nested); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.fieldId, - this.name, - this.isHidden, - this.isLocked, - this.isDisabled, - this.partitioning, - this.properties, - this.nested); - } - - @Override - public String toString() { - return "FieldDto{" + "links: " + links + ", fieldId: " + fieldId + ", name: " + name + ", isHidden: " + isHidden - + ", isLocked: " + isLocked + ", isDisabled: " + isDisabled + ", partitioning: " + partitioning - + ", properties: " + properties + ", nested: " + nested + "}"; - } - - public static FieldIdStage builder() { - return new Builder(); - } - - public interface FieldIdStage { - NameStage fieldId(int fieldId); - - Builder from(FieldDto other); - } - - public interface NameStage { - IsHiddenStage name(String name); - } - - public interface IsHiddenStage { - IsLockedStage isHidden(boolean isHidden); - } - - public interface IsLockedStage { - IsDisabledStage isLocked(boolean isLocked); - } - - public interface IsDisabledStage { - PartitioningStage isDisabled(boolean isDisabled); - } - - public interface PartitioningStage { - PropertiesStage partitioning(String partitioning); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - } - - public interface _FinalStage { - FieldDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage nested(Optional> nested); - - _FinalStage nested(List nested); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements FieldIdStage, - NameStage, - IsHiddenStage, - IsLockedStage, - IsDisabledStage, - PartitioningStage, - PropertiesStage, - _FinalStage { - private int fieldId; - - private String name; - - private boolean isHidden; - - private boolean isLocked; - - private boolean isDisabled; - - private String partitioning; - - private FieldPropertiesDto properties; - - private Optional> nested = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(FieldDto other) { - links(other.getLinks()); - fieldId(other.getFieldId()); - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - nested(other.getNested()); - return this; - } - - /** - *

The ID of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fieldId") - public NameStage fieldId(int fieldId) { - this.fieldId = fieldId; - return this; - } - - /** - *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public IsHiddenStage name(String name) { - this.name = name; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHidden") - public IsLockedStage isHidden(boolean isHidden) { - this.isHidden = isHidden; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public IsDisabledStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDisabled") - public PartitioningStage isDisabled(boolean isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

Defines the partitioning of the field. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("partitioning") - public PropertiesStage partitioning(String partitioning) { - this.partitioning = partitioning; - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

The nested fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nested(List nested) { - this.nested = Optional.of(nested); - return this; - } - - @Override - @JsonSetter(value = "nested", nulls = Nulls.SKIP) - public _FinalStage nested(Optional> nested) { - this.nested = nested; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public FieldDto build() { - return new FieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, partitioning, properties, nested); - } - } -} diff --git a/src/main/java/com/squidex/api/types/FieldPropertiesDto.java b/src/main/java/com/squidex/api/types/FieldPropertiesDto.java deleted file mode 100644 index a881485..0000000 --- a/src/main/java/com/squidex/api/types/FieldPropertiesDto.java +++ /dev/null @@ -1,815 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import java.util.Objects; -import java.util.Optional; - -public final class FieldPropertiesDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private FieldPropertiesDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static FieldPropertiesDto array(ArrayFieldPropertiesDto value) { - return new FieldPropertiesDto(new ArrayValue(value)); - } - - public static FieldPropertiesDto assets(AssetsFieldPropertiesDto value) { - return new FieldPropertiesDto(new AssetsValue(value)); - } - - public static FieldPropertiesDto boolean_(BooleanFieldPropertiesDto value) { - return new FieldPropertiesDto(new BooleanValue(value)); - } - - public static FieldPropertiesDto component(ComponentFieldPropertiesDto value) { - return new FieldPropertiesDto(new ComponentValue(value)); - } - - public static FieldPropertiesDto components(ComponentsFieldPropertiesDto value) { - return new FieldPropertiesDto(new ComponentsValue(value)); - } - - public static FieldPropertiesDto dateTime(DateTimeFieldPropertiesDto value) { - return new FieldPropertiesDto(new DateTimeValue(value)); - } - - public static FieldPropertiesDto geolocation(GeolocationFieldPropertiesDto value) { - return new FieldPropertiesDto(new GeolocationValue(value)); - } - - public static FieldPropertiesDto json(JsonFieldPropertiesDto value) { - return new FieldPropertiesDto(new JsonValue(value)); - } - - public static FieldPropertiesDto number(NumberFieldPropertiesDto value) { - return new FieldPropertiesDto(new NumberValue(value)); - } - - public static FieldPropertiesDto references(ReferencesFieldPropertiesDto value) { - return new FieldPropertiesDto(new ReferencesValue(value)); - } - - public static FieldPropertiesDto string(StringFieldPropertiesDto value) { - return new FieldPropertiesDto(new StringValue(value)); - } - - public static FieldPropertiesDto tags(TagsFieldPropertiesDto value) { - return new FieldPropertiesDto(new TagsValue(value)); - } - - public static FieldPropertiesDto ui(UiFieldPropertiesDto value) { - return new FieldPropertiesDto(new UiValue(value)); - } - - public boolean isArray() { - return value instanceof ArrayValue; - } - - public boolean isAssets() { - return value instanceof AssetsValue; - } - - public boolean isBoolean() { - return value instanceof BooleanValue; - } - - public boolean isComponent() { - return value instanceof ComponentValue; - } - - public boolean isComponents() { - return value instanceof ComponentsValue; - } - - public boolean isDateTime() { - return value instanceof DateTimeValue; - } - - public boolean isGeolocation() { - return value instanceof GeolocationValue; - } - - public boolean isJson() { - return value instanceof JsonValue; - } - - public boolean isNumber() { - return value instanceof NumberValue; - } - - public boolean isReferences() { - return value instanceof ReferencesValue; - } - - public boolean isString() { - return value instanceof StringValue; - } - - public boolean isTags() { - return value instanceof TagsValue; - } - - public boolean isUi() { - return value instanceof UiValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getArray() { - if (isArray()) { - return Optional.of(((ArrayValue) value).value); - } - return Optional.empty(); - } - - public Optional getAssets() { - if (isAssets()) { - return Optional.of(((AssetsValue) value).value); - } - return Optional.empty(); - } - - public Optional getBoolean() { - if (isBoolean()) { - return Optional.of(((BooleanValue) value).value); - } - return Optional.empty(); - } - - public Optional getComponent() { - if (isComponent()) { - return Optional.of(((ComponentValue) value).value); - } - return Optional.empty(); - } - - public Optional getComponents() { - if (isComponents()) { - return Optional.of(((ComponentsValue) value).value); - } - return Optional.empty(); - } - - public Optional getDateTime() { - if (isDateTime()) { - return Optional.of(((DateTimeValue) value).value); - } - return Optional.empty(); - } - - public Optional getGeolocation() { - if (isGeolocation()) { - return Optional.of(((GeolocationValue) value).value); - } - return Optional.empty(); - } - - public Optional getJson() { - if (isJson()) { - return Optional.of(((JsonValue) value).value); - } - return Optional.empty(); - } - - public Optional getNumber() { - if (isNumber()) { - return Optional.of(((NumberValue) value).value); - } - return Optional.empty(); - } - - public Optional getReferences() { - if (isReferences()) { - return Optional.of(((ReferencesValue) value).value); - } - return Optional.empty(); - } - - public Optional getString() { - if (isString()) { - return Optional.of(((StringValue) value).value); - } - return Optional.empty(); - } - - public Optional getTags() { - if (isTags()) { - return Optional.of(((TagsValue) value).value); - } - return Optional.empty(); - } - - public Optional getUi() { - if (isUi()) { - return Optional.of(((UiValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @com.fasterxml.jackson.annotation.JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitArray(ArrayFieldPropertiesDto array); - - T visitAssets(AssetsFieldPropertiesDto assets); - - T visitBoolean(BooleanFieldPropertiesDto boolean_); - - T visitComponent(ComponentFieldPropertiesDto component); - - T visitComponents(ComponentsFieldPropertiesDto components); - - T visitDateTime(DateTimeFieldPropertiesDto dateTime); - - T visitGeolocation(GeolocationFieldPropertiesDto geolocation); - - T visitJson(JsonFieldPropertiesDto json); - - T visitNumber(NumberFieldPropertiesDto number); - - T visitReferences(ReferencesFieldPropertiesDto references); - - T visitString(StringFieldPropertiesDto string); - - T visitTags(TagsFieldPropertiesDto tags); - - T visitUi(UiFieldPropertiesDto ui); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "fieldType", visible = true, defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(ArrayValue.class), - @JsonSubTypes.Type(AssetsValue.class), - @JsonSubTypes.Type(BooleanValue.class), - @JsonSubTypes.Type(ComponentValue.class), - @JsonSubTypes.Type(ComponentsValue.class), - @JsonSubTypes.Type(DateTimeValue.class), - @JsonSubTypes.Type(GeolocationValue.class), - @JsonSubTypes.Type(JsonValue.class), - @JsonSubTypes.Type(NumberValue.class), - @JsonSubTypes.Type(ReferencesValue.class), - @JsonSubTypes.Type(StringValue.class), - @JsonSubTypes.Type(TagsValue.class), - @JsonSubTypes.Type(UiValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("Array") - private static final class ArrayValue implements Value { - @JsonUnwrapped - private ArrayFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ArrayValue() {} - - private ArrayValue(ArrayFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitArray(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ArrayValue && equalTo((ArrayValue) other); - } - - private boolean equalTo(ArrayValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Assets") - private static final class AssetsValue implements Value { - @JsonUnwrapped - private AssetsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AssetsValue() {} - - private AssetsValue(AssetsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAssets(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsValue && equalTo((AssetsValue) other); - } - - private boolean equalTo(AssetsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Boolean") - private static final class BooleanValue implements Value { - @JsonUnwrapped - private BooleanFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private BooleanValue() {} - - private BooleanValue(BooleanFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitBoolean(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanValue && equalTo((BooleanValue) other); - } - - private boolean equalTo(BooleanValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Component") - private static final class ComponentValue implements Value { - @JsonUnwrapped - private ComponentFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ComponentValue() {} - - private ComponentValue(ComponentFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComponent(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentValue && equalTo((ComponentValue) other); - } - - private boolean equalTo(ComponentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Components") - private static final class ComponentsValue implements Value { - @JsonUnwrapped - private ComponentsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ComponentsValue() {} - - private ComponentsValue(ComponentsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComponents(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentsValue && equalTo((ComponentsValue) other); - } - - private boolean equalTo(ComponentsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("DateTime") - private static final class DateTimeValue implements Value { - @JsonUnwrapped - private DateTimeFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DateTimeValue() {} - - private DateTimeValue(DateTimeFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitDateTime(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DateTimeValue && equalTo((DateTimeValue) other); - } - - private boolean equalTo(DateTimeValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Geolocation") - private static final class GeolocationValue implements Value { - @JsonUnwrapped - private GeolocationFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private GeolocationValue() {} - - private GeolocationValue(GeolocationFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitGeolocation(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GeolocationValue && equalTo((GeolocationValue) other); - } - - private boolean equalTo(GeolocationValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Json") - private static final class JsonValue implements Value { - @JsonUnwrapped - private JsonFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private JsonValue() {} - - private JsonValue(JsonFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitJson(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof JsonValue && equalTo((JsonValue) other); - } - - private boolean equalTo(JsonValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Number") - private static final class NumberValue implements Value { - @JsonUnwrapped - private NumberFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private NumberValue() {} - - private NumberValue(NumberFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitNumber(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumberValue && equalTo((NumberValue) other); - } - - private boolean equalTo(NumberValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("References") - private static final class ReferencesValue implements Value { - @JsonUnwrapped - private ReferencesFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ReferencesValue() {} - - private ReferencesValue(ReferencesFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitReferences(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferencesValue && equalTo((ReferencesValue) other); - } - - private boolean equalTo(ReferencesValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("String") - private static final class StringValue implements Value { - @JsonUnwrapped - private StringFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private StringValue() {} - - private StringValue(StringFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitString(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StringValue && equalTo((StringValue) other); - } - - private boolean equalTo(StringValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Tags") - private static final class TagsValue implements Value { - @JsonUnwrapped - private TagsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TagsValue() {} - - private TagsValue(TagsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTags(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TagsValue && equalTo((TagsValue) other); - } - - private boolean equalTo(TagsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("UI") - private static final class UiValue implements Value { - @JsonUnwrapped - private UiFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private UiValue() {} - - private UiValue(UiFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitUi(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UiValue && equalTo((UiValue) other); - } - - private boolean equalTo(UiValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @com.fasterxml.jackson.annotation.JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/squidex/api/types/FieldRuleAction.java b/src/main/java/com/squidex/api/types/FieldRuleAction.java deleted file mode 100644 index 8bf22f7..0000000 --- a/src/main/java/com/squidex/api/types/FieldRuleAction.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum FieldRuleAction { - DISABLE("Disable"), - - HIDE("Hide"), - - REQUIRE("Require"); - - private final String value; - - FieldRuleAction(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/FieldRuleDto.java b/src/main/java/com/squidex/api/types/FieldRuleDto.java deleted file mode 100644 index 0303826..0000000 --- a/src/main/java/com/squidex/api/types/FieldRuleDto.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FieldRuleDto.Builder.class) -public final class FieldRuleDto { - private final FieldRuleAction action; - - private final String field; - - private final Optional condition; - - private FieldRuleDto(FieldRuleAction action, String field, Optional condition) { - this.action = action; - this.field = field; - this.condition = condition; - } - - @JsonProperty("action") - public FieldRuleAction getAction() { - return action; - } - - /** - * @return The field to update. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("field") - public String getField() { - return field; - } - - /** - * @return The condition. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldRuleDto && equalTo((FieldRuleDto) other); - } - - private boolean equalTo(FieldRuleDto other) { - return action.equals(other.action) && field.equals(other.field) && condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.action, this.field, this.condition); - } - - @Override - public String toString() { - return "FieldRuleDto{" + "action: " + action + ", field: " + field + ", condition: " + condition + "}"; - } - - public static ActionStage builder() { - return new Builder(); - } - - public interface ActionStage { - FieldStage action(FieldRuleAction action); - - Builder from(FieldRuleDto other); - } - - public interface FieldStage { - _FinalStage field(String field); - } - - public interface _FinalStage { - FieldRuleDto build(); - - _FinalStage condition(Optional condition); - - _FinalStage condition(String condition); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ActionStage, FieldStage, _FinalStage { - private FieldRuleAction action; - - private String field; - - private Optional condition = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(FieldRuleDto other) { - action(other.getAction()); - field(other.getField()); - condition(other.getCondition()); - return this; - } - - @Override - @JsonSetter("action") - public FieldStage action(FieldRuleAction action) { - this.action = action; - return this; - } - - /** - *

The field to update. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("field") - public _FinalStage field(String field) { - this.field = field; - return this; - } - - /** - *

The condition.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - @Override - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public _FinalStage condition(Optional condition) { - this.condition = condition; - return this; - } - - @Override - public FieldRuleDto build() { - return new FieldRuleDto(action, field, condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java deleted file mode 100644 index 6b1a675..0000000 --- a/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = GeolocationFieldPropertiesDto.Builder.class) -public final class GeolocationFieldPropertiesDto { - private final Optional editor; - - private GeolocationFieldPropertiesDto(Optional editor) { - this.editor = editor; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GeolocationFieldPropertiesDto && equalTo((GeolocationFieldPropertiesDto) other); - } - - private boolean equalTo(GeolocationFieldPropertiesDto other) { - return editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash(this.editor); - } - - @Override - public String toString() { - return "GeolocationFieldPropertiesDto{" + "editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(GeolocationFieldPropertiesDto other) { - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(String editor) { - this.editor = Optional.of(editor); - return this; - } - - public GeolocationFieldPropertiesDto build() { - return new GeolocationFieldPropertiesDto(editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/HistoryEventDto.java b/src/main/java/com/squidex/api/types/HistoryEventDto.java deleted file mode 100644 index 637438e..0000000 --- a/src/main/java/com/squidex/api/types/HistoryEventDto.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryEventDto.Builder.class) -public final class HistoryEventDto { - private final String message; - - private final String eventType; - - private final String actor; - - private final String eventId; - - private final OffsetDateTime created; - - private final int version; - - private HistoryEventDto( - String message, String eventType, String actor, String eventId, OffsetDateTime created, int version) { - this.message = message; - this.eventType = eventType; - this.actor = actor; - this.eventId = eventId; - this.created = created; - this.version = version; - } - - /** - * @return The message for the event. - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - /** - * @return The type of the original event. - */ - @JsonProperty("eventType") - public String getEventType() { - return eventType; - } - - /** - * @return The user who called the action. - */ - @JsonProperty("actor") - public String getActor() { - return actor; - } - - /** - * @return Gets a unique id for the event. - */ - @JsonProperty("eventId") - public String getEventId() { - return eventId; - } - - /** - * @return The time when the event happened. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The version identifier. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryEventDto && equalTo((HistoryEventDto) other); - } - - private boolean equalTo(HistoryEventDto other) { - return message.equals(other.message) - && eventType.equals(other.eventType) - && actor.equals(other.actor) - && eventId.equals(other.eventId) - && created.equals(other.created) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.message, this.eventType, this.actor, this.eventId, this.created, this.version); - } - - @Override - public String toString() { - return "HistoryEventDto{" + "message: " + message + ", eventType: " + eventType + ", actor: " + actor - + ", eventId: " + eventId + ", created: " + created + ", version: " + version + "}"; - } - - public static MessageStage builder() { - return new Builder(); - } - - public interface MessageStage { - EventTypeStage message(String message); - - Builder from(HistoryEventDto other); - } - - public interface EventTypeStage { - ActorStage eventType(String eventType); - } - - public interface ActorStage { - EventIdStage actor(String actor); - } - - public interface EventIdStage { - CreatedStage eventId(String eventId); - } - - public interface CreatedStage { - VersionStage created(OffsetDateTime created); - } - - public interface VersionStage { - _FinalStage version(int version); - } - - public interface _FinalStage { - HistoryEventDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements MessageStage, EventTypeStage, ActorStage, EventIdStage, CreatedStage, VersionStage, _FinalStage { - private String message; - - private String eventType; - - private String actor; - - private String eventId; - - private OffsetDateTime created; - - private int version; - - private Builder() {} - - @Override - public Builder from(HistoryEventDto other) { - message(other.getMessage()); - eventType(other.getEventType()); - actor(other.getActor()); - eventId(other.getEventId()); - created(other.getCreated()); - version(other.getVersion()); - return this; - } - - /** - *

The message for the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("message") - public EventTypeStage message(String message) { - this.message = message; - return this; - } - - /** - *

The type of the original event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventType") - public ActorStage eventType(String eventType) { - this.eventType = eventType; - return this; - } - - /** - *

The user who called the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("actor") - public EventIdStage actor(String actor) { - this.actor = actor; - return this; - } - - /** - *

Gets a unique id for the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventId") - public CreatedStage eventId(String eventId) { - this.eventId = eventId; - return this; - } - - /** - *

The time when the event happened.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public VersionStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The version identifier.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - @Override - public HistoryEventDto build() { - return new HistoryEventDto(message, eventType, actor, eventId, created, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/IResource.java b/src/main/java/com/squidex/api/types/IResource.java deleted file mode 100644 index 66b4b61..0000000 --- a/src/main/java/com/squidex/api/types/IResource.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.squidex.api.types; - -import java.util.Map; - -public interface IResource { - Map getLinks(); -} diff --git a/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java b/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java deleted file mode 100644 index 3663c3e..0000000 --- a/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import java.util.List; -import java.util.Map; -import java.util.Optional; - -public interface IUpsertSchemaDto { - Optional getProperties(); - - Optional getScripts(); - - Optional> getFieldsInReferences(); - - Optional> getFieldsInLists(); - - Optional> getFields(); - - Optional>> getPreviewUrls(); - - Optional> getFieldRules(); - - Optional getCategory(); - - Optional getIsPublished(); -} diff --git a/src/main/java/com/squidex/api/types/ImageFormat.java b/src/main/java/com/squidex/api/types/ImageFormat.java deleted file mode 100644 index 31765aa..0000000 --- a/src/main/java/com/squidex/api/types/ImageFormat.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ImageFormat { - AVIF("AVIF"), - - BMP("BMP"), - - GIF("GIF"), - - JPEG("JPEG"), - - PNG("PNG"), - - TGA("TGA"), - - TIFF("TIFF"), - - WEBP("WEBP"); - - private final String value; - - ImageFormat(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/JobStatus.java b/src/main/java/com/squidex/api/types/JobStatus.java deleted file mode 100644 index d2475a9..0000000 --- a/src/main/java/com/squidex/api/types/JobStatus.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum JobStatus { - CREATED("Created"), - - STARTED("Started"), - - COMPLETED("Completed"), - - FAILED("Failed"); - - private final String value; - - JobStatus(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java deleted file mode 100644 index d039fd4..0000000 --- a/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = JsonFieldPropertiesDto.Builder.class) -public final class JsonFieldPropertiesDto { - private final Optional graphQlSchema; - - private JsonFieldPropertiesDto(Optional graphQlSchema) { - this.graphQlSchema = graphQlSchema; - } - - /** - * @return The GraphQL schema. - */ - @JsonProperty("graphQLSchema") - public Optional getGraphQlSchema() { - return graphQlSchema; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof JsonFieldPropertiesDto && equalTo((JsonFieldPropertiesDto) other); - } - - private boolean equalTo(JsonFieldPropertiesDto other) { - return graphQlSchema.equals(other.graphQlSchema); - } - - @Override - public int hashCode() { - return Objects.hash(this.graphQlSchema); - } - - @Override - public String toString() { - return "JsonFieldPropertiesDto{" + "graphQlSchema: " + graphQlSchema + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional graphQlSchema = Optional.empty(); - - private Builder() {} - - public Builder from(JsonFieldPropertiesDto other) { - graphQlSchema(other.getGraphQlSchema()); - return this; - } - - @JsonSetter(value = "graphQLSchema", nulls = Nulls.SKIP) - public Builder graphQlSchema(Optional graphQlSchema) { - this.graphQlSchema = graphQlSchema; - return this; - } - - public Builder graphQlSchema(String graphQlSchema) { - this.graphQlSchema = Optional.of(graphQlSchema); - return this; - } - - public JsonFieldPropertiesDto build() { - return new JsonFieldPropertiesDto(graphQlSchema); - } - } -} diff --git a/src/main/java/com/squidex/api/types/LanguageDto.java b/src/main/java/com/squidex/api/types/LanguageDto.java deleted file mode 100644 index 5e5056f..0000000 --- a/src/main/java/com/squidex/api/types/LanguageDto.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = LanguageDto.Builder.class) -public final class LanguageDto { - private final String iso2Code; - - private final String englishName; - - private final String nativeName; - - private LanguageDto(String iso2Code, String englishName, String nativeName) { - this.iso2Code = iso2Code; - this.englishName = englishName; - this.nativeName = nativeName; - } - - /** - * @return The iso code of the language. - */ - @JsonProperty("iso2Code") - public String getIso2Code() { - return iso2Code; - } - - /** - * @return The english name of the language. - */ - @JsonProperty("englishName") - public String getEnglishName() { - return englishName; - } - - /** - * @return The native name of the language. - */ - @JsonProperty("nativeName") - public String getNativeName() { - return nativeName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof LanguageDto && equalTo((LanguageDto) other); - } - - private boolean equalTo(LanguageDto other) { - return iso2Code.equals(other.iso2Code) - && englishName.equals(other.englishName) - && nativeName.equals(other.nativeName); - } - - @Override - public int hashCode() { - return Objects.hash(this.iso2Code, this.englishName, this.nativeName); - } - - @Override - public String toString() { - return "LanguageDto{" + "iso2Code: " + iso2Code + ", englishName: " + englishName + ", nativeName: " - + nativeName + "}"; - } - - public static Iso2CodeStage builder() { - return new Builder(); - } - - public interface Iso2CodeStage { - EnglishNameStage iso2Code(String iso2Code); - - Builder from(LanguageDto other); - } - - public interface EnglishNameStage { - NativeNameStage englishName(String englishName); - } - - public interface NativeNameStage { - _FinalStage nativeName(String nativeName); - } - - public interface _FinalStage { - LanguageDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements Iso2CodeStage, EnglishNameStage, NativeNameStage, _FinalStage { - private String iso2Code; - - private String englishName; - - private String nativeName; - - private Builder() {} - - @Override - public Builder from(LanguageDto other) { - iso2Code(other.getIso2Code()); - englishName(other.getEnglishName()); - nativeName(other.getNativeName()); - return this; - } - - /** - *

The iso code of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("iso2Code") - public EnglishNameStage iso2Code(String iso2Code) { - this.iso2Code = iso2Code; - return this; - } - - /** - *

The english name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("englishName") - public NativeNameStage englishName(String englishName) { - this.englishName = englishName; - return this; - } - - /** - *

The native name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("nativeName") - public _FinalStage nativeName(String nativeName) { - this.nativeName = nativeName; - return this; - } - - @Override - public LanguageDto build() { - return new LanguageDto(iso2Code, englishName, nativeName); - } - } -} diff --git a/src/main/java/com/squidex/api/types/LogDownloadDto.java b/src/main/java/com/squidex/api/types/LogDownloadDto.java deleted file mode 100644 index f947552..0000000 --- a/src/main/java/com/squidex/api/types/LogDownloadDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = LogDownloadDto.Builder.class) -public final class LogDownloadDto { - private final Optional downloadUrl; - - private LogDownloadDto(Optional downloadUrl) { - this.downloadUrl = downloadUrl; - } - - /** - * @return The url to download the log. - */ - @JsonProperty("downloadUrl") - public Optional getDownloadUrl() { - return downloadUrl; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof LogDownloadDto && equalTo((LogDownloadDto) other); - } - - private boolean equalTo(LogDownloadDto other) { - return downloadUrl.equals(other.downloadUrl); - } - - @Override - public int hashCode() { - return Objects.hash(this.downloadUrl); - } - - @Override - public String toString() { - return "LogDownloadDto{" + "downloadUrl: " + downloadUrl + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional downloadUrl = Optional.empty(); - - private Builder() {} - - public Builder from(LogDownloadDto other) { - downloadUrl(other.getDownloadUrl()); - return this; - } - - @JsonSetter(value = "downloadUrl", nulls = Nulls.SKIP) - public Builder downloadUrl(Optional downloadUrl) { - this.downloadUrl = downloadUrl; - return this; - } - - public Builder downloadUrl(String downloadUrl) { - this.downloadUrl = Optional.of(downloadUrl); - return this; - } - - public LogDownloadDto build() { - return new LogDownloadDto(downloadUrl); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java deleted file mode 100644 index 7f66c50..0000000 --- a/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.squidex.api.types; - -public final class ManualRuleTriggerDto { - private ManualRuleTriggerDto() {} - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ManualRuleTriggerDto; - } - - @Override - public String toString() { - return "ManualRuleTriggerDto{" + "}"; - } -} diff --git a/src/main/java/com/squidex/api/types/MediumRuleActionDto.java b/src/main/java/com/squidex/api/types/MediumRuleActionDto.java deleted file mode 100644 index 04c4802..0000000 --- a/src/main/java/com/squidex/api/types/MediumRuleActionDto.java +++ /dev/null @@ -1,305 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MediumRuleActionDto.Builder.class) -public final class MediumRuleActionDto { - private final String accessToken; - - private final String title; - - private final String content; - - private final Optional canonicalUrl; - - private final Optional tags; - - private final Optional publicationId; - - private final boolean isHtml; - - private MediumRuleActionDto( - String accessToken, - String title, - String content, - Optional canonicalUrl, - Optional tags, - Optional publicationId, - boolean isHtml) { - this.accessToken = accessToken; - this.title = title; - this.content = content; - this.canonicalUrl = canonicalUrl; - this.tags = tags; - this.publicationId = publicationId; - this.isHtml = isHtml; - } - - /** - * @return The self issued access token. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("accessToken") - public String getAccessToken() { - return accessToken; - } - - /** - * @return The title, used for the url. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * @return The content, either html or markdown. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - /** - * @return The original home of this content, if it was originally published elsewhere. - */ - @JsonProperty("canonicalUrl") - public Optional getCanonicalUrl() { - return canonicalUrl; - } - - /** - * @return The optional comma separated list of tags. - */ - @JsonProperty("tags") - public Optional getTags() { - return tags; - } - - /** - * @return Optional publication id. - */ - @JsonProperty("publicationId") - public Optional getPublicationId() { - return publicationId; - } - - /** - * @return Indicates whether the content is markdown or html. - */ - @JsonProperty("isHtml") - public boolean getIsHtml() { - return isHtml; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MediumRuleActionDto && equalTo((MediumRuleActionDto) other); - } - - private boolean equalTo(MediumRuleActionDto other) { - return accessToken.equals(other.accessToken) - && title.equals(other.title) - && content.equals(other.content) - && canonicalUrl.equals(other.canonicalUrl) - && tags.equals(other.tags) - && publicationId.equals(other.publicationId) - && isHtml == other.isHtml; - } - - @Override - public int hashCode() { - return Objects.hash( - this.accessToken, - this.title, - this.content, - this.canonicalUrl, - this.tags, - this.publicationId, - this.isHtml); - } - - @Override - public String toString() { - return "MediumRuleActionDto{" + "accessToken: " + accessToken + ", title: " + title + ", content: " + content - + ", canonicalUrl: " + canonicalUrl + ", tags: " + tags + ", publicationId: " + publicationId - + ", isHtml: " + isHtml + "}"; - } - - public static AccessTokenStage builder() { - return new Builder(); - } - - public interface AccessTokenStage { - TitleStage accessToken(String accessToken); - - Builder from(MediumRuleActionDto other); - } - - public interface TitleStage { - ContentStage title(String title); - } - - public interface ContentStage { - IsHtmlStage content(String content); - } - - public interface IsHtmlStage { - _FinalStage isHtml(boolean isHtml); - } - - public interface _FinalStage { - MediumRuleActionDto build(); - - _FinalStage canonicalUrl(Optional canonicalUrl); - - _FinalStage canonicalUrl(String canonicalUrl); - - _FinalStage tags(Optional tags); - - _FinalStage tags(String tags); - - _FinalStage publicationId(Optional publicationId); - - _FinalStage publicationId(String publicationId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccessTokenStage, TitleStage, ContentStage, IsHtmlStage, _FinalStage { - private String accessToken; - - private String title; - - private String content; - - private boolean isHtml; - - private Optional publicationId = Optional.empty(); - - private Optional tags = Optional.empty(); - - private Optional canonicalUrl = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(MediumRuleActionDto other) { - accessToken(other.getAccessToken()); - title(other.getTitle()); - content(other.getContent()); - canonicalUrl(other.getCanonicalUrl()); - tags(other.getTags()); - publicationId(other.getPublicationId()); - isHtml(other.getIsHtml()); - return this; - } - - /** - *

The self issued access token. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessToken") - public TitleStage accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - *

The title, used for the url. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("title") - public ContentStage title(String title) { - this.title = title; - return this; - } - - /** - *

The content, either html or markdown. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("content") - public IsHtmlStage content(String content) { - this.content = content; - return this; - } - - /** - *

Indicates whether the content is markdown or html.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHtml") - public _FinalStage isHtml(boolean isHtml) { - this.isHtml = isHtml; - return this; - } - - /** - *

Optional publication id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage publicationId(String publicationId) { - this.publicationId = Optional.of(publicationId); - return this; - } - - @Override - @JsonSetter(value = "publicationId", nulls = Nulls.SKIP) - public _FinalStage publicationId(Optional publicationId) { - this.publicationId = publicationId; - return this; - } - - /** - *

The optional comma separated list of tags.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(String tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional tags) { - this.tags = tags; - return this; - } - - /** - *

The original home of this content, if it was originally published elsewhere.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage canonicalUrl(String canonicalUrl) { - this.canonicalUrl = Optional.of(canonicalUrl); - return this; - } - - @Override - @JsonSetter(value = "canonicalUrl", nulls = Nulls.SKIP) - public _FinalStage canonicalUrl(Optional canonicalUrl) { - this.canonicalUrl = canonicalUrl; - return this; - } - - @Override - public MediumRuleActionDto build() { - return new MediumRuleActionDto(accessToken, title, content, canonicalUrl, tags, publicationId, isHtml); - } - } -} diff --git a/src/main/java/com/squidex/api/types/NestedFieldDto.java b/src/main/java/com/squidex/api/types/NestedFieldDto.java deleted file mode 100644 index 544a727..0000000 --- a/src/main/java/com/squidex/api/types/NestedFieldDto.java +++ /dev/null @@ -1,302 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NestedFieldDto.Builder.class) -public final class NestedFieldDto implements IResource { - private final Map links; - - private final int fieldId; - - private final String name; - - private final boolean isHidden; - - private final boolean isLocked; - - private final boolean isDisabled; - - private final FieldPropertiesDto properties; - - private NestedFieldDto( - Map links, - int fieldId, - String name, - boolean isHidden, - boolean isLocked, - boolean isDisabled, - FieldPropertiesDto properties) { - this.links = links; - this.fieldId = fieldId; - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.properties = properties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the field. - */ - @JsonProperty("fieldId") - public int getFieldId() { - return fieldId; - } - - /** - * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public boolean getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public boolean getIsDisabled() { - return isDisabled; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NestedFieldDto && equalTo((NestedFieldDto) other); - } - - private boolean equalTo(NestedFieldDto other) { - return links.equals(other.links) - && fieldId == other.fieldId - && name.equals(other.name) - && isHidden == other.isHidden - && isLocked == other.isLocked - && isDisabled == other.isDisabled - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.fieldId, this.name, this.isHidden, this.isLocked, this.isDisabled, this.properties); - } - - @Override - public String toString() { - return "NestedFieldDto{" + "links: " + links + ", fieldId: " + fieldId + ", name: " + name + ", isHidden: " - + isHidden + ", isLocked: " + isLocked + ", isDisabled: " + isDisabled + ", properties: " + properties - + "}"; - } - - public static FieldIdStage builder() { - return new Builder(); - } - - public interface FieldIdStage { - NameStage fieldId(int fieldId); - - Builder from(NestedFieldDto other); - } - - public interface NameStage { - IsHiddenStage name(String name); - } - - public interface IsHiddenStage { - IsLockedStage isHidden(boolean isHidden); - } - - public interface IsLockedStage { - IsDisabledStage isLocked(boolean isLocked); - } - - public interface IsDisabledStage { - PropertiesStage isDisabled(boolean isDisabled); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - } - - public interface _FinalStage { - NestedFieldDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements FieldIdStage, - NameStage, - IsHiddenStage, - IsLockedStage, - IsDisabledStage, - PropertiesStage, - _FinalStage { - private int fieldId; - - private String name; - - private boolean isHidden; - - private boolean isLocked; - - private boolean isDisabled; - - private FieldPropertiesDto properties; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(NestedFieldDto other) { - links(other.getLinks()); - fieldId(other.getFieldId()); - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - properties(other.getProperties()); - return this; - } - - /** - *

The ID of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fieldId") - public NameStage fieldId(int fieldId) { - this.fieldId = fieldId; - return this; - } - - /** - *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public IsHiddenStage name(String name) { - this.name = name; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHidden") - public IsLockedStage isHidden(boolean isHidden) { - this.isHidden = isHidden; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public IsDisabledStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDisabled") - public PropertiesStage isDisabled(boolean isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public NestedFieldDto build() { - return new NestedFieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java b/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java deleted file mode 100644 index 0967804..0000000 --- a/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NotificationRuleActionDto.Builder.class) -public final class NotificationRuleActionDto { - private final String user; - - private final String text; - - private final Optional url; - - private final Optional client; - - private NotificationRuleActionDto(String user, String text, Optional url, Optional client) { - this.user = user; - this.text = text; - this.url = url; - this.client = client; - } - - /** - * @return The user id or email. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("user") - public String getUser() { - return user; - } - - /** - * @return The text to send. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The optional url to attach to the notification. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public Optional getClient() { - return client; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationRuleActionDto && equalTo((NotificationRuleActionDto) other); - } - - private boolean equalTo(NotificationRuleActionDto other) { - return user.equals(other.user) - && text.equals(other.text) - && url.equals(other.url) - && client.equals(other.client); - } - - @Override - public int hashCode() { - return Objects.hash(this.user, this.text, this.url, this.client); - } - - @Override - public String toString() { - return "NotificationRuleActionDto{" + "user: " + user + ", text: " + text + ", url: " + url + ", client: " - + client + "}"; - } - - public static UserStage builder() { - return new Builder(); - } - - public interface UserStage { - TextStage user(String user); - - Builder from(NotificationRuleActionDto other); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - NotificationRuleActionDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - - _FinalStage client(Optional client); - - _FinalStage client(String client); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UserStage, TextStage, _FinalStage { - private String user; - - private String text; - - private Optional client = Optional.empty(); - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(NotificationRuleActionDto other) { - user(other.getUser()); - text(other.getText()); - url(other.getUrl()); - client(other.getClient()); - return this; - } - - /** - *

The user id or email. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("user") - public TextStage user(String user) { - this.user = user; - return this; - } - - /** - *

The text to send. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage client(String client) { - this.client = Optional.of(client); - return this; - } - - @Override - @JsonSetter(value = "client", nulls = Nulls.SKIP) - public _FinalStage client(Optional client) { - this.client = client; - return this; - } - - /** - *

The optional url to attach to the notification.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public NotificationRuleActionDto build() { - return new NotificationRuleActionDto(user, text, url, client); - } - } -} diff --git a/src/main/java/com/squidex/api/types/NumberFieldEditor.java b/src/main/java/com/squidex/api/types/NumberFieldEditor.java deleted file mode 100644 index 2547c17..0000000 --- a/src/main/java/com/squidex/api/types/NumberFieldEditor.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum NumberFieldEditor { - INPUT("Input"), - - RADIO("Radio"), - - DROPDOWN("Dropdown"), - - STARS("Stars"); - - private final String value; - - NumberFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java deleted file mode 100644 index 90d11d5..0000000 --- a/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java +++ /dev/null @@ -1,276 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NumberFieldPropertiesDto.Builder.class) -public final class NumberFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional defaultValue; - - private final Optional maxValue; - - private final Optional minValue; - - private final Optional> allowedValues; - - private final Optional isUnique; - - private final Optional inlineEditable; - - private final Optional editor; - - private NumberFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional maxValue, - Optional minValue, - Optional> allowedValues, - Optional isUnique, - Optional inlineEditable, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.maxValue = maxValue; - this.minValue = minValue; - this.allowedValues = allowedValues; - this.isUnique = isUnique; - this.inlineEditable = inlineEditable; - this.editor = editor; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The maximum allowed value for the field value. - */ - @JsonProperty("maxValue") - public Optional getMaxValue() { - return maxValue; - } - - /** - * @return The minimum allowed value for the field value. - */ - @JsonProperty("minValue") - public Optional getMinValue() { - return minValue; - } - - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } - - /** - * @return Indicates if the field value must be unique. Ignored for nested fields and localized fields. - */ - @JsonProperty("isUnique") - public Optional getIsUnique() { - return isUnique; - } - - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumberFieldPropertiesDto && equalTo((NumberFieldPropertiesDto) other); - } - - private boolean equalTo(NumberFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && maxValue.equals(other.maxValue) - && minValue.equals(other.minValue) - && allowedValues.equals(other.allowedValues) - && isUnique.equals(other.isUnique) - && inlineEditable.equals(other.inlineEditable) - && editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.maxValue, - this.minValue, - this.allowedValues, - this.isUnique, - this.inlineEditable, - this.editor); - } - - @Override - public String toString() { - return "NumberFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", maxValue: " + maxValue + ", minValue: " + minValue + ", allowedValues: " + allowedValues - + ", isUnique: " + isUnique + ", inlineEditable: " + inlineEditable + ", editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional maxValue = Optional.empty(); - - private Optional minValue = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional isUnique = Optional.empty(); - - private Optional inlineEditable = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(NumberFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - maxValue(other.getMaxValue()); - minValue(other.getMinValue()); - allowedValues(other.getAllowedValues()); - isUnique(other.getIsUnique()); - inlineEditable(other.getInlineEditable()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(Double defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "maxValue", nulls = Nulls.SKIP) - public Builder maxValue(Optional maxValue) { - this.maxValue = maxValue; - return this; - } - - public Builder maxValue(Double maxValue) { - this.maxValue = Optional.of(maxValue); - return this; - } - - @JsonSetter(value = "minValue", nulls = Nulls.SKIP) - public Builder minValue(Optional minValue) { - this.minValue = minValue; - return this; - } - - public Builder minValue(Double minValue) { - this.minValue = Optional.of(minValue); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "isUnique", nulls = Nulls.SKIP) - public Builder isUnique(Optional isUnique) { - this.isUnique = isUnique; - return this; - } - - public Builder isUnique(Boolean isUnique) { - this.isUnique = Optional.of(isUnique); - return this; - } - - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; - } - - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(NumberFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public NumberFieldPropertiesDto build() { - return new NumberFieldPropertiesDto( - defaultValues, defaultValue, maxValue, minValue, allowedValues, isUnique, inlineEditable, editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java deleted file mode 100644 index 0b94cd6..0000000 --- a/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = OpenSearchRuleActionDto.Builder.class) -public final class OpenSearchRuleActionDto { - private final String host; - - private final String indexName; - - private final Optional username; - - private final Optional password; - - private final Optional document; - - private final Optional delete; - - private OpenSearchRuleActionDto( - String host, - String indexName, - Optional username, - Optional password, - Optional document, - Optional delete) { - this.host = host; - this.indexName = indexName; - this.username = username; - this.password = password; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional username. - */ - @JsonProperty("username") - public Optional getUsername() { - return username; - } - - /** - * @return The optional password. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenSearchRuleActionDto && equalTo((OpenSearchRuleActionDto) other); - } - - private boolean equalTo(OpenSearchRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && username.equals(other.username) - && password.equals(other.password) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.username, this.password, this.document, this.delete); - } - - @Override - public String toString() { - return "OpenSearchRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", username: " + username - + ", password: " + password + ", document: " + document + ", delete: " + delete + "}"; - } - - public static HostStage builder() { - return new Builder(); - } - - public interface HostStage { - IndexNameStage host(String host); - - Builder from(OpenSearchRuleActionDto other); - } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); - } - - public interface _FinalStage { - OpenSearchRuleActionDto build(); - - _FinalStage username(Optional username); - - _FinalStage username(String username); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, _FinalStage { - private String host; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Optional password = Optional.empty(); - - private Optional username = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(OpenSearchRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - username(other.getUsername()); - password(other.getPassword()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; - } - - /** - *

The name of the index. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - /** - *

The optional password.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - /** - *

The optional username.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage username(String username) { - this.username = Optional.of(username); - return this; - } - - @Override - @JsonSetter(value = "username", nulls = Nulls.SKIP) - public _FinalStage username(Optional username) { - this.username = username; - return this; - } - - @Override - public OpenSearchRuleActionDto build() { - return new OpenSearchRuleActionDto(host, indexName, username, password, document, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/types/PatternDto.java b/src/main/java/com/squidex/api/types/PatternDto.java deleted file mode 100644 index e16d272..0000000 --- a/src/main/java/com/squidex/api/types/PatternDto.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PatternDto.Builder.class) -public final class PatternDto { - private final String name; - - private final String regex; - - private final Optional message; - - private PatternDto(String name, String regex, Optional message) { - this.name = name; - this.regex = regex; - this.message = message; - } - - /** - * @return The name of the suggestion. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The regex pattern. - */ - @JsonProperty("regex") - public String getRegex() { - return regex; - } - - /** - * @return The regex message. - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PatternDto && equalTo((PatternDto) other); - } - - private boolean equalTo(PatternDto other) { - return name.equals(other.name) && regex.equals(other.regex) && message.equals(other.message); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.regex, this.message); - } - - @Override - public String toString() { - return "PatternDto{" + "name: " + name + ", regex: " + regex + ", message: " + message + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - RegexStage name(String name); - - Builder from(PatternDto other); - } - - public interface RegexStage { - _FinalStage regex(String regex); - } - - public interface _FinalStage { - PatternDto build(); - - _FinalStage message(Optional message); - - _FinalStage message(String message); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, RegexStage, _FinalStage { - private String name; - - private String regex; - - private Optional message = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(PatternDto other) { - name(other.getName()); - regex(other.getRegex()); - message(other.getMessage()); - return this; - } - - /** - *

The name of the suggestion.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public RegexStage name(String name) { - this.name = name; - return this; - } - - /** - *

The regex pattern.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("regex") - public _FinalStage regex(String regex) { - this.regex = regex; - return this; - } - - /** - *

The regex message.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage message(String message) { - this.message = Optional.of(message); - return this; - } - - @Override - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public _FinalStage message(Optional message) { - this.message = message; - return this; - } - - @Override - public PatternDto build() { - return new PatternDto(name, regex, message); - } - } -} diff --git a/src/main/java/com/squidex/api/types/PlanChangedDto.java b/src/main/java/com/squidex/api/types/PlanChangedDto.java deleted file mode 100644 index 41ee5e6..0000000 --- a/src/main/java/com/squidex/api/types/PlanChangedDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlanChangedDto.Builder.class) -public final class PlanChangedDto { - private final Optional redirectUri; - - private PlanChangedDto(Optional redirectUri) { - this.redirectUri = redirectUri; - } - - /** - * @return Optional redirect uri. - */ - @JsonProperty("redirectUri") - public Optional getRedirectUri() { - return redirectUri; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlanChangedDto && equalTo((PlanChangedDto) other); - } - - private boolean equalTo(PlanChangedDto other) { - return redirectUri.equals(other.redirectUri); - } - - @Override - public int hashCode() { - return Objects.hash(this.redirectUri); - } - - @Override - public String toString() { - return "PlanChangedDto{" + "redirectUri: " + redirectUri + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional redirectUri = Optional.empty(); - - private Builder() {} - - public Builder from(PlanChangedDto other) { - redirectUri(other.getRedirectUri()); - return this; - } - - @JsonSetter(value = "redirectUri", nulls = Nulls.SKIP) - public Builder redirectUri(Optional redirectUri) { - this.redirectUri = redirectUri; - return this; - } - - public Builder redirectUri(String redirectUri) { - this.redirectUri = Optional.of(redirectUri); - return this; - } - - public PlanChangedDto build() { - return new PlanChangedDto(redirectUri); - } - } -} diff --git a/src/main/java/com/squidex/api/types/PlanDto.java b/src/main/java/com/squidex/api/types/PlanDto.java deleted file mode 100644 index cd233b2..0000000 --- a/src/main/java/com/squidex/api/types/PlanDto.java +++ /dev/null @@ -1,459 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlanDto.Builder.class) -public final class PlanDto { - private final String id; - - private final String name; - - private final String costs; - - private final Optional confirmText; - - private final Optional yearlyConfirmText; - - private final Optional yearlyCosts; - - private final Optional yearlyId; - - private final int maxApiBytes; - - private final int maxApiCalls; - - private final int maxAssetSize; - - private final int maxContributors; - - private PlanDto( - String id, - String name, - String costs, - Optional confirmText, - Optional yearlyConfirmText, - Optional yearlyCosts, - Optional yearlyId, - int maxApiBytes, - int maxApiCalls, - int maxAssetSize, - int maxContributors) { - this.id = id; - this.name = name; - this.costs = costs; - this.confirmText = confirmText; - this.yearlyConfirmText = yearlyConfirmText; - this.yearlyCosts = yearlyCosts; - this.yearlyId = yearlyId; - this.maxApiBytes = maxApiBytes; - this.maxApiCalls = maxApiCalls; - this.maxAssetSize = maxAssetSize; - this.maxContributors = maxContributors; - } - - /** - * @return The ID of the plan. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the plan. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The monthly costs of the plan. - */ - @JsonProperty("costs") - public String getCosts() { - return costs; - } - - /** - * @return An optional confirm text for the monthly subscription. - */ - @JsonProperty("confirmText") - public Optional getConfirmText() { - return confirmText; - } - - /** - * @return An optional confirm text for the yearly subscription. - */ - @JsonProperty("yearlyConfirmText") - public Optional getYearlyConfirmText() { - return yearlyConfirmText; - } - - /** - * @return The yearly costs of the plan. - */ - @JsonProperty("yearlyCosts") - public Optional getYearlyCosts() { - return yearlyCosts; - } - - /** - * @return The yearly ID of the plan. - */ - @JsonProperty("yearlyId") - public Optional getYearlyId() { - return yearlyId; - } - - /** - * @return The maximum number of API traffic. - */ - @JsonProperty("maxApiBytes") - public int getMaxApiBytes() { - return maxApiBytes; - } - - /** - * @return The maximum number of API calls. - */ - @JsonProperty("maxApiCalls") - public int getMaxApiCalls() { - return maxApiCalls; - } - - /** - * @return The maximum allowed asset size. - */ - @JsonProperty("maxAssetSize") - public int getMaxAssetSize() { - return maxAssetSize; - } - - /** - * @return The maximum number of contributors. - */ - @JsonProperty("maxContributors") - public int getMaxContributors() { - return maxContributors; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlanDto && equalTo((PlanDto) other); - } - - private boolean equalTo(PlanDto other) { - return id.equals(other.id) - && name.equals(other.name) - && costs.equals(other.costs) - && confirmText.equals(other.confirmText) - && yearlyConfirmText.equals(other.yearlyConfirmText) - && yearlyCosts.equals(other.yearlyCosts) - && yearlyId.equals(other.yearlyId) - && maxApiBytes == other.maxApiBytes - && maxApiCalls == other.maxApiCalls - && maxAssetSize == other.maxAssetSize - && maxContributors == other.maxContributors; - } - - @Override - public int hashCode() { - return Objects.hash( - this.id, - this.name, - this.costs, - this.confirmText, - this.yearlyConfirmText, - this.yearlyCosts, - this.yearlyId, - this.maxApiBytes, - this.maxApiCalls, - this.maxAssetSize, - this.maxContributors); - } - - @Override - public String toString() { - return "PlanDto{" + "id: " + id + ", name: " + name + ", costs: " + costs + ", confirmText: " + confirmText - + ", yearlyConfirmText: " + yearlyConfirmText + ", yearlyCosts: " + yearlyCosts + ", yearlyId: " - + yearlyId + ", maxApiBytes: " + maxApiBytes + ", maxApiCalls: " + maxApiCalls + ", maxAssetSize: " - + maxAssetSize + ", maxContributors: " + maxContributors + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - NameStage id(String id); - - Builder from(PlanDto other); - } - - public interface NameStage { - CostsStage name(String name); - } - - public interface CostsStage { - MaxApiBytesStage costs(String costs); - } - - public interface MaxApiBytesStage { - MaxApiCallsStage maxApiBytes(int maxApiBytes); - } - - public interface MaxApiCallsStage { - MaxAssetSizeStage maxApiCalls(int maxApiCalls); - } - - public interface MaxAssetSizeStage { - MaxContributorsStage maxAssetSize(int maxAssetSize); - } - - public interface MaxContributorsStage { - _FinalStage maxContributors(int maxContributors); - } - - public interface _FinalStage { - PlanDto build(); - - _FinalStage confirmText(Optional confirmText); - - _FinalStage confirmText(String confirmText); - - _FinalStage yearlyConfirmText(Optional yearlyConfirmText); - - _FinalStage yearlyConfirmText(String yearlyConfirmText); - - _FinalStage yearlyCosts(Optional yearlyCosts); - - _FinalStage yearlyCosts(String yearlyCosts); - - _FinalStage yearlyId(Optional yearlyId); - - _FinalStage yearlyId(String yearlyId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - NameStage, - CostsStage, - MaxApiBytesStage, - MaxApiCallsStage, - MaxAssetSizeStage, - MaxContributorsStage, - _FinalStage { - private String id; - - private String name; - - private String costs; - - private int maxApiBytes; - - private int maxApiCalls; - - private int maxAssetSize; - - private int maxContributors; - - private Optional yearlyId = Optional.empty(); - - private Optional yearlyCosts = Optional.empty(); - - private Optional yearlyConfirmText = Optional.empty(); - - private Optional confirmText = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(PlanDto other) { - id(other.getId()); - name(other.getName()); - costs(other.getCosts()); - confirmText(other.getConfirmText()); - yearlyConfirmText(other.getYearlyConfirmText()); - yearlyCosts(other.getYearlyCosts()); - yearlyId(other.getYearlyId()); - maxApiBytes(other.getMaxApiBytes()); - maxApiCalls(other.getMaxApiCalls()); - maxAssetSize(other.getMaxAssetSize()); - maxContributors(other.getMaxContributors()); - return this; - } - - /** - *

The ID of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; - } - - /** - *

The name of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public CostsStage name(String name) { - this.name = name; - return this; - } - - /** - *

The monthly costs of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("costs") - public MaxApiBytesStage costs(String costs) { - this.costs = costs; - return this; - } - - /** - *

The maximum number of API traffic.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxApiBytes") - public MaxApiCallsStage maxApiBytes(int maxApiBytes) { - this.maxApiBytes = maxApiBytes; - return this; - } - - /** - *

The maximum number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxApiCalls") - public MaxAssetSizeStage maxApiCalls(int maxApiCalls) { - this.maxApiCalls = maxApiCalls; - return this; - } - - /** - *

The maximum allowed asset size.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxAssetSize") - public MaxContributorsStage maxAssetSize(int maxAssetSize) { - this.maxAssetSize = maxAssetSize; - return this; - } - - /** - *

The maximum number of contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxContributors") - public _FinalStage maxContributors(int maxContributors) { - this.maxContributors = maxContributors; - return this; - } - - /** - *

The yearly ID of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyId(String yearlyId) { - this.yearlyId = Optional.of(yearlyId); - return this; - } - - @Override - @JsonSetter(value = "yearlyId", nulls = Nulls.SKIP) - public _FinalStage yearlyId(Optional yearlyId) { - this.yearlyId = yearlyId; - return this; - } - - /** - *

The yearly costs of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyCosts(String yearlyCosts) { - this.yearlyCosts = Optional.of(yearlyCosts); - return this; - } - - @Override - @JsonSetter(value = "yearlyCosts", nulls = Nulls.SKIP) - public _FinalStage yearlyCosts(Optional yearlyCosts) { - this.yearlyCosts = yearlyCosts; - return this; - } - - /** - *

An optional confirm text for the yearly subscription.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyConfirmText(String yearlyConfirmText) { - this.yearlyConfirmText = Optional.of(yearlyConfirmText); - return this; - } - - @Override - @JsonSetter(value = "yearlyConfirmText", nulls = Nulls.SKIP) - public _FinalStage yearlyConfirmText(Optional yearlyConfirmText) { - this.yearlyConfirmText = yearlyConfirmText; - return this; - } - - /** - *

An optional confirm text for the monthly subscription.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage confirmText(String confirmText) { - this.confirmText = Optional.of(confirmText); - return this; - } - - @Override - @JsonSetter(value = "confirmText", nulls = Nulls.SKIP) - public _FinalStage confirmText(Optional confirmText) { - this.confirmText = confirmText; - return this; - } - - @Override - public PlanDto build() { - return new PlanDto( - id, - name, - costs, - confirmText, - yearlyConfirmText, - yearlyCosts, - yearlyId, - maxApiBytes, - maxApiCalls, - maxAssetSize, - maxContributors); - } - } -} diff --git a/src/main/java/com/squidex/api/types/PlansDto.java b/src/main/java/com/squidex/api/types/PlansDto.java deleted file mode 100644 index 68d84c9..0000000 --- a/src/main/java/com/squidex/api/types/PlansDto.java +++ /dev/null @@ -1,280 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlansDto.Builder.class) -public final class PlansDto { - private final List plans; - - private final Optional currentPlanId; - - private final Optional planOwner; - - private final Optional portalLink; - - private final Optional referral; - - private final PlansLockedReason locked; - - private PlansDto( - List plans, - Optional currentPlanId, - Optional planOwner, - Optional portalLink, - Optional referral, - PlansLockedReason locked) { - this.plans = plans; - this.currentPlanId = currentPlanId; - this.planOwner = planOwner; - this.portalLink = portalLink; - this.referral = referral; - this.locked = locked; - } - - /** - * @return The available plans. - */ - @JsonProperty("plans") - public List getPlans() { - return plans; - } - - /** - * @return The current plan id. - */ - @JsonProperty("currentPlanId") - public Optional getCurrentPlanId() { - return currentPlanId; - } - - /** - * @return The plan owner. - */ - @JsonProperty("planOwner") - public Optional getPlanOwner() { - return planOwner; - } - - /** - * @return The link to the management portal. - */ - @JsonProperty("portalLink") - public Optional getPortalLink() { - return portalLink; - } - - @JsonProperty("referral") - public Optional getReferral() { - return referral; - } - - @JsonProperty("locked") - public PlansLockedReason getLocked() { - return locked; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlansDto && equalTo((PlansDto) other); - } - - private boolean equalTo(PlansDto other) { - return plans.equals(other.plans) - && currentPlanId.equals(other.currentPlanId) - && planOwner.equals(other.planOwner) - && portalLink.equals(other.portalLink) - && referral.equals(other.referral) - && locked.equals(other.locked); - } - - @Override - public int hashCode() { - return Objects.hash( - this.plans, this.currentPlanId, this.planOwner, this.portalLink, this.referral, this.locked); - } - - @Override - public String toString() { - return "PlansDto{" + "plans: " + plans + ", currentPlanId: " + currentPlanId + ", planOwner: " + planOwner - + ", portalLink: " + portalLink + ", referral: " + referral + ", locked: " + locked + "}"; - } - - public static LockedStage builder() { - return new Builder(); - } - - public interface LockedStage { - _FinalStage locked(PlansLockedReason locked); - - Builder from(PlansDto other); - } - - public interface _FinalStage { - PlansDto build(); - - _FinalStage plans(List plans); - - _FinalStage addPlans(PlanDto plans); - - _FinalStage addAllPlans(List plans); - - _FinalStage currentPlanId(Optional currentPlanId); - - _FinalStage currentPlanId(String currentPlanId); - - _FinalStage planOwner(Optional planOwner); - - _FinalStage planOwner(String planOwner); - - _FinalStage portalLink(Optional portalLink); - - _FinalStage portalLink(String portalLink); - - _FinalStage referral(Optional referral); - - _FinalStage referral(ReferralInfo referral); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LockedStage, _FinalStage { - private PlansLockedReason locked; - - private Optional referral = Optional.empty(); - - private Optional portalLink = Optional.empty(); - - private Optional planOwner = Optional.empty(); - - private Optional currentPlanId = Optional.empty(); - - private List plans = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(PlansDto other) { - plans(other.getPlans()); - currentPlanId(other.getCurrentPlanId()); - planOwner(other.getPlanOwner()); - portalLink(other.getPortalLink()); - referral(other.getReferral()); - locked(other.getLocked()); - return this; - } - - @Override - @JsonSetter("locked") - public _FinalStage locked(PlansLockedReason locked) { - this.locked = locked; - return this; - } - - @Override - public _FinalStage referral(ReferralInfo referral) { - this.referral = Optional.of(referral); - return this; - } - - @Override - @JsonSetter(value = "referral", nulls = Nulls.SKIP) - public _FinalStage referral(Optional referral) { - this.referral = referral; - return this; - } - - /** - *

The link to the management portal.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage portalLink(String portalLink) { - this.portalLink = Optional.of(portalLink); - return this; - } - - @Override - @JsonSetter(value = "portalLink", nulls = Nulls.SKIP) - public _FinalStage portalLink(Optional portalLink) { - this.portalLink = portalLink; - return this; - } - - /** - *

The plan owner.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage planOwner(String planOwner) { - this.planOwner = Optional.of(planOwner); - return this; - } - - @Override - @JsonSetter(value = "planOwner", nulls = Nulls.SKIP) - public _FinalStage planOwner(Optional planOwner) { - this.planOwner = planOwner; - return this; - } - - /** - *

The current plan id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage currentPlanId(String currentPlanId) { - this.currentPlanId = Optional.of(currentPlanId); - return this; - } - - @Override - @JsonSetter(value = "currentPlanId", nulls = Nulls.SKIP) - public _FinalStage currentPlanId(Optional currentPlanId) { - this.currentPlanId = currentPlanId; - return this; - } - - /** - *

The available plans.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPlans(List plans) { - this.plans.addAll(plans); - return this; - } - - /** - *

The available plans.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPlans(PlanDto plans) { - this.plans.add(plans); - return this; - } - - @Override - @JsonSetter(value = "plans", nulls = Nulls.SKIP) - public _FinalStage plans(List plans) { - this.plans.clear(); - this.plans.addAll(plans); - return this; - } - - @Override - public PlansDto build() { - return new PlansDto(plans, currentPlanId, planOwner, portalLink, referral, locked); - } - } -} diff --git a/src/main/java/com/squidex/api/types/PlansLockedReason.java b/src/main/java/com/squidex/api/types/PlansLockedReason.java deleted file mode 100644 index 2156ecf..0000000 --- a/src/main/java/com/squidex/api/types/PlansLockedReason.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum PlansLockedReason { - NONE("None"), - - NOT_OWNER("NotOwner"), - - NO_PERMISSION("NoPermission"), - - MANAGED_BY_TEAM("ManagedByTeam"); - - private final String value; - - PlansLockedReason(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java b/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java deleted file mode 100644 index cb18e3b..0000000 --- a/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PrerenderRuleActionDto.Builder.class) -public final class PrerenderRuleActionDto { - private final String token; - - private final String url; - - private PrerenderRuleActionDto(String token, String url) { - this.token = token; - this.url = url; - } - - /** - * @return The prerender token from your account. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("token") - public String getToken() { - return token; - } - - /** - * @return The url to recache. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PrerenderRuleActionDto && equalTo((PrerenderRuleActionDto) other); - } - - private boolean equalTo(PrerenderRuleActionDto other) { - return token.equals(other.token) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.token, this.url); - } - - @Override - public String toString() { - return "PrerenderRuleActionDto{" + "token: " + token + ", url: " + url + "}"; - } - - public static TokenStage builder() { - return new Builder(); - } - - public interface TokenStage { - UrlStage token(String token); - - Builder from(PrerenderRuleActionDto other); - } - - public interface UrlStage { - _FinalStage url(String url); - } - - public interface _FinalStage { - PrerenderRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TokenStage, UrlStage, _FinalStage { - private String token; - - private String url; - - private Builder() {} - - @Override - public Builder from(PrerenderRuleActionDto other) { - token(other.getToken()); - url(other.getUrl()); - return this; - } - - /** - *

The prerender token from your account. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("token") - public UrlStage token(String token) { - this.token = token; - return this; - } - - /** - *

The url to recache. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; - } - - @Override - public PrerenderRuleActionDto build() { - return new PrerenderRuleActionDto(token, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/QueryDto.java b/src/main/java/com/squidex/api/types/QueryDto.java deleted file mode 100644 index 9b4a66d..0000000 --- a/src/main/java/com/squidex/api/types/QueryDto.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = QueryDto.Builder.class) -public final class QueryDto { - private final Optional> ids; - - private final Optional oData; - - private final Optional q; - - private final Optional parentId; - - private QueryDto( - Optional> ids, Optional oData, Optional q, Optional parentId) { - this.ids = ids; - this.oData = oData; - this.q = q; - this.parentId = parentId; - } - - /** - * @return The optional list of ids to query. - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return The optional odata query. - */ - @JsonProperty("oData") - public Optional getOData() { - return oData; - } - - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return The parent id (for assets). - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof QueryDto && equalTo((QueryDto) other); - } - - private boolean equalTo(QueryDto other) { - return ids.equals(other.ids) - && oData.equals(other.oData) - && q.equals(other.q) - && parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.ids, this.oData, this.q, this.parentId); - } - - @Override - public String toString() { - return "QueryDto{" + "ids: " + ids + ", oData: " + oData + ", q: " + q + ", parentId: " + parentId + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> ids = Optional.empty(); - - private Optional oData = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional parentId = Optional.empty(); - - private Builder() {} - - public Builder from(QueryDto other) { - ids(other.getIds()); - oData(other.getOData()); - q(other.getQ()); - parentId(other.getParentId()); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; - return this; - } - - public Builder ids(List ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "oData", nulls = Nulls.SKIP) - public Builder oData(Optional oData) { - this.oData = oData; - return this; - } - - public Builder oData(String oData) { - this.oData = Optional.of(oData); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(Object q) { - this.q = Optional.of(q); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - public QueryDto build() { - return new QueryDto(ids, oData, q, parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/types/QueryJsonDto.java b/src/main/java/com/squidex/api/types/QueryJsonDto.java deleted file mode 100644 index 6b69d06..0000000 --- a/src/main/java/com/squidex/api/types/QueryJsonDto.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = QueryJsonDto.Builder.class) -public final class QueryJsonDto { - private final Optional filter; - - private final Optional fullText; - - private final int skip; - - private final int take; - - private final int random; - - private final int top; - - private final Optional> sort; - - private QueryJsonDto( - Optional filter, - Optional fullText, - int skip, - int take, - int random, - int top, - Optional> sort) { - this.filter = filter; - this.fullText = fullText; - this.skip = skip; - this.take = take; - this.random = random; - this.top = top; - this.sort = sort; - } - - @JsonProperty("filter") - public Optional getFilter() { - return filter; - } - - @JsonProperty("fullText") - public Optional getFullText() { - return fullText; - } - - @JsonProperty("skip") - public int getSkip() { - return skip; - } - - @JsonProperty("take") - public int getTake() { - return take; - } - - @JsonProperty("random") - public int getRandom() { - return random; - } - - @JsonProperty("top") - public int getTop() { - return top; - } - - @JsonProperty("sort") - public Optional> getSort() { - return sort; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof QueryJsonDto && equalTo((QueryJsonDto) other); - } - - private boolean equalTo(QueryJsonDto other) { - return filter.equals(other.filter) - && fullText.equals(other.fullText) - && skip == other.skip - && take == other.take - && random == other.random - && top == other.top - && sort.equals(other.sort); - } - - @Override - public int hashCode() { - return Objects.hash(this.filter, this.fullText, this.skip, this.take, this.random, this.top, this.sort); - } - - @Override - public String toString() { - return "QueryJsonDto{" + "filter: " + filter + ", fullText: " + fullText + ", skip: " + skip + ", take: " + take - + ", random: " + random + ", top: " + top + ", sort: " + sort + "}"; - } - - public static SkipStage builder() { - return new Builder(); - } - - public interface SkipStage { - TakeStage skip(int skip); - - Builder from(QueryJsonDto other); - } - - public interface TakeStage { - RandomStage take(int take); - } - - public interface RandomStage { - TopStage random(int random); - } - - public interface TopStage { - _FinalStage top(int top); - } - - public interface _FinalStage { - QueryJsonDto build(); - - _FinalStage filter(Optional filter); - - _FinalStage filter(Object filter); - - _FinalStage fullText(Optional fullText); - - _FinalStage fullText(String fullText); - - _FinalStage sort(Optional> sort); - - _FinalStage sort(List sort); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SkipStage, TakeStage, RandomStage, TopStage, _FinalStage { - private int skip; - - private int take; - - private int random; - - private int top; - - private Optional> sort = Optional.empty(); - - private Optional fullText = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(QueryJsonDto other) { - filter(other.getFilter()); - fullText(other.getFullText()); - skip(other.getSkip()); - take(other.getTake()); - random(other.getRandom()); - top(other.getTop()); - sort(other.getSort()); - return this; - } - - @Override - @JsonSetter("skip") - public TakeStage skip(int skip) { - this.skip = skip; - return this; - } - - @Override - @JsonSetter("take") - public RandomStage take(int take) { - this.take = take; - return this; - } - - @Override - @JsonSetter("random") - public TopStage random(int random) { - this.random = random; - return this; - } - - @Override - @JsonSetter("top") - public _FinalStage top(int top) { - this.top = top; - return this; - } - - @Override - public _FinalStage sort(List sort) { - this.sort = Optional.of(sort); - return this; - } - - @Override - @JsonSetter(value = "sort", nulls = Nulls.SKIP) - public _FinalStage sort(Optional> sort) { - this.sort = sort; - return this; - } - - @Override - public _FinalStage fullText(String fullText) { - this.fullText = Optional.of(fullText); - return this; - } - - @Override - @JsonSetter(value = "fullText", nulls = Nulls.SKIP) - public _FinalStage fullText(Optional fullText) { - this.fullText = fullText; - return this; - } - - @Override - public _FinalStage filter(Object filter) { - this.filter = Optional.of(filter); - return this; - } - - @Override - @JsonSetter(value = "filter", nulls = Nulls.SKIP) - public _FinalStage filter(Optional filter) { - this.filter = filter; - return this; - } - - @Override - public QueryJsonDto build() { - return new QueryJsonDto(filter, fullText, skip, take, random, top, sort); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java b/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java deleted file mode 100644 index 72c56f9..0000000 --- a/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ReferencesFieldEditor { - LIST("List"), - - DROPDOWN("Dropdown"), - - TAGS("Tags"), - - CHECKBOXES("Checkboxes"), - - INPUT("Input"); - - private final String value; - - ReferencesFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java deleted file mode 100644 index 40d8f7b..0000000 --- a/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReferencesFieldPropertiesDto.Builder.class) -public final class ReferencesFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional allowDuplicates; - - private final Optional resolveReference; - - private final Optional mustBePublished; - - private final Optional editor; - - private final Optional> schemaIds; - - private ReferencesFieldPropertiesDto( - Optional>> defaultValues, - Optional> defaultValue, - Optional minItems, - Optional maxItems, - Optional allowDuplicates, - Optional resolveReference, - Optional mustBePublished, - Optional editor, - Optional> schemaIds) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.minItems = minItems; - this.maxItems = maxItems; - this.allowDuplicates = allowDuplicates; - this.resolveReference = resolveReference; - this.mustBePublished = mustBePublished; - this.editor = editor; - this.schemaIds = schemaIds; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value as a list of content ids. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return True, if duplicate values are allowed. - */ - @JsonProperty("allowDuplicates") - public Optional getAllowDuplicates() { - return allowDuplicates; - } - - /** - * @return True to resolve references in the content list. - */ - @JsonProperty("resolveReference") - public Optional getResolveReference() { - return resolveReference; - } - - /** - * @return True when all references must be published. - */ - @JsonProperty("mustBePublished") - public Optional getMustBePublished() { - return mustBePublished; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - /** - * @return The ID of the referenced schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferencesFieldPropertiesDto && equalTo((ReferencesFieldPropertiesDto) other); - } - - private boolean equalTo(ReferencesFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && allowDuplicates.equals(other.allowDuplicates) - && resolveReference.equals(other.resolveReference) - && mustBePublished.equals(other.mustBePublished) - && editor.equals(other.editor) - && schemaIds.equals(other.schemaIds); - } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.minItems, - this.maxItems, - this.allowDuplicates, - this.resolveReference, - this.mustBePublished, - this.editor, - this.schemaIds); - } - - @Override - public String toString() { - return "ReferencesFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", minItems: " + minItems + ", maxItems: " + maxItems + ", allowDuplicates: " + allowDuplicates - + ", resolveReference: " + resolveReference + ", mustBePublished: " + mustBePublished + ", editor: " - + editor + ", schemaIds: " + schemaIds + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional allowDuplicates = Optional.empty(); - - private Optional resolveReference = Optional.empty(); - - private Optional mustBePublished = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Builder() {} - - public Builder from(ReferencesFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - allowDuplicates(other.getAllowDuplicates()); - resolveReference(other.getResolveReference()); - mustBePublished(other.getMustBePublished()); - editor(other.getEditor()); - schemaIds(other.getSchemaIds()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "allowDuplicates", nulls = Nulls.SKIP) - public Builder allowDuplicates(Optional allowDuplicates) { - this.allowDuplicates = allowDuplicates; - return this; - } - - public Builder allowDuplicates(Boolean allowDuplicates) { - this.allowDuplicates = Optional.of(allowDuplicates); - return this; - } - - @JsonSetter(value = "resolveReference", nulls = Nulls.SKIP) - public Builder resolveReference(Optional resolveReference) { - this.resolveReference = resolveReference; - return this; - } - - public Builder resolveReference(Boolean resolveReference) { - this.resolveReference = Optional.of(resolveReference); - return this; - } - - @JsonSetter(value = "mustBePublished", nulls = Nulls.SKIP) - public Builder mustBePublished(Optional mustBePublished) { - this.mustBePublished = mustBePublished; - return this; - } - - public Builder mustBePublished(Boolean mustBePublished) { - this.mustBePublished = Optional.of(mustBePublished); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(ReferencesFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - public ReferencesFieldPropertiesDto build() { - return new ReferencesFieldPropertiesDto( - defaultValues, - defaultValue, - minItems, - maxItems, - allowDuplicates, - resolveReference, - mustBePublished, - editor, - schemaIds); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ReferralInfo.java b/src/main/java/com/squidex/api/types/ReferralInfo.java deleted file mode 100644 index 80cccbc..0000000 --- a/src/main/java/com/squidex/api/types/ReferralInfo.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReferralInfo.Builder.class) -public final class ReferralInfo { - private final String code; - - private final String earned; - - private final String condition; - - private ReferralInfo(String code, String earned, String condition) { - this.code = code; - this.earned = earned; - this.condition = condition; - } - - @JsonProperty("code") - public String getCode() { - return code; - } - - @JsonProperty("earned") - public String getEarned() { - return earned; - } - - @JsonProperty("condition") - public String getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferralInfo && equalTo((ReferralInfo) other); - } - - private boolean equalTo(ReferralInfo other) { - return code.equals(other.code) && earned.equals(other.earned) && condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.code, this.earned, this.condition); - } - - @Override - public String toString() { - return "ReferralInfo{" + "code: " + code + ", earned: " + earned + ", condition: " + condition + "}"; - } - - public static CodeStage builder() { - return new Builder(); - } - - public interface CodeStage { - EarnedStage code(String code); - - Builder from(ReferralInfo other); - } - - public interface EarnedStage { - ConditionStage earned(String earned); - } - - public interface ConditionStage { - _FinalStage condition(String condition); - } - - public interface _FinalStage { - ReferralInfo build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CodeStage, EarnedStage, ConditionStage, _FinalStage { - private String code; - - private String earned; - - private String condition; - - private Builder() {} - - @Override - public Builder from(ReferralInfo other) { - code(other.getCode()); - earned(other.getEarned()); - condition(other.getCondition()); - return this; - } - - @Override - @JsonSetter("code") - public EarnedStage code(String code) { - this.code = code; - return this; - } - - @Override - @JsonSetter("earned") - public ConditionStage earned(String earned) { - this.earned = earned; - return this; - } - - @Override - @JsonSetter("condition") - public _FinalStage condition(String condition) { - this.condition = condition; - return this; - } - - @Override - public ReferralInfo build() { - return new ReferralInfo(code, earned, condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ReorderFieldsDto.java b/src/main/java/com/squidex/api/types/ReorderFieldsDto.java deleted file mode 100644 index 176fbbb..0000000 --- a/src/main/java/com/squidex/api/types/ReorderFieldsDto.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReorderFieldsDto.Builder.class) -public final class ReorderFieldsDto { - private final List fieldIds; - - private ReorderFieldsDto(List fieldIds) { - this.fieldIds = fieldIds; - } - - /** - * @return The field ids in the target order. - */ - @JsonProperty("fieldIds") - public List getFieldIds() { - return fieldIds; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReorderFieldsDto && equalTo((ReorderFieldsDto) other); - } - - private boolean equalTo(ReorderFieldsDto other) { - return fieldIds.equals(other.fieldIds); - } - - @Override - public int hashCode() { - return Objects.hash(this.fieldIds); - } - - @Override - public String toString() { - return "ReorderFieldsDto{" + "fieldIds: " + fieldIds + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List fieldIds = new ArrayList<>(); - - private Builder() {} - - public Builder from(ReorderFieldsDto other) { - fieldIds(other.getFieldIds()); - return this; - } - - @JsonSetter(value = "fieldIds", nulls = Nulls.SKIP) - public Builder fieldIds(List fieldIds) { - this.fieldIds.clear(); - this.fieldIds.addAll(fieldIds); - return this; - } - - public Builder addFieldIds(Integer fieldIds) { - this.fieldIds.add(fieldIds); - return this; - } - - public Builder addAllFieldIds(List fieldIds) { - this.fieldIds.addAll(fieldIds); - return this; - } - - public ReorderFieldsDto build() { - return new ReorderFieldsDto(fieldIds); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ResizeMode.java b/src/main/java/com/squidex/api/types/ResizeMode.java deleted file mode 100644 index b3b4ab6..0000000 --- a/src/main/java/com/squidex/api/types/ResizeMode.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum ResizeMode { - CROP("Crop"), - - CROP_UPSIZE("CropUpsize"), - - PAD("Pad"), - - BOX_PAD("BoxPad"), - - MAX("Max"), - - MIN("Min"), - - STRETCH("Stretch"); - - private final String value; - - ResizeMode(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/Resource.java b/src/main/java/com/squidex/api/types/Resource.java deleted file mode 100644 index cb5b0f8..0000000 --- a/src/main/java/com/squidex/api/types/Resource.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = Resource.Builder.class) -public final class Resource implements IResource { - private final Map links; - - private Resource(Map links) { - this.links = links; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Resource && equalTo((Resource) other); - } - - private boolean equalTo(Resource other) { - return links.equals(other.links); - } - - @Override - public int hashCode() { - return Objects.hash(this.links); - } - - @Override - public String toString() { - return "Resource{" + "links: " + links + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(Resource other) { - links(other.getLinks()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - public Resource build() { - return new Resource(links); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ResourceLink.java b/src/main/java/com/squidex/api/types/ResourceLink.java deleted file mode 100644 index 8a67d31..0000000 --- a/src/main/java/com/squidex/api/types/ResourceLink.java +++ /dev/null @@ -1,155 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ResourceLink.Builder.class) -public final class ResourceLink { - private final String href; - - private final String method; - - private final Optional metadata; - - private ResourceLink(String href, String method, Optional metadata) { - this.href = href; - this.method = method; - this.metadata = metadata; - } - - /** - * @return The link url. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("href") - public String getHref() { - return href; - } - - /** - * @return The link method. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("method") - public String getMethod() { - return method; - } - - /** - * @return Additional data about the link. - */ - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ResourceLink && equalTo((ResourceLink) other); - } - - private boolean equalTo(ResourceLink other) { - return href.equals(other.href) && method.equals(other.method) && metadata.equals(other.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(this.href, this.method, this.metadata); - } - - @Override - public String toString() { - return "ResourceLink{" + "href: " + href + ", method: " + method + ", metadata: " + metadata + "}"; - } - - public static HrefStage builder() { - return new Builder(); - } - - public interface HrefStage { - MethodStage href(String href); - - Builder from(ResourceLink other); - } - - public interface MethodStage { - _FinalStage method(String method); - } - - public interface _FinalStage { - ResourceLink build(); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(String metadata); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HrefStage, MethodStage, _FinalStage { - private String href; - - private String method; - - private Optional metadata = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ResourceLink other) { - href(other.getHref()); - method(other.getMethod()); - metadata(other.getMetadata()); - return this; - } - - /** - *

The link url. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("href") - public MethodStage href(String href) { - this.href = href; - return this; - } - - /** - *

The link method. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("method") - public _FinalStage method(String method) { - this.method = method; - return this; - } - - /** - *

Additional data about the link.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage metadata(String metadata) { - this.metadata = Optional.of(metadata); - return this; - } - - @Override - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @Override - public ResourceLink build() { - return new ResourceLink(href, method, metadata); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ResourcesDto.java b/src/main/java/com/squidex/api/types/ResourcesDto.java deleted file mode 100644 index 8310e39..0000000 --- a/src/main/java/com/squidex/api/types/ResourcesDto.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ResourcesDto.Builder.class) -public final class ResourcesDto implements IResource { - private final Map links; - - private ResourcesDto(Map links) { - this.links = links; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ResourcesDto && equalTo((ResourcesDto) other); - } - - private boolean equalTo(ResourcesDto other) { - return links.equals(other.links); - } - - @Override - public int hashCode() { - return Objects.hash(this.links); - } - - @Override - public String toString() { - return "ResourcesDto{" + "links: " + links + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ResourcesDto other) { - links(other.getLinks()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - public ResourcesDto build() { - return new ResourcesDto(links); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RestoreJobDto.java b/src/main/java/com/squidex/api/types/RestoreJobDto.java deleted file mode 100644 index d6bc38c..0000000 --- a/src/main/java/com/squidex/api/types/RestoreJobDto.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RestoreJobDto.Builder.class) -public final class RestoreJobDto { - private final String url; - - private final List log; - - private final OffsetDateTime started; - - private final Optional stopped; - - private final JobStatus status; - - private RestoreJobDto( - String url, List log, OffsetDateTime started, Optional stopped, JobStatus status) { - this.url = url; - this.log = log; - this.started = started; - this.stopped = stopped; - this.status = status; - } - - /** - * @return The uri to load from. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - /** - * @return The status log. - */ - @JsonProperty("log") - public List getLog() { - return log; - } - - /** - * @return The time when the job has been started. - */ - @JsonProperty("started") - public OffsetDateTime getStarted() { - return started; - } - - /** - * @return The time when the job has been stopped. - */ - @JsonProperty("stopped") - public Optional getStopped() { - return stopped; - } - - @JsonProperty("status") - public JobStatus getStatus() { - return status; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RestoreJobDto && equalTo((RestoreJobDto) other); - } - - private boolean equalTo(RestoreJobDto other) { - return url.equals(other.url) - && log.equals(other.log) - && started.equals(other.started) - && stopped.equals(other.stopped) - && status.equals(other.status); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.log, this.started, this.stopped, this.status); - } - - @Override - public String toString() { - return "RestoreJobDto{" + "url: " + url + ", log: " + log + ", started: " + started + ", stopped: " + stopped - + ", status: " + status + "}"; - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - StartedStage url(String url); - - Builder from(RestoreJobDto other); - } - - public interface StartedStage { - StatusStage started(OffsetDateTime started); - } - - public interface StatusStage { - _FinalStage status(JobStatus status); - } - - public interface _FinalStage { - RestoreJobDto build(); - - _FinalStage log(List log); - - _FinalStage addLog(String log); - - _FinalStage addAllLog(List log); - - _FinalStage stopped(Optional stopped); - - _FinalStage stopped(OffsetDateTime stopped); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, StartedStage, StatusStage, _FinalStage { - private String url; - - private OffsetDateTime started; - - private JobStatus status; - - private Optional stopped = Optional.empty(); - - private List log = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(RestoreJobDto other) { - url(other.getUrl()); - log(other.getLog()); - started(other.getStarted()); - stopped(other.getStopped()); - status(other.getStatus()); - return this; - } - - /** - *

The uri to load from.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public StartedStage url(String url) { - this.url = url; - return this; - } - - /** - *

The time when the job has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("started") - public StatusStage started(OffsetDateTime started) { - this.started = started; - return this; - } - - @Override - @JsonSetter("status") - public _FinalStage status(JobStatus status) { - this.status = status; - return this; - } - - /** - *

The time when the job has been stopped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage stopped(OffsetDateTime stopped) { - this.stopped = Optional.of(stopped); - return this; - } - - @Override - @JsonSetter(value = "stopped", nulls = Nulls.SKIP) - public _FinalStage stopped(Optional stopped) { - this.stopped = stopped; - return this; - } - - /** - *

The status log.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllLog(List log) { - this.log.addAll(log); - return this; - } - - /** - *

The status log.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addLog(String log) { - this.log.add(log); - return this; - } - - @Override - @JsonSetter(value = "log", nulls = Nulls.SKIP) - public _FinalStage log(List log) { - this.log.clear(); - this.log.addAll(log); - return this; - } - - @Override - public RestoreJobDto build() { - return new RestoreJobDto(url, log, started, stopped, status); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RoleDto.java b/src/main/java/com/squidex/api/types/RoleDto.java deleted file mode 100644 index 6fdd968..0000000 --- a/src/main/java/com/squidex/api/types/RoleDto.java +++ /dev/null @@ -1,349 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RoleDto.Builder.class) -public final class RoleDto implements IResource { - private final Map links; - - private final String name; - - private final int numClients; - - private final int numContributors; - - private final boolean isDefaultRole; - - private final List permissions; - - private final Map properties; - - private RoleDto( - Map links, - String name, - int numClients, - int numContributors, - boolean isDefaultRole, - List permissions, - Map properties) { - this.links = links; - this.name = name; - this.numClients = numClients; - this.numContributors = numContributors; - this.isDefaultRole = isDefaultRole; - this.permissions = permissions; - this.properties = properties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The role name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The number of clients with this role. - */ - @JsonProperty("numClients") - public int getNumClients() { - return numClients; - } - - /** - * @return The number of contributors with this role. - */ - @JsonProperty("numContributors") - public int getNumContributors() { - return numContributors; - } - - /** - * @return Indicates if the role is an builtin default role. - */ - @JsonProperty("isDefaultRole") - public boolean getIsDefaultRole() { - return isDefaultRole; - } - - /** - * @return Associated list of permissions. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Associated list of UI properties. - */ - @JsonProperty("properties") - public Map getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RoleDto && equalTo((RoleDto) other); - } - - private boolean equalTo(RoleDto other) { - return links.equals(other.links) - && name.equals(other.name) - && numClients == other.numClients - && numContributors == other.numContributors - && isDefaultRole == other.isDefaultRole - && permissions.equals(other.permissions) - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.name, - this.numClients, - this.numContributors, - this.isDefaultRole, - this.permissions, - this.properties); - } - - @Override - public String toString() { - return "RoleDto{" + "links: " + links + ", name: " + name + ", numClients: " + numClients - + ", numContributors: " + numContributors + ", isDefaultRole: " + isDefaultRole + ", permissions: " - + permissions + ", properties: " + properties + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - NumClientsStage name(String name); - - Builder from(RoleDto other); - } - - public interface NumClientsStage { - NumContributorsStage numClients(int numClients); - } - - public interface NumContributorsStage { - IsDefaultRoleStage numContributors(int numContributors); - } - - public interface IsDefaultRoleStage { - _FinalStage isDefaultRole(boolean isDefaultRole); - } - - public interface _FinalStage { - RoleDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - - _FinalStage properties(Map properties); - - _FinalStage putAllProperties(Map properties); - - _FinalStage properties(String key, Object value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements NameStage, NumClientsStage, NumContributorsStage, IsDefaultRoleStage, _FinalStage { - private String name; - - private int numClients; - - private int numContributors; - - private boolean isDefaultRole; - - private Map properties = new LinkedHashMap<>(); - - private List permissions = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RoleDto other) { - links(other.getLinks()); - name(other.getName()); - numClients(other.getNumClients()); - numContributors(other.getNumContributors()); - isDefaultRole(other.getIsDefaultRole()); - permissions(other.getPermissions()); - properties(other.getProperties()); - return this; - } - - /** - *

The role name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public NumClientsStage name(String name) { - this.name = name; - return this; - } - - /** - *

The number of clients with this role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numClients") - public NumContributorsStage numClients(int numClients) { - this.numClients = numClients; - return this; - } - - /** - *

The number of contributors with this role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numContributors") - public IsDefaultRoleStage numContributors(int numContributors) { - this.numContributors = numContributors; - return this; - } - - /** - *

Indicates if the role is an builtin default role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDefaultRole") - public _FinalStage isDefaultRole(boolean isDefaultRole) { - this.isDefaultRole = isDefaultRole; - return this; - } - - /** - *

Associated list of UI properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage properties(String key, Object value) { - this.properties.put(key, value); - return this; - } - - /** - *

Associated list of UI properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllProperties(Map properties) { - this.properties.putAll(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(Map properties) { - this.properties.clear(); - this.properties.putAll(properties); - return this; - } - - /** - *

Associated list of permissions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Associated list of permissions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RoleDto build() { - return new RoleDto(links, name, numClients, numContributors, isDefaultRole, permissions, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RolesDto.java b/src/main/java/com/squidex/api/types/RolesDto.java deleted file mode 100644 index 458e527..0000000 --- a/src/main/java/com/squidex/api/types/RolesDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RolesDto.Builder.class) -public final class RolesDto implements IResource { - private final Map links; - - private final List items; - - private RolesDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The roles. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RolesDto && equalTo((RolesDto) other); - } - - private boolean equalTo(RolesDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "RolesDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(RolesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(RoleDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public RolesDto build() { - return new RolesDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleActionDto.java b/src/main/java/com/squidex/api/types/RuleActionDto.java deleted file mode 100644 index c37467a..0000000 --- a/src/main/java/com/squidex/api/types/RuleActionDto.java +++ /dev/null @@ -1,1100 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Objects; -import java.util.Optional; - -public final class RuleActionDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private RuleActionDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static RuleActionDto algolia(AlgoliaRuleActionDto value) { - return new RuleActionDto(new AlgoliaValue(value)); - } - - public static RuleActionDto azureQueue(AzureQueueRuleActionDto value) { - return new RuleActionDto(new AzureQueueValue(value)); - } - - public static RuleActionDto comment(CommentRuleActionDto value) { - return new RuleActionDto(new CommentValue(value)); - } - - public static RuleActionDto createContent(CreateContentRuleActionDto value) { - return new RuleActionDto(new CreateContentValue(value)); - } - - public static RuleActionDto discourse(DiscourseRuleActionDto value) { - return new RuleActionDto(new DiscourseValue(value)); - } - - public static RuleActionDto elasticSearch(ElasticSearchRuleActionDto value) { - return new RuleActionDto(new ElasticSearchValue(value)); - } - - public static RuleActionDto email(EmailRuleActionDto value) { - return new RuleActionDto(new EmailValue(value)); - } - - public static RuleActionDto fastly(FastlyRuleActionDto value) { - return new RuleActionDto(new FastlyValue(value)); - } - - public static RuleActionDto medium(MediumRuleActionDto value) { - return new RuleActionDto(new MediumValue(value)); - } - - public static RuleActionDto notification(NotificationRuleActionDto value) { - return new RuleActionDto(new NotificationValue(value)); - } - - public static RuleActionDto openSearch(OpenSearchRuleActionDto value) { - return new RuleActionDto(new OpenSearchValue(value)); - } - - public static RuleActionDto prerender(PrerenderRuleActionDto value) { - return new RuleActionDto(new PrerenderValue(value)); - } - - public static RuleActionDto script(ScriptRuleActionDto value) { - return new RuleActionDto(new ScriptValue(value)); - } - - public static RuleActionDto signalR(SignalRRuleActionDto value) { - return new RuleActionDto(new SignalRValue(value)); - } - - public static RuleActionDto slack(SlackRuleActionDto value) { - return new RuleActionDto(new SlackValue(value)); - } - - public static RuleActionDto tweet(TweetRuleActionDto value) { - return new RuleActionDto(new TweetValue(value)); - } - - public static RuleActionDto typesense(TypesenseRuleActionDto value) { - return new RuleActionDto(new TypesenseValue(value)); - } - - public static RuleActionDto webhook(WebhookRuleActionDto value) { - return new RuleActionDto(new WebhookValue(value)); - } - - public boolean isAlgolia() { - return value instanceof AlgoliaValue; - } - - public boolean isAzureQueue() { - return value instanceof AzureQueueValue; - } - - public boolean isComment() { - return value instanceof CommentValue; - } - - public boolean isCreateContent() { - return value instanceof CreateContentValue; - } - - public boolean isDiscourse() { - return value instanceof DiscourseValue; - } - - public boolean isElasticSearch() { - return value instanceof ElasticSearchValue; - } - - public boolean isEmail() { - return value instanceof EmailValue; - } - - public boolean isFastly() { - return value instanceof FastlyValue; - } - - public boolean isMedium() { - return value instanceof MediumValue; - } - - public boolean isNotification() { - return value instanceof NotificationValue; - } - - public boolean isOpenSearch() { - return value instanceof OpenSearchValue; - } - - public boolean isPrerender() { - return value instanceof PrerenderValue; - } - - public boolean isScript() { - return value instanceof ScriptValue; - } - - public boolean isSignalR() { - return value instanceof SignalRValue; - } - - public boolean isSlack() { - return value instanceof SlackValue; - } - - public boolean isTweet() { - return value instanceof TweetValue; - } - - public boolean isTypesense() { - return value instanceof TypesenseValue; - } - - public boolean isWebhook() { - return value instanceof WebhookValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getAlgolia() { - if (isAlgolia()) { - return Optional.of(((AlgoliaValue) value).value); - } - return Optional.empty(); - } - - public Optional getAzureQueue() { - if (isAzureQueue()) { - return Optional.of(((AzureQueueValue) value).value); - } - return Optional.empty(); - } - - public Optional getComment() { - if (isComment()) { - return Optional.of(((CommentValue) value).value); - } - return Optional.empty(); - } - - public Optional getCreateContent() { - if (isCreateContent()) { - return Optional.of(((CreateContentValue) value).value); - } - return Optional.empty(); - } - - public Optional getDiscourse() { - if (isDiscourse()) { - return Optional.of(((DiscourseValue) value).value); - } - return Optional.empty(); - } - - public Optional getElasticSearch() { - if (isElasticSearch()) { - return Optional.of(((ElasticSearchValue) value).value); - } - return Optional.empty(); - } - - public Optional getEmail() { - if (isEmail()) { - return Optional.of(((EmailValue) value).value); - } - return Optional.empty(); - } - - public Optional getFastly() { - if (isFastly()) { - return Optional.of(((FastlyValue) value).value); - } - return Optional.empty(); - } - - public Optional getMedium() { - if (isMedium()) { - return Optional.of(((MediumValue) value).value); - } - return Optional.empty(); - } - - public Optional getNotification() { - if (isNotification()) { - return Optional.of(((NotificationValue) value).value); - } - return Optional.empty(); - } - - public Optional getOpenSearch() { - if (isOpenSearch()) { - return Optional.of(((OpenSearchValue) value).value); - } - return Optional.empty(); - } - - public Optional getPrerender() { - if (isPrerender()) { - return Optional.of(((PrerenderValue) value).value); - } - return Optional.empty(); - } - - public Optional getScript() { - if (isScript()) { - return Optional.of(((ScriptValue) value).value); - } - return Optional.empty(); - } - - public Optional getSignalR() { - if (isSignalR()) { - return Optional.of(((SignalRValue) value).value); - } - return Optional.empty(); - } - - public Optional getSlack() { - if (isSlack()) { - return Optional.of(((SlackValue) value).value); - } - return Optional.empty(); - } - - public Optional getTweet() { - if (isTweet()) { - return Optional.of(((TweetValue) value).value); - } - return Optional.empty(); - } - - public Optional getTypesense() { - if (isTypesense()) { - return Optional.of(((TypesenseValue) value).value); - } - return Optional.empty(); - } - - public Optional getWebhook() { - if (isWebhook()) { - return Optional.of(((WebhookValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitAlgolia(AlgoliaRuleActionDto algolia); - - T visitAzureQueue(AzureQueueRuleActionDto azureQueue); - - T visitComment(CommentRuleActionDto comment); - - T visitCreateContent(CreateContentRuleActionDto createContent); - - T visitDiscourse(DiscourseRuleActionDto discourse); - - T visitElasticSearch(ElasticSearchRuleActionDto elasticSearch); - - T visitEmail(EmailRuleActionDto email); - - T visitFastly(FastlyRuleActionDto fastly); - - T visitMedium(MediumRuleActionDto medium); - - T visitNotification(NotificationRuleActionDto notification); - - T visitOpenSearch(OpenSearchRuleActionDto openSearch); - - T visitPrerender(PrerenderRuleActionDto prerender); - - T visitScript(ScriptRuleActionDto script); - - T visitSignalR(SignalRRuleActionDto signalR); - - T visitSlack(SlackRuleActionDto slack); - - T visitTweet(TweetRuleActionDto tweet); - - T visitTypesense(TypesenseRuleActionDto typesense); - - T visitWebhook(WebhookRuleActionDto webhook); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "actionType", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(AlgoliaValue.class), - @JsonSubTypes.Type(AzureQueueValue.class), - @JsonSubTypes.Type(CommentValue.class), - @JsonSubTypes.Type(CreateContentValue.class), - @JsonSubTypes.Type(DiscourseValue.class), - @JsonSubTypes.Type(ElasticSearchValue.class), - @JsonSubTypes.Type(EmailValue.class), - @JsonSubTypes.Type(FastlyValue.class), - @JsonSubTypes.Type(MediumValue.class), - @JsonSubTypes.Type(NotificationValue.class), - @JsonSubTypes.Type(OpenSearchValue.class), - @JsonSubTypes.Type(PrerenderValue.class), - @JsonSubTypes.Type(ScriptValue.class), - @JsonSubTypes.Type(SignalRValue.class), - @JsonSubTypes.Type(SlackValue.class), - @JsonSubTypes.Type(TweetValue.class), - @JsonSubTypes.Type(TypesenseValue.class), - @JsonSubTypes.Type(WebhookValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("Algolia") - private static final class AlgoliaValue implements Value { - @JsonUnwrapped - private AlgoliaRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AlgoliaValue() {} - - private AlgoliaValue(AlgoliaRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAlgolia(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AlgoliaValue && equalTo((AlgoliaValue) other); - } - - private boolean equalTo(AlgoliaValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("AzureQueue") - private static final class AzureQueueValue implements Value { - @JsonUnwrapped - private AzureQueueRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AzureQueueValue() {} - - private AzureQueueValue(AzureQueueRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAzureQueue(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AzureQueueValue && equalTo((AzureQueueValue) other); - } - - private boolean equalTo(AzureQueueValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Comment") - private static final class CommentValue implements Value { - @JsonUnwrapped - private CommentRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CommentValue() {} - - private CommentValue(CommentRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComment(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentValue && equalTo((CommentValue) other); - } - - private boolean equalTo(CommentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CreateContent") - private static final class CreateContentValue implements Value { - @JsonUnwrapped - private CreateContentRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CreateContentValue() {} - - private CreateContentValue(CreateContentRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitCreateContent(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateContentValue && equalTo((CreateContentValue) other); - } - - private boolean equalTo(CreateContentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Discourse") - private static final class DiscourseValue implements Value { - @JsonUnwrapped - private DiscourseRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DiscourseValue() {} - - private DiscourseValue(DiscourseRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitDiscourse(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DiscourseValue && equalTo((DiscourseValue) other); - } - - private boolean equalTo(DiscourseValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("ElasticSearch") - private static final class ElasticSearchValue implements Value { - @JsonUnwrapped - private ElasticSearchRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ElasticSearchValue() {} - - private ElasticSearchValue(ElasticSearchRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitElasticSearch(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElasticSearchValue && equalTo((ElasticSearchValue) other); - } - - private boolean equalTo(ElasticSearchValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Email") - private static final class EmailValue implements Value { - @JsonUnwrapped - private EmailRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private EmailValue() {} - - private EmailValue(EmailRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitEmail(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EmailValue && equalTo((EmailValue) other); - } - - private boolean equalTo(EmailValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Fastly") - private static final class FastlyValue implements Value { - @JsonUnwrapped - private FastlyRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private FastlyValue() {} - - private FastlyValue(FastlyRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitFastly(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FastlyValue && equalTo((FastlyValue) other); - } - - private boolean equalTo(FastlyValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Medium") - private static final class MediumValue implements Value { - @JsonUnwrapped - private MediumRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private MediumValue() {} - - private MediumValue(MediumRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitMedium(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MediumValue && equalTo((MediumValue) other); - } - - private boolean equalTo(MediumValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Notification") - private static final class NotificationValue implements Value { - @JsonUnwrapped - private NotificationRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private NotificationValue() {} - - private NotificationValue(NotificationRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitNotification(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationValue && equalTo((NotificationValue) other); - } - - private boolean equalTo(NotificationValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("OpenSearch") - private static final class OpenSearchValue implements Value { - @JsonUnwrapped - private OpenSearchRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private OpenSearchValue() {} - - private OpenSearchValue(OpenSearchRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitOpenSearch(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenSearchValue && equalTo((OpenSearchValue) other); - } - - private boolean equalTo(OpenSearchValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Prerender") - private static final class PrerenderValue implements Value { - @JsonUnwrapped - private PrerenderRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private PrerenderValue() {} - - private PrerenderValue(PrerenderRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitPrerender(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PrerenderValue && equalTo((PrerenderValue) other); - } - - private boolean equalTo(PrerenderValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Script") - private static final class ScriptValue implements Value { - @JsonUnwrapped - private ScriptRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ScriptValue() {} - - private ScriptValue(ScriptRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitScript(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScriptValue && equalTo((ScriptValue) other); - } - - private boolean equalTo(ScriptValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("SignalR") - private static final class SignalRValue implements Value { - @JsonUnwrapped - private SignalRRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SignalRValue() {} - - private SignalRValue(SignalRRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSignalR(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SignalRValue && equalTo((SignalRValue) other); - } - - private boolean equalTo(SignalRValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Slack") - private static final class SlackValue implements Value { - @JsonUnwrapped - private SlackRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SlackValue() {} - - private SlackValue(SlackRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSlack(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SlackValue && equalTo((SlackValue) other); - } - - private boolean equalTo(SlackValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Tweet") - private static final class TweetValue implements Value { - @JsonUnwrapped - private TweetRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TweetValue() {} - - private TweetValue(TweetRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTweet(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TweetValue && equalTo((TweetValue) other); - } - - private boolean equalTo(TweetValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Typesense") - private static final class TypesenseValue implements Value { - @JsonUnwrapped - private TypesenseRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TypesenseValue() {} - - private TypesenseValue(TypesenseRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTypesense(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TypesenseValue && equalTo((TypesenseValue) other); - } - - private boolean equalTo(TypesenseValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Webhook") - private static final class WebhookValue implements Value { - @JsonUnwrapped - private WebhookRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private WebhookValue() {} - - private WebhookValue(WebhookRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitWebhook(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WebhookValue && equalTo((WebhookValue) other); - } - - private boolean equalTo(WebhookValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleDto.java b/src/main/java/com/squidex/api/types/RuleDto.java deleted file mode 100644 index 38590ae..0000000 --- a/src/main/java/com/squidex/api/types/RuleDto.java +++ /dev/null @@ -1,560 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleDto.Builder.class) -public final class RuleDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final boolean isEnabled; - - private final Optional name; - - private final RuleTriggerDto trigger; - - private final RuleActionDto action; - - private final int numSucceeded; - - private final int numFailed; - - private final Optional lastExecuted; - - private RuleDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - boolean isEnabled, - Optional name, - RuleTriggerDto trigger, - RuleActionDto action, - int numSucceeded, - int numFailed, - Optional lastExecuted) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.isEnabled = isEnabled; - this.name = name; - this.trigger = trigger; - this.action = action; - this.numSucceeded = numSucceeded; - this.numFailed = numFailed; - this.lastExecuted = lastExecuted; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the rule. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the rule. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the rule. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The date and time when the rule has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the rule has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the rule. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return Determines if the rule is enabled. - */ - @JsonProperty("isEnabled") - public boolean getIsEnabled() { - return isEnabled; - } - - /** - * @return Optional rule name. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("trigger") - public RuleTriggerDto getTrigger() { - return trigger; - } - - @JsonProperty("action") - public RuleActionDto getAction() { - return action; - } - - /** - * @return The number of completed executions. - */ - @JsonProperty("numSucceeded") - public int getNumSucceeded() { - return numSucceeded; - } - - /** - * @return The number of failed executions. - */ - @JsonProperty("numFailed") - public int getNumFailed() { - return numFailed; - } - - /** - * @return The date and time when the rule was executed the last time. - */ - @JsonProperty("lastExecuted") - public Optional getLastExecuted() { - return lastExecuted; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleDto && equalTo((RuleDto) other); - } - - private boolean equalTo(RuleDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && isEnabled == other.isEnabled - && name.equals(other.name) - && trigger.equals(other.trigger) - && action.equals(other.action) - && numSucceeded == other.numSucceeded - && numFailed == other.numFailed - && lastExecuted.equals(other.lastExecuted); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.created, - this.lastModified, - this.version, - this.isEnabled, - this.name, - this.trigger, - this.action, - this.numSucceeded, - this.numFailed, - this.lastExecuted); - } - - @Override - public String toString() { - return "RuleDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " - + lastModifiedBy + ", created: " + created + ", lastModified: " + lastModified + ", version: " + version - + ", isEnabled: " + isEnabled + ", name: " + name + ", trigger: " + trigger + ", action: " + action - + ", numSucceeded: " + numSucceeded + ", numFailed: " + numFailed + ", lastExecuted: " + lastExecuted - + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(RuleDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - CreatedStage lastModifiedBy(String lastModifiedBy); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - IsEnabledStage version(int version); - } - - public interface IsEnabledStage { - TriggerStage isEnabled(boolean isEnabled); - } - - public interface TriggerStage { - ActionStage trigger(RuleTriggerDto trigger); - } - - public interface ActionStage { - NumSucceededStage action(RuleActionDto action); - } - - public interface NumSucceededStage { - NumFailedStage numSucceeded(int numSucceeded); - } - - public interface NumFailedStage { - _FinalStage numFailed(int numFailed); - } - - public interface _FinalStage { - RuleDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage lastExecuted(Optional lastExecuted); - - _FinalStage lastExecuted(OffsetDateTime lastExecuted); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - CreatedStage, - LastModifiedStage, - VersionStage, - IsEnabledStage, - TriggerStage, - ActionStage, - NumSucceededStage, - NumFailedStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private boolean isEnabled; - - private RuleTriggerDto trigger; - - private RuleActionDto action; - - private int numSucceeded; - - private int numFailed; - - private Optional lastExecuted = Optional.empty(); - - private Optional name = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - isEnabled(other.getIsEnabled()); - name(other.getName()); - trigger(other.getTrigger()); - action(other.getAction()); - numSucceeded(other.getNumSucceeded()); - numFailed(other.getNumFailed()); - lastExecuted(other.getLastExecuted()); - return this; - } - - /** - *

The ID of the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public CreatedStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The date and time when the rule has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the rule has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public IsEnabledStage version(int version) { - this.version = version; - return this; - } - - /** - *

Determines if the rule is enabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isEnabled") - public TriggerStage isEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - @Override - @JsonSetter("trigger") - public ActionStage trigger(RuleTriggerDto trigger) { - this.trigger = trigger; - return this; - } - - @Override - @JsonSetter("action") - public NumSucceededStage action(RuleActionDto action) { - this.action = action; - return this; - } - - /** - *

The number of completed executions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numSucceeded") - public NumFailedStage numSucceeded(int numSucceeded) { - this.numSucceeded = numSucceeded; - return this; - } - - /** - *

The number of failed executions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numFailed") - public _FinalStage numFailed(int numFailed) { - this.numFailed = numFailed; - return this; - } - - /** - *

The date and time when the rule was executed the last time.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage lastExecuted(OffsetDateTime lastExecuted) { - this.lastExecuted = Optional.of(lastExecuted); - return this; - } - - @Override - @JsonSetter(value = "lastExecuted", nulls = Nulls.SKIP) - public _FinalStage lastExecuted(Optional lastExecuted) { - this.lastExecuted = lastExecuted; - return this; - } - - /** - *

Optional rule name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RuleDto build() { - return new RuleDto( - links, - id, - createdBy, - lastModifiedBy, - created, - lastModified, - version, - isEnabled, - name, - trigger, - action, - numSucceeded, - numFailed, - lastExecuted); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleElementDto.java b/src/main/java/com/squidex/api/types/RuleElementDto.java deleted file mode 100644 index b6cbe12..0000000 --- a/src/main/java/com/squidex/api/types/RuleElementDto.java +++ /dev/null @@ -1,332 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleElementDto.Builder.class) -public final class RuleElementDto { - private final String description; - - private final String display; - - private final Optional title; - - private final Optional iconColor; - - private final Optional iconImage; - - private final Optional readMore; - - private final List properties; - - private RuleElementDto( - String description, - String display, - Optional title, - Optional iconColor, - Optional iconImage, - Optional readMore, - List properties) { - this.description = description; - this.display = display; - this.title = title; - this.iconColor = iconColor; - this.iconImage = iconImage; - this.readMore = readMore; - this.properties = properties; - } - - /** - * @return Describes the action or trigger type. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return The label for the action or trigger type. - */ - @JsonProperty("display") - public String getDisplay() { - return display; - } - - /** - * @return Optional title. - */ - @JsonProperty("title") - public Optional getTitle() { - return title; - } - - /** - * @return The color for the icon. - */ - @JsonProperty("iconColor") - public Optional getIconColor() { - return iconColor; - } - - /** - * @return The image for the icon. - */ - @JsonProperty("iconImage") - public Optional getIconImage() { - return iconImage; - } - - /** - * @return The optional link to the product that is integrated. - */ - @JsonProperty("readMore") - public Optional getReadMore() { - return readMore; - } - - /** - * @return The properties. - */ - @JsonProperty("properties") - public List getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleElementDto && equalTo((RuleElementDto) other); - } - - private boolean equalTo(RuleElementDto other) { - return description.equals(other.description) - && display.equals(other.display) - && title.equals(other.title) - && iconColor.equals(other.iconColor) - && iconImage.equals(other.iconImage) - && readMore.equals(other.readMore) - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.description, - this.display, - this.title, - this.iconColor, - this.iconImage, - this.readMore, - this.properties); - } - - @Override - public String toString() { - return "RuleElementDto{" + "description: " + description + ", display: " + display + ", title: " + title - + ", iconColor: " + iconColor + ", iconImage: " + iconImage + ", readMore: " + readMore - + ", properties: " + properties + "}"; - } - - public static DescriptionStage builder() { - return new Builder(); - } - - public interface DescriptionStage { - DisplayStage description(String description); - - Builder from(RuleElementDto other); - } - - public interface DisplayStage { - _FinalStage display(String display); - } - - public interface _FinalStage { - RuleElementDto build(); - - _FinalStage title(Optional title); - - _FinalStage title(String title); - - _FinalStage iconColor(Optional iconColor); - - _FinalStage iconColor(String iconColor); - - _FinalStage iconImage(Optional iconImage); - - _FinalStage iconImage(String iconImage); - - _FinalStage readMore(Optional readMore); - - _FinalStage readMore(String readMore); - - _FinalStage properties(List properties); - - _FinalStage addProperties(RuleElementPropertyDto properties); - - _FinalStage addAllProperties(List properties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, DisplayStage, _FinalStage { - private String description; - - private String display; - - private List properties = new ArrayList<>(); - - private Optional readMore = Optional.empty(); - - private Optional iconImage = Optional.empty(); - - private Optional iconColor = Optional.empty(); - - private Optional title = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RuleElementDto other) { - description(other.getDescription()); - display(other.getDisplay()); - title(other.getTitle()); - iconColor(other.getIconColor()); - iconImage(other.getIconImage()); - readMore(other.getReadMore()); - properties(other.getProperties()); - return this; - } - - /** - *

Describes the action or trigger type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public DisplayStage description(String description) { - this.description = description; - return this; - } - - /** - *

The label for the action or trigger type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("display") - public _FinalStage display(String display) { - this.display = display; - return this; - } - - /** - *

The properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllProperties(List properties) { - this.properties.addAll(properties); - return this; - } - - /** - *

The properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addProperties(RuleElementPropertyDto properties) { - this.properties.add(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(List properties) { - this.properties.clear(); - this.properties.addAll(properties); - return this; - } - - /** - *

The optional link to the product that is integrated.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage readMore(String readMore) { - this.readMore = Optional.of(readMore); - return this; - } - - @Override - @JsonSetter(value = "readMore", nulls = Nulls.SKIP) - public _FinalStage readMore(Optional readMore) { - this.readMore = readMore; - return this; - } - - /** - *

The image for the icon.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage iconImage(String iconImage) { - this.iconImage = Optional.of(iconImage); - return this; - } - - @Override - @JsonSetter(value = "iconImage", nulls = Nulls.SKIP) - public _FinalStage iconImage(Optional iconImage) { - this.iconImage = iconImage; - return this; - } - - /** - *

The color for the icon.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage iconColor(String iconColor) { - this.iconColor = Optional.of(iconColor); - return this; - } - - @Override - @JsonSetter(value = "iconColor", nulls = Nulls.SKIP) - public _FinalStage iconColor(Optional iconColor) { - this.iconColor = iconColor; - return this; - } - - /** - *

Optional title.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage title(String title) { - this.title = Optional.of(title); - return this; - } - - @Override - @JsonSetter(value = "title", nulls = Nulls.SKIP) - public _FinalStage title(Optional title) { - this.title = title; - return this; - } - - @Override - public RuleElementDto build() { - return new RuleElementDto(description, display, title, iconColor, iconImage, readMore, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java b/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java deleted file mode 100644 index f73907a..0000000 --- a/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java +++ /dev/null @@ -1,294 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleElementPropertyDto.Builder.class) -public final class RuleElementPropertyDto { - private final RuleFieldEditor editor; - - private final String name; - - private final String display; - - private final Optional> options; - - private final Optional description; - - private final boolean isFormattable; - - private final boolean isRequired; - - private RuleElementPropertyDto( - RuleFieldEditor editor, - String name, - String display, - Optional> options, - Optional description, - boolean isFormattable, - boolean isRequired) { - this.editor = editor; - this.name = name; - this.display = display; - this.options = options; - this.description = description; - this.isFormattable = isFormattable; - this.isRequired = isRequired; - } - - @JsonProperty("editor") - public RuleFieldEditor getEditor() { - return editor; - } - - /** - * @return The name of the editor. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The label to use. - */ - @JsonProperty("display") - public String getDisplay() { - return display; - } - - /** - * @return The options, if the editor is a dropdown. - */ - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - - /** - * @return The optional description. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - /** - * @return Indicates if the property is formattable. - */ - @JsonProperty("isFormattable") - public boolean getIsFormattable() { - return isFormattable; - } - - /** - * @return Indicates if the property is required. - */ - @JsonProperty("isRequired") - public boolean getIsRequired() { - return isRequired; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleElementPropertyDto && equalTo((RuleElementPropertyDto) other); - } - - private boolean equalTo(RuleElementPropertyDto other) { - return editor.equals(other.editor) - && name.equals(other.name) - && display.equals(other.display) - && options.equals(other.options) - && description.equals(other.description) - && isFormattable == other.isFormattable - && isRequired == other.isRequired; - } - - @Override - public int hashCode() { - return Objects.hash( - this.editor, - this.name, - this.display, - this.options, - this.description, - this.isFormattable, - this.isRequired); - } - - @Override - public String toString() { - return "RuleElementPropertyDto{" + "editor: " + editor + ", name: " + name + ", display: " + display - + ", options: " + options + ", description: " + description + ", isFormattable: " + isFormattable - + ", isRequired: " + isRequired + "}"; - } - - public static EditorStage builder() { - return new Builder(); - } - - public interface EditorStage { - NameStage editor(RuleFieldEditor editor); - - Builder from(RuleElementPropertyDto other); - } - - public interface NameStage { - DisplayStage name(String name); - } - - public interface DisplayStage { - IsFormattableStage display(String display); - } - - public interface IsFormattableStage { - IsRequiredStage isFormattable(boolean isFormattable); - } - - public interface IsRequiredStage { - _FinalStage isRequired(boolean isRequired); - } - - public interface _FinalStage { - RuleElementPropertyDto build(); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - - _FinalStage description(Optional description); - - _FinalStage description(String description); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements EditorStage, NameStage, DisplayStage, IsFormattableStage, IsRequiredStage, _FinalStage { - private RuleFieldEditor editor; - - private String name; - - private String display; - - private boolean isFormattable; - - private boolean isRequired; - - private Optional description = Optional.empty(); - - private Optional> options = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RuleElementPropertyDto other) { - editor(other.getEditor()); - name(other.getName()); - display(other.getDisplay()); - options(other.getOptions()); - description(other.getDescription()); - isFormattable(other.getIsFormattable()); - isRequired(other.getIsRequired()); - return this; - } - - @Override - @JsonSetter("editor") - public NameStage editor(RuleFieldEditor editor) { - this.editor = editor; - return this; - } - - /** - *

The name of the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public DisplayStage name(String name) { - this.name = name; - return this; - } - - /** - *

The label to use.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("display") - public IsFormattableStage display(String display) { - this.display = display; - return this; - } - - /** - *

Indicates if the property is formattable.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isFormattable") - public IsRequiredStage isFormattable(boolean isFormattable) { - this.isFormattable = isFormattable; - return this; - } - - /** - *

Indicates if the property is required.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isRequired") - public _FinalStage isRequired(boolean isRequired) { - this.isRequired = isRequired; - return this; - } - - /** - *

The optional description.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage description(String description) { - this.description = Optional.of(description); - return this; - } - - @Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - /** - *

The options, if the editor is a dropdown.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage options(List options) { - this.options = Optional.of(options); - return this; - } - - @Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @Override - public RuleElementPropertyDto build() { - return new RuleElementPropertyDto(editor, name, display, options, description, isFormattable, isRequired); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleEventDto.java b/src/main/java/com/squidex/api/types/RuleEventDto.java deleted file mode 100644 index 28a760a..0000000 --- a/src/main/java/com/squidex/api/types/RuleEventDto.java +++ /dev/null @@ -1,413 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleEventDto.Builder.class) -public final class RuleEventDto implements IResource { - private final Map links; - - private final String id; - - private final OffsetDateTime created; - - private final String description; - - private final String eventName; - - private final Optional lastDump; - - private final int numCalls; - - private final Optional nextAttempt; - - private final RuleResult result; - - private final RuleJobResult jobResult; - - private RuleEventDto( - Map links, - String id, - OffsetDateTime created, - String description, - String eventName, - Optional lastDump, - int numCalls, - Optional nextAttempt, - RuleResult result, - RuleJobResult jobResult) { - this.links = links; - this.id = id; - this.created = created; - this.description = description; - this.eventName = eventName; - this.lastDump = lastDump; - this.numCalls = numCalls; - this.nextAttempt = nextAttempt; - this.result = result; - this.jobResult = jobResult; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the event. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the event has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The description. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return The name of the event. - */ - @JsonProperty("eventName") - public String getEventName() { - return eventName; - } - - /** - * @return The last dump. - */ - @JsonProperty("lastDump") - public Optional getLastDump() { - return lastDump; - } - - /** - * @return The number of calls. - */ - @JsonProperty("numCalls") - public int getNumCalls() { - return numCalls; - } - - /** - * @return The next attempt. - */ - @JsonProperty("nextAttempt") - public Optional getNextAttempt() { - return nextAttempt; - } - - @JsonProperty("result") - public RuleResult getResult() { - return result; - } - - @JsonProperty("jobResult") - public RuleJobResult getJobResult() { - return jobResult; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleEventDto && equalTo((RuleEventDto) other); - } - - private boolean equalTo(RuleEventDto other) { - return links.equals(other.links) - && id.equals(other.id) - && created.equals(other.created) - && description.equals(other.description) - && eventName.equals(other.eventName) - && lastDump.equals(other.lastDump) - && numCalls == other.numCalls - && nextAttempt.equals(other.nextAttempt) - && result.equals(other.result) - && jobResult.equals(other.jobResult); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.created, - this.description, - this.eventName, - this.lastDump, - this.numCalls, - this.nextAttempt, - this.result, - this.jobResult); - } - - @Override - public String toString() { - return "RuleEventDto{" + "links: " + links + ", id: " + id + ", created: " + created + ", description: " - + description + ", eventName: " + eventName + ", lastDump: " + lastDump + ", numCalls: " + numCalls - + ", nextAttempt: " + nextAttempt + ", result: " + result + ", jobResult: " + jobResult + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedStage id(String id); - - Builder from(RuleEventDto other); - } - - public interface CreatedStage { - DescriptionStage created(OffsetDateTime created); - } - - public interface DescriptionStage { - EventNameStage description(String description); - } - - public interface EventNameStage { - NumCallsStage eventName(String eventName); - } - - public interface NumCallsStage { - ResultStage numCalls(int numCalls); - } - - public interface ResultStage { - JobResultStage result(RuleResult result); - } - - public interface JobResultStage { - _FinalStage jobResult(RuleJobResult jobResult); - } - - public interface _FinalStage { - RuleEventDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage lastDump(Optional lastDump); - - _FinalStage lastDump(String lastDump); - - _FinalStage nextAttempt(Optional nextAttempt); - - _FinalStage nextAttempt(OffsetDateTime nextAttempt); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedStage, - DescriptionStage, - EventNameStage, - NumCallsStage, - ResultStage, - JobResultStage, - _FinalStage { - private String id; - - private OffsetDateTime created; - - private String description; - - private String eventName; - - private int numCalls; - - private RuleResult result; - - private RuleJobResult jobResult; - - private Optional nextAttempt = Optional.empty(); - - private Optional lastDump = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleEventDto other) { - links(other.getLinks()); - id(other.getId()); - created(other.getCreated()); - description(other.getDescription()); - eventName(other.getEventName()); - lastDump(other.getLastDump()); - numCalls(other.getNumCalls()); - nextAttempt(other.getNextAttempt()); - result(other.getResult()); - jobResult(other.getJobResult()); - return this; - } - - /** - *

The ID of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedStage id(String id) { - this.id = id; - return this; - } - - /** - *

The time when the event has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public DescriptionStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The description.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public EventNameStage description(String description) { - this.description = description; - return this; - } - - /** - *

The name of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventName") - public NumCallsStage eventName(String eventName) { - this.eventName = eventName; - return this; - } - - /** - *

The number of calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numCalls") - public ResultStage numCalls(int numCalls) { - this.numCalls = numCalls; - return this; - } - - @Override - @JsonSetter("result") - public JobResultStage result(RuleResult result) { - this.result = result; - return this; - } - - @Override - @JsonSetter("jobResult") - public _FinalStage jobResult(RuleJobResult jobResult) { - this.jobResult = jobResult; - return this; - } - - /** - *

The next attempt.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nextAttempt(OffsetDateTime nextAttempt) { - this.nextAttempt = Optional.of(nextAttempt); - return this; - } - - @Override - @JsonSetter(value = "nextAttempt", nulls = Nulls.SKIP) - public _FinalStage nextAttempt(Optional nextAttempt) { - this.nextAttempt = nextAttempt; - return this; - } - - /** - *

The last dump.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage lastDump(String lastDump) { - this.lastDump = Optional.of(lastDump); - return this; - } - - @Override - @JsonSetter(value = "lastDump", nulls = Nulls.SKIP) - public _FinalStage lastDump(Optional lastDump) { - this.lastDump = lastDump; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RuleEventDto build() { - return new RuleEventDto( - links, id, created, description, eventName, lastDump, numCalls, nextAttempt, result, jobResult); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleEventsDto.java b/src/main/java/com/squidex/api/types/RuleEventsDto.java deleted file mode 100644 index 07b4e8e..0000000 --- a/src/main/java/com/squidex/api/types/RuleEventsDto.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleEventsDto.Builder.class) -public final class RuleEventsDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private RuleEventsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of rule events. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The rule events. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleEventsDto && equalTo((RuleEventsDto) other); - } - - private boolean equalTo(RuleEventsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); - } - - @Override - public String toString() { - return "RuleEventsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(RuleEventsDto other); - } - - public interface _FinalStage { - RuleEventsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(RuleEventDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleEventsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; - } - - /** - *

The total number of rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(RuleEventDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RuleEventsDto build() { - return new RuleEventsDto(links, total, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/RuleFieldEditor.java b/src/main/java/com/squidex/api/types/RuleFieldEditor.java deleted file mode 100644 index 3d8a279..0000000 --- a/src/main/java/com/squidex/api/types/RuleFieldEditor.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum RuleFieldEditor { - CHECKBOX("Checkbox"), - - DROPDOWN("Dropdown"), - - EMAIL("Email"), - - JAVASCRIPT("Javascript"), - - NUMBER("Number"), - - PASSWORD("Password"), - - TEXT("Text"), - - TEXT_AREA("TextArea"), - - URL("Url"); - - private final String value; - - RuleFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/RuleJobResult.java b/src/main/java/com/squidex/api/types/RuleJobResult.java deleted file mode 100644 index 8220412..0000000 --- a/src/main/java/com/squidex/api/types/RuleJobResult.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum RuleJobResult { - PENDING("Pending"), - - SUCCESS("Success"), - - RETRY("Retry"), - - FAILED("Failed"), - - CANCELLED("Cancelled"); - - private final String value; - - RuleJobResult(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/RuleResult.java b/src/main/java/com/squidex/api/types/RuleResult.java deleted file mode 100644 index 65b98a4..0000000 --- a/src/main/java/com/squidex/api/types/RuleResult.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum RuleResult { - PENDING("Pending"), - - SUCCESS("Success"), - - FAILED("Failed"), - - TIMEOUT("Timeout"); - - private final String value; - - RuleResult(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/RuleTriggerDto.java b/src/main/java/com/squidex/api/types/RuleTriggerDto.java deleted file mode 100644 index 18e4320..0000000 --- a/src/main/java/com/squidex/api/types/RuleTriggerDto.java +++ /dev/null @@ -1,428 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Objects; -import java.util.Optional; - -public final class RuleTriggerDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private RuleTriggerDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static RuleTriggerDto assetChanged(AssetChangedRuleTriggerDto value) { - return new RuleTriggerDto(new AssetChangedValue(value)); - } - - public static RuleTriggerDto comment(CommentRuleTriggerDto value) { - return new RuleTriggerDto(new CommentValue(value)); - } - - public static RuleTriggerDto contentChanged(ContentChangedRuleTriggerDto value) { - return new RuleTriggerDto(new ContentChangedValue(value)); - } - - public static RuleTriggerDto manual(ManualRuleTriggerDto value) { - return new RuleTriggerDto(new ManualValue(value)); - } - - public static RuleTriggerDto schemaChanged(SchemaChangedRuleTriggerDto value) { - return new RuleTriggerDto(new SchemaChangedValue(value)); - } - - public static RuleTriggerDto usage(UsageRuleTriggerDto value) { - return new RuleTriggerDto(new UsageValue(value)); - } - - public boolean isAssetChanged() { - return value instanceof AssetChangedValue; - } - - public boolean isComment() { - return value instanceof CommentValue; - } - - public boolean isContentChanged() { - return value instanceof ContentChangedValue; - } - - public boolean isManual() { - return value instanceof ManualValue; - } - - public boolean isSchemaChanged() { - return value instanceof SchemaChangedValue; - } - - public boolean isUsage() { - return value instanceof UsageValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getAssetChanged() { - if (isAssetChanged()) { - return Optional.of(((AssetChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getComment() { - if (isComment()) { - return Optional.of(((CommentValue) value).value); - } - return Optional.empty(); - } - - public Optional getContentChanged() { - if (isContentChanged()) { - return Optional.of(((ContentChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getManual() { - if (isManual()) { - return Optional.of(((ManualValue) value).value); - } - return Optional.empty(); - } - - public Optional getSchemaChanged() { - if (isSchemaChanged()) { - return Optional.of(((SchemaChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getUsage() { - if (isUsage()) { - return Optional.of(((UsageValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitAssetChanged(AssetChangedRuleTriggerDto assetChanged); - - T visitComment(CommentRuleTriggerDto comment); - - T visitContentChanged(ContentChangedRuleTriggerDto contentChanged); - - T visitManual(ManualRuleTriggerDto manual); - - T visitSchemaChanged(SchemaChangedRuleTriggerDto schemaChanged); - - T visitUsage(UsageRuleTriggerDto usage); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "triggerType", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(AssetChangedValue.class), - @JsonSubTypes.Type(CommentValue.class), - @JsonSubTypes.Type(ContentChangedValue.class), - @JsonSubTypes.Type(ManualValue.class), - @JsonSubTypes.Type(SchemaChangedValue.class), - @JsonSubTypes.Type(UsageValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("AssetChanged") - private static final class AssetChangedValue implements Value { - @JsonUnwrapped - private AssetChangedRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AssetChangedValue() {} - - private AssetChangedValue(AssetChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAssetChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetChangedValue && equalTo((AssetChangedValue) other); - } - - private boolean equalTo(AssetChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Comment") - private static final class CommentValue implements Value { - @JsonUnwrapped - private CommentRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CommentValue() {} - - private CommentValue(CommentRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComment(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentValue && equalTo((CommentValue) other); - } - - private boolean equalTo(CommentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("ContentChanged") - private static final class ContentChangedValue implements Value { - @JsonUnwrapped - private ContentChangedRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ContentChangedValue() {} - - private ContentChangedValue(ContentChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitContentChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentChangedValue && equalTo((ContentChangedValue) other); - } - - private boolean equalTo(ContentChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Manual") - private static final class ManualValue implements Value { - @JsonUnwrapped - private ManualRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ManualValue() {} - - private ManualValue(ManualRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitManual(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ManualValue && equalTo((ManualValue) other); - } - - private boolean equalTo(ManualValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("SchemaChanged") - private static final class SchemaChangedValue implements Value { - @JsonUnwrapped - private SchemaChangedRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SchemaChangedValue() {} - - private SchemaChangedValue(SchemaChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSchemaChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaChangedValue && equalTo((SchemaChangedValue) other); - } - - private boolean equalTo(SchemaChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Usage") - private static final class UsageValue implements Value { - @JsonUnwrapped - private UsageRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private UsageValue() {} - - private UsageValue(UsageRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitUsage(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageValue && equalTo((UsageValue) other); - } - - private boolean equalTo(UsageValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/squidex/api/types/RulesDto.java b/src/main/java/com/squidex/api/types/RulesDto.java deleted file mode 100644 index 9f8d302..0000000 --- a/src/main/java/com/squidex/api/types/RulesDto.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesDto.Builder.class) -public final class RulesDto implements IResource { - private final Map links; - - private final List items; - - private final Optional runningRuleId; - - private RulesDto(Map links, List items, Optional runningRuleId) { - this.links = links; - this.items = items; - this.runningRuleId = runningRuleId; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The rules. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The ID of the rule that is currently rerunning. - */ - @JsonProperty("runningRuleId") - public Optional getRunningRuleId() { - return runningRuleId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesDto && equalTo((RulesDto) other); - } - - private boolean equalTo(RulesDto other) { - return links.equals(other.links) && items.equals(other.items) && runningRuleId.equals(other.runningRuleId); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.runningRuleId); - } - - @Override - public String toString() { - return "RulesDto{" + "links: " + links + ", items: " + items + ", runningRuleId: " + runningRuleId + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Optional runningRuleId = Optional.empty(); - - private Builder() {} - - public Builder from(RulesDto other) { - links(other.getLinks()); - items(other.getItems()); - runningRuleId(other.getRunningRuleId()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(RuleDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - @JsonSetter(value = "runningRuleId", nulls = Nulls.SKIP) - public Builder runningRuleId(Optional runningRuleId) { - this.runningRuleId = runningRuleId; - return this; - } - - public Builder runningRuleId(String runningRuleId) { - this.runningRuleId = Optional.of(runningRuleId); - return this; - } - - public RulesDto build() { - return new RulesDto(links, items, runningRuleId); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ScheduleJobDto.java b/src/main/java/com/squidex/api/types/ScheduleJobDto.java deleted file mode 100644 index b7b3a5a..0000000 --- a/src/main/java/com/squidex/api/types/ScheduleJobDto.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ScheduleJobDto.Builder.class) -public final class ScheduleJobDto { - private final String id; - - private final String status; - - private final OffsetDateTime dueTime; - - private final String color; - - private final String scheduledBy; - - private ScheduleJobDto(String id, String status, OffsetDateTime dueTime, String color, String scheduledBy) { - this.id = id; - this.status = status; - this.dueTime = dueTime; - this.color = color; - this.scheduledBy = scheduledBy; - } - - /** - * @return The ID of the schedule job. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The new status. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The target date and time when the content should be scheduled. - */ - @JsonProperty("dueTime") - public OffsetDateTime getDueTime() { - return dueTime; - } - - /** - * @return The color of the scheduled status. - */ - @JsonProperty("color") - public String getColor() { - return color; - } - - /** - * @return The user who schedule the content. - */ - @JsonProperty("scheduledBy") - public String getScheduledBy() { - return scheduledBy; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScheduleJobDto && equalTo((ScheduleJobDto) other); - } - - private boolean equalTo(ScheduleJobDto other) { - return id.equals(other.id) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && color.equals(other.color) - && scheduledBy.equals(other.scheduledBy); - } - - @Override - public int hashCode() { - return Objects.hash(this.id, this.status, this.dueTime, this.color, this.scheduledBy); - } - - @Override - public String toString() { - return "ScheduleJobDto{" + "id: " + id + ", status: " + status + ", dueTime: " + dueTime + ", color: " + color - + ", scheduledBy: " + scheduledBy + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - StatusStage id(String id); - - Builder from(ScheduleJobDto other); - } - - public interface StatusStage { - DueTimeStage status(String status); - } - - public interface DueTimeStage { - ColorStage dueTime(OffsetDateTime dueTime); - } - - public interface ColorStage { - ScheduledByStage color(String color); - } - - public interface ScheduledByStage { - _FinalStage scheduledBy(String scheduledBy); - } - - public interface _FinalStage { - ScheduleJobDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, StatusStage, DueTimeStage, ColorStage, ScheduledByStage, _FinalStage { - private String id; - - private String status; - - private OffsetDateTime dueTime; - - private String color; - - private String scheduledBy; - - private Builder() {} - - @Override - public Builder from(ScheduleJobDto other) { - id(other.getId()); - status(other.getStatus()); - dueTime(other.getDueTime()); - color(other.getColor()); - scheduledBy(other.getScheduledBy()); - return this; - } - - /** - *

The ID of the schedule job.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public StatusStage id(String id) { - this.id = id; - return this; - } - - /** - *

The new status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public DueTimeStage status(String status) { - this.status = status; - return this; - } - - /** - *

The target date and time when the content should be scheduled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("dueTime") - public ColorStage dueTime(OffsetDateTime dueTime) { - this.dueTime = dueTime; - return this; - } - - /** - *

The color of the scheduled status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("color") - public ScheduledByStage color(String color) { - this.color = color; - return this; - } - - /** - *

The user who schedule the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("scheduledBy") - public _FinalStage scheduledBy(String scheduledBy) { - this.scheduledBy = scheduledBy; - return this; - } - - @Override - public ScheduleJobDto build() { - return new ScheduleJobDto(id, status, dueTime, color, scheduledBy); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java deleted file mode 100644 index 7637212..0000000 --- a/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaChangedRuleTriggerDto.Builder.class) -public final class SchemaChangedRuleTriggerDto { - private final Optional condition; - - private SchemaChangedRuleTriggerDto(Optional condition) { - this.condition = condition; - } - - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaChangedRuleTriggerDto && equalTo((SchemaChangedRuleTriggerDto) other); - } - - private boolean equalTo(SchemaChangedRuleTriggerDto other) { - return condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.condition); - } - - @Override - public String toString() { - return "SchemaChangedRuleTriggerDto{" + "condition: " + condition + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - - private Builder() {} - - public Builder from(SchemaChangedRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } - - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; - } - - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - public SchemaChangedRuleTriggerDto build() { - return new SchemaChangedRuleTriggerDto(condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaCondition.java b/src/main/java/com/squidex/api/types/SchemaCondition.java deleted file mode 100644 index ed54bde..0000000 --- a/src/main/java/com/squidex/api/types/SchemaCondition.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaCondition.Builder.class) -public final class SchemaCondition { - private final String schemaId; - - private final Optional condition; - - private SchemaCondition(String schemaId, Optional condition) { - this.schemaId = schemaId; - this.condition = condition; - } - - @JsonProperty("schemaId") - public String getSchemaId() { - return schemaId; - } - - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaCondition && equalTo((SchemaCondition) other); - } - - private boolean equalTo(SchemaCondition other) { - return schemaId.equals(other.schemaId) && condition.equals(other.condition); - } - - @Override - public int hashCode() { - return Objects.hash(this.schemaId, this.condition); - } - - @Override - public String toString() { - return "SchemaCondition{" + "schemaId: " + schemaId + ", condition: " + condition + "}"; - } - - public static SchemaIdStage builder() { - return new Builder(); - } - - public interface SchemaIdStage { - _FinalStage schemaId(String schemaId); - - Builder from(SchemaCondition other); - } - - public interface _FinalStage { - SchemaCondition build(); - - _FinalStage condition(Optional condition); - - _FinalStage condition(String condition); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SchemaIdStage, _FinalStage { - private String schemaId; - - private Optional condition = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SchemaCondition other) { - schemaId(other.getSchemaId()); - condition(other.getCondition()); - return this; - } - - @Override - @JsonSetter("schemaId") - public _FinalStage schemaId(String schemaId) { - this.schemaId = schemaId; - return this; - } - - @Override - public _FinalStage condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - @Override - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public _FinalStage condition(Optional condition) { - this.condition = condition; - return this; - } - - @Override - public SchemaCondition build() { - return new SchemaCondition(schemaId, condition); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaDto.java b/src/main/java/com/squidex/api/types/SchemaDto.java deleted file mode 100644 index 0233630..0000000 --- a/src/main/java/com/squidex/api/types/SchemaDto.java +++ /dev/null @@ -1,811 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaDto.Builder.class) -public final class SchemaDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final String name; - - private final SchemaType type; - - private final Optional category; - - private final SchemaPropertiesDto properties; - - private final boolean isSingleton; - - private final boolean isPublished; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final SchemaScriptsDto scripts; - - private final Map previewUrls; - - private final List fieldsInLists; - - private final List fieldsInReferences; - - private final List fieldRules; - - private final List fields; - - private SchemaDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - String name, - SchemaType type, - Optional category, - SchemaPropertiesDto properties, - boolean isSingleton, - boolean isPublished, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - SchemaScriptsDto scripts, - Map previewUrls, - List fieldsInLists, - List fieldsInReferences, - List fieldRules, - List fields) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.name = name; - this.type = type; - this.category = category; - this.properties = properties; - this.isSingleton = isSingleton; - this.isPublished = isPublished; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.scripts = scripts; - this.previewUrls = previewUrls; - this.fieldsInLists = fieldsInLists; - this.fieldsInReferences = fieldsInReferences; - this.fieldRules = fieldRules; - this.fields = fields; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the schema. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The name of the schema. Unique within the app. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("type") - public SchemaType getType() { - return type; - } - - /** - * @return The name of the category. - */ - @JsonProperty("category") - public Optional getCategory() { - return category; - } - - @JsonProperty("properties") - public SchemaPropertiesDto getProperties() { - return properties; - } - - /** - * @return Indicates if the schema is a singleton. - */ - @JsonProperty("isSingleton") - public boolean getIsSingleton() { - return isSingleton; - } - - /** - * @return Indicates if the schema is published. - */ - @JsonProperty("isPublished") - public boolean getIsPublished() { - return isPublished; - } - - /** - * @return The date and time when the schema has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the schema has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the schema. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @JsonProperty("scripts") - public SchemaScriptsDto getScripts() { - return scripts; - } - - /** - * @return The preview Urls. - */ - @JsonProperty("previewUrls") - public Map getPreviewUrls() { - return previewUrls; - } - - /** - * @return The name of fields that are used in content lists. - */ - @JsonProperty("fieldsInLists") - public List getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return The name of fields that are used in content references. - */ - @JsonProperty("fieldsInReferences") - public List getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The field rules. - */ - @JsonProperty("fieldRules") - public List getFieldRules() { - return fieldRules; - } - - /** - * @return The list of fields. - */ - @JsonProperty("fields") - public List getFields() { - return fields; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaDto && equalTo((SchemaDto) other); - } - - private boolean equalTo(SchemaDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && name.equals(other.name) - && type.equals(other.type) - && category.equals(other.category) - && properties.equals(other.properties) - && isSingleton == other.isSingleton - && isPublished == other.isPublished - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && scripts.equals(other.scripts) - && previewUrls.equals(other.previewUrls) - && fieldsInLists.equals(other.fieldsInLists) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldRules.equals(other.fieldRules) - && fields.equals(other.fields); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.name, - this.type, - this.category, - this.properties, - this.isSingleton, - this.isPublished, - this.created, - this.lastModified, - this.version, - this.scripts, - this.previewUrls, - this.fieldsInLists, - this.fieldsInReferences, - this.fieldRules, - this.fields); - } - - @Override - public String toString() { - return "SchemaDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " - + lastModifiedBy + ", name: " + name + ", type: " + type + ", category: " + category + ", properties: " - + properties + ", isSingleton: " + isSingleton + ", isPublished: " + isPublished + ", created: " - + created + ", lastModified: " + lastModified + ", version: " + version + ", scripts: " + scripts - + ", previewUrls: " + previewUrls + ", fieldsInLists: " + fieldsInLists + ", fieldsInReferences: " - + fieldsInReferences + ", fieldRules: " + fieldRules + ", fields: " + fields + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(SchemaDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - NameStage lastModifiedBy(String lastModifiedBy); - } - - public interface NameStage { - TypeStage name(String name); - } - - public interface TypeStage { - PropertiesStage type(SchemaType type); - } - - public interface PropertiesStage { - IsSingletonStage properties(SchemaPropertiesDto properties); - } - - public interface IsSingletonStage { - IsPublishedStage isSingleton(boolean isSingleton); - } - - public interface IsPublishedStage { - CreatedStage isPublished(boolean isPublished); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - ScriptsStage version(int version); - } - - public interface ScriptsStage { - _FinalStage scripts(SchemaScriptsDto scripts); - } - - public interface _FinalStage { - SchemaDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage category(Optional category); - - _FinalStage category(String category); - - _FinalStage previewUrls(Map previewUrls); - - _FinalStage putAllPreviewUrls(Map previewUrls); - - _FinalStage previewUrls(String key, String value); - - _FinalStage fieldsInLists(List fieldsInLists); - - _FinalStage addFieldsInLists(String fieldsInLists); - - _FinalStage addAllFieldsInLists(List fieldsInLists); - - _FinalStage fieldsInReferences(List fieldsInReferences); - - _FinalStage addFieldsInReferences(String fieldsInReferences); - - _FinalStage addAllFieldsInReferences(List fieldsInReferences); - - _FinalStage fieldRules(List fieldRules); - - _FinalStage addFieldRules(FieldRuleDto fieldRules); - - _FinalStage addAllFieldRules(List fieldRules); - - _FinalStage fields(List fields); - - _FinalStage addFields(FieldDto fields); - - _FinalStage addAllFields(List fields); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - NameStage, - TypeStage, - PropertiesStage, - IsSingletonStage, - IsPublishedStage, - CreatedStage, - LastModifiedStage, - VersionStage, - ScriptsStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private String name; - - private SchemaType type; - - private SchemaPropertiesDto properties; - - private boolean isSingleton; - - private boolean isPublished; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private SchemaScriptsDto scripts; - - private List fields = new ArrayList<>(); - - private List fieldRules = new ArrayList<>(); - - private List fieldsInReferences = new ArrayList<>(); - - private List fieldsInLists = new ArrayList<>(); - - private Map previewUrls = new LinkedHashMap<>(); - - private Optional category = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SchemaDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - name(other.getName()); - type(other.getType()); - category(other.getCategory()); - properties(other.getProperties()); - isSingleton(other.getIsSingleton()); - isPublished(other.getIsPublished()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - scripts(other.getScripts()); - previewUrls(other.getPreviewUrls()); - fieldsInLists(other.getFieldsInLists()); - fieldsInReferences(other.getFieldsInReferences()); - fieldRules(other.getFieldRules()); - fields(other.getFields()); - return this; - } - - /** - *

The ID of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public NameStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The name of the schema. Unique within the app. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TypeStage name(String name) { - this.name = name; - return this; - } - - @Override - @JsonSetter("type") - public PropertiesStage type(SchemaType type) { - this.type = type; - return this; - } - - @Override - @JsonSetter("properties") - public IsSingletonStage properties(SchemaPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

Indicates if the schema is a singleton.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isSingleton") - public IsPublishedStage isSingleton(boolean isSingleton) { - this.isSingleton = isSingleton; - return this; - } - - /** - *

Indicates if the schema is published.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isPublished") - public CreatedStage isPublished(boolean isPublished) { - this.isPublished = isPublished; - return this; - } - - /** - *

The date and time when the schema has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the schema has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public ScriptsStage version(int version) { - this.version = version; - return this; - } - - @Override - @JsonSetter("scripts") - public _FinalStage scripts(SchemaScriptsDto scripts) { - this.scripts = scripts; - return this; - } - - /** - *

The list of fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFields(List fields) { - this.fields.addAll(fields); - return this; - } - - /** - *

The list of fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFields(FieldDto fields) { - this.fields.add(fields); - return this; - } - - @Override - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public _FinalStage fields(List fields) { - this.fields.clear(); - this.fields.addAll(fields); - return this; - } - - /** - *

The field rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldRules(List fieldRules) { - this.fieldRules.addAll(fieldRules); - return this; - } - - /** - *

The field rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldRules(FieldRuleDto fieldRules) { - this.fieldRules.add(fieldRules); - return this; - } - - @Override - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public _FinalStage fieldRules(List fieldRules) { - this.fieldRules.clear(); - this.fieldRules.addAll(fieldRules); - return this; - } - - /** - *

The name of fields that are used in content references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences.addAll(fieldsInReferences); - return this; - } - - /** - *

The name of fields that are used in content references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldsInReferences(String fieldsInReferences) { - this.fieldsInReferences.add(fieldsInReferences); - return this; - } - - @Override - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public _FinalStage fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences.clear(); - this.fieldsInReferences.addAll(fieldsInReferences); - return this; - } - - /** - *

The name of fields that are used in content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldsInLists(List fieldsInLists) { - this.fieldsInLists.addAll(fieldsInLists); - return this; - } - - /** - *

The name of fields that are used in content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldsInLists(String fieldsInLists) { - this.fieldsInLists.add(fieldsInLists); - return this; - } - - @Override - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public _FinalStage fieldsInLists(List fieldsInLists) { - this.fieldsInLists.clear(); - this.fieldsInLists.addAll(fieldsInLists); - return this; - } - - /** - *

The preview Urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage previewUrls(String key, String value) { - this.previewUrls.put(key, value); - return this; - } - - /** - *

The preview Urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllPreviewUrls(Map previewUrls) { - this.previewUrls.putAll(previewUrls); - return this; - } - - @Override - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public _FinalStage previewUrls(Map previewUrls) { - this.previewUrls.clear(); - this.previewUrls.putAll(previewUrls); - return this; - } - - /** - *

The name of the category.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(String category) { - this.category = Optional.of(category); - return this; - } - - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SchemaDto build() { - return new SchemaDto( - links, - id, - createdBy, - lastModifiedBy, - name, - type, - category, - properties, - isSingleton, - isPublished, - created, - lastModified, - version, - scripts, - previewUrls, - fieldsInLists, - fieldsInReferences, - fieldRules, - fields); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java b/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java deleted file mode 100644 index 27e2964..0000000 --- a/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java +++ /dev/null @@ -1,325 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaPropertiesDto.Builder.class) -public final class SchemaPropertiesDto { - private final Optional label; - - private final Optional hints; - - private final Optional contentsSidebarUrl; - - private final Optional contentSidebarUrl; - - private final Optional contentEditorUrl; - - private final boolean validateOnPublish; - - private final Optional> tags; - - private SchemaPropertiesDto( - Optional label, - Optional hints, - Optional contentsSidebarUrl, - Optional contentSidebarUrl, - Optional contentEditorUrl, - boolean validateOnPublish, - Optional> tags) { - this.label = label; - this.hints = hints; - this.contentsSidebarUrl = contentsSidebarUrl; - this.contentSidebarUrl = contentSidebarUrl; - this.contentEditorUrl = contentEditorUrl; - this.validateOnPublish = validateOnPublish; - this.tags = tags; - } - - /** - * @return Optional label for the editor. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return Hints to describe the schema. - */ - @JsonProperty("hints") - public Optional getHints() { - return hints; - } - - /** - * @return The url to a the sidebar plugin for content lists. - */ - @JsonProperty("contentsSidebarUrl") - public Optional getContentsSidebarUrl() { - return contentsSidebarUrl; - } - - /** - * @return The url to a the sidebar plugin for content items. - */ - @JsonProperty("contentSidebarUrl") - public Optional getContentSidebarUrl() { - return contentSidebarUrl; - } - - /** - * @return The url to the editor plugin. - */ - @JsonProperty("contentEditorUrl") - public Optional getContentEditorUrl() { - return contentEditorUrl; - } - - /** - * @return True to validate the content items on publish. - */ - @JsonProperty("validateOnPublish") - public boolean getValidateOnPublish() { - return validateOnPublish; - } - - /** - * @return Tags for automation processes. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaPropertiesDto && equalTo((SchemaPropertiesDto) other); - } - - private boolean equalTo(SchemaPropertiesDto other) { - return label.equals(other.label) - && hints.equals(other.hints) - && contentsSidebarUrl.equals(other.contentsSidebarUrl) - && contentSidebarUrl.equals(other.contentSidebarUrl) - && contentEditorUrl.equals(other.contentEditorUrl) - && validateOnPublish == other.validateOnPublish - && tags.equals(other.tags); - } - - @Override - public int hashCode() { - return Objects.hash( - this.label, - this.hints, - this.contentsSidebarUrl, - this.contentSidebarUrl, - this.contentEditorUrl, - this.validateOnPublish, - this.tags); - } - - @Override - public String toString() { - return "SchemaPropertiesDto{" + "label: " + label + ", hints: " + hints + ", contentsSidebarUrl: " - + contentsSidebarUrl + ", contentSidebarUrl: " + contentSidebarUrl + ", contentEditorUrl: " - + contentEditorUrl + ", validateOnPublish: " + validateOnPublish + ", tags: " + tags + "}"; - } - - public static ValidateOnPublishStage builder() { - return new Builder(); - } - - public interface ValidateOnPublishStage { - _FinalStage validateOnPublish(boolean validateOnPublish); - - Builder from(SchemaPropertiesDto other); - } - - public interface _FinalStage { - SchemaPropertiesDto build(); - - _FinalStage label(Optional label); - - _FinalStage label(String label); - - _FinalStage hints(Optional hints); - - _FinalStage hints(String hints); - - _FinalStage contentsSidebarUrl(Optional contentsSidebarUrl); - - _FinalStage contentsSidebarUrl(String contentsSidebarUrl); - - _FinalStage contentSidebarUrl(Optional contentSidebarUrl); - - _FinalStage contentSidebarUrl(String contentSidebarUrl); - - _FinalStage contentEditorUrl(Optional contentEditorUrl); - - _FinalStage contentEditorUrl(String contentEditorUrl); - - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ValidateOnPublishStage, _FinalStage { - private boolean validateOnPublish; - - private Optional> tags = Optional.empty(); - - private Optional contentEditorUrl = Optional.empty(); - - private Optional contentSidebarUrl = Optional.empty(); - - private Optional contentsSidebarUrl = Optional.empty(); - - private Optional hints = Optional.empty(); - - private Optional label = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SchemaPropertiesDto other) { - label(other.getLabel()); - hints(other.getHints()); - contentsSidebarUrl(other.getContentsSidebarUrl()); - contentSidebarUrl(other.getContentSidebarUrl()); - contentEditorUrl(other.getContentEditorUrl()); - validateOnPublish(other.getValidateOnPublish()); - tags(other.getTags()); - return this; - } - - /** - *

True to validate the content items on publish.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("validateOnPublish") - public _FinalStage validateOnPublish(boolean validateOnPublish) { - this.validateOnPublish = validateOnPublish; - return this; - } - - /** - *

Tags for automation processes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - /** - *

The url to the editor plugin.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentEditorUrl(String contentEditorUrl) { - this.contentEditorUrl = Optional.of(contentEditorUrl); - return this; - } - - @Override - @JsonSetter(value = "contentEditorUrl", nulls = Nulls.SKIP) - public _FinalStage contentEditorUrl(Optional contentEditorUrl) { - this.contentEditorUrl = contentEditorUrl; - return this; - } - - /** - *

The url to a the sidebar plugin for content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentSidebarUrl(String contentSidebarUrl) { - this.contentSidebarUrl = Optional.of(contentSidebarUrl); - return this; - } - - @Override - @JsonSetter(value = "contentSidebarUrl", nulls = Nulls.SKIP) - public _FinalStage contentSidebarUrl(Optional contentSidebarUrl) { - this.contentSidebarUrl = contentSidebarUrl; - return this; - } - - /** - *

The url to a the sidebar plugin for content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentsSidebarUrl(String contentsSidebarUrl) { - this.contentsSidebarUrl = Optional.of(contentsSidebarUrl); - return this; - } - - @Override - @JsonSetter(value = "contentsSidebarUrl", nulls = Nulls.SKIP) - public _FinalStage contentsSidebarUrl(Optional contentsSidebarUrl) { - this.contentsSidebarUrl = contentsSidebarUrl; - return this; - } - - /** - *

Hints to describe the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage hints(String hints) { - this.hints = Optional.of(hints); - return this; - } - - @Override - @JsonSetter(value = "hints", nulls = Nulls.SKIP) - public _FinalStage hints(Optional hints) { - this.hints = hints; - return this; - } - - /** - *

Optional label for the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; - } - - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; - } - - @Override - public SchemaPropertiesDto build() { - return new SchemaPropertiesDto( - label, hints, contentsSidebarUrl, contentSidebarUrl, contentEditorUrl, validateOnPublish, tags); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaScriptsDto.java b/src/main/java/com/squidex/api/types/SchemaScriptsDto.java deleted file mode 100644 index 7a65989..0000000 --- a/src/main/java/com/squidex/api/types/SchemaScriptsDto.java +++ /dev/null @@ -1,216 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaScriptsDto.Builder.class) -public final class SchemaScriptsDto { - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional delete; - - private final Optional change; - - private SchemaScriptsDto( - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional delete, - Optional change) { - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.delete = delete; - this.change = change; - } - - /** - * @return The script that is executed for each content when querying contents. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all contents when querying contents. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating a content. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - /** - * @return The script that is executed when change a content status. - */ - @JsonProperty("change") - public Optional getChange() { - return change; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaScriptsDto && equalTo((SchemaScriptsDto) other); - } - - private boolean equalTo(SchemaScriptsDto other) { - return query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && delete.equals(other.delete) - && change.equals(other.change); - } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.queryPre, this.create, this.update, this.delete, this.change); - } - - @Override - public String toString() { - return "SchemaScriptsDto{" + "query: " + query + ", queryPre: " + queryPre + ", create: " + create - + ", update: " + update + ", delete: " + delete + ", change: " + change + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional delete = Optional.empty(); - - private Optional change = Optional.empty(); - - private Builder() {} - - public Builder from(SchemaScriptsDto other) { - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - delete(other.getDelete()); - change(other.getChange()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public Builder queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - public Builder queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public Builder create(Optional create) { - this.create = create; - return this; - } - - public Builder create(String create) { - this.create = Optional.of(create); - return this; - } - - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public Builder update(Optional update) { - this.update = update; - return this; - } - - public Builder update(String update) { - this.update = Optional.of(update); - return this; - } - - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public Builder delete(Optional delete) { - this.delete = delete; - return this; - } - - public Builder delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @JsonSetter(value = "change", nulls = Nulls.SKIP) - public Builder change(Optional change) { - this.change = change; - return this; - } - - public Builder change(String change) { - this.change = Optional.of(change); - return this; - } - - public SchemaScriptsDto build() { - return new SchemaScriptsDto(query, queryPre, create, update, delete, change); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SchemaType.java b/src/main/java/com/squidex/api/types/SchemaType.java deleted file mode 100644 index b7da05a..0000000 --- a/src/main/java/com/squidex/api/types/SchemaType.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum SchemaType { - DEFAULT("Default"), - - SINGLETON("Singleton"), - - COMPONENT("Component"); - - private final String value; - - SchemaType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/SchemasDto.java b/src/main/java/com/squidex/api/types/SchemasDto.java deleted file mode 100644 index 64bb1a6..0000000 --- a/src/main/java/com/squidex/api/types/SchemasDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemasDto.Builder.class) -public final class SchemasDto implements IResource { - private final Map links; - - private final List items; - - private SchemasDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The schemas. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemasDto && equalTo((SchemasDto) other); - } - - private boolean equalTo(SchemasDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "SchemasDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(SchemasDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(SchemaDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public SchemasDto build() { - return new SchemasDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java b/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java deleted file mode 100644 index 9b43d87..0000000 --- a/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ScriptRuleActionDto.Builder.class) -public final class ScriptRuleActionDto { - private final String script; - - private ScriptRuleActionDto(String script) { - this.script = script; - } - - /** - * @return The script to render. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("script") - public String getScript() { - return script; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScriptRuleActionDto && equalTo((ScriptRuleActionDto) other); - } - - private boolean equalTo(ScriptRuleActionDto other) { - return script.equals(other.script); - } - - @Override - public int hashCode() { - return Objects.hash(this.script); - } - - @Override - public String toString() { - return "ScriptRuleActionDto{" + "script: " + script + "}"; - } - - public static ScriptStage builder() { - return new Builder(); - } - - public interface ScriptStage { - _FinalStage script(String script); - - Builder from(ScriptRuleActionDto other); - } - - public interface _FinalStage { - ScriptRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ScriptStage, _FinalStage { - private String script; - - private Builder() {} - - @Override - public Builder from(ScriptRuleActionDto other) { - script(other.getScript()); - return this; - } - - /** - *

The script to render. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("script") - public _FinalStage script(String script) { - this.script = script; - return this; - } - - @Override - public ScriptRuleActionDto build() { - return new ScriptRuleActionDto(script); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SearchResultDto.java b/src/main/java/com/squidex/api/types/SearchResultDto.java deleted file mode 100644 index 4fbe4c2..0000000 --- a/src/main/java/com/squidex/api/types/SearchResultDto.java +++ /dev/null @@ -1,204 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SearchResultDto.Builder.class) -public final class SearchResultDto implements IResource { - private final Map links; - - private final String name; - - private final SearchResultType type; - - private final Optional label; - - private SearchResultDto( - Map links, String name, SearchResultType type, Optional label) { - this.links = links; - this.name = name; - this.type = type; - this.label = label; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The name of the search result. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("type") - public SearchResultType getType() { - return type; - } - - /** - * @return An optional label. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SearchResultDto && equalTo((SearchResultDto) other); - } - - private boolean equalTo(SearchResultDto other) { - return links.equals(other.links) - && name.equals(other.name) - && type.equals(other.type) - && label.equals(other.label); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.name, this.type, this.label); - } - - @Override - public String toString() { - return "SearchResultDto{" + "links: " + links + ", name: " + name + ", type: " + type + ", label: " + label - + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - TypeStage name(String name); - - Builder from(SearchResultDto other); - } - - public interface TypeStage { - _FinalStage type(SearchResultType type); - } - - public interface _FinalStage { - SearchResultDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage label(Optional label); - - _FinalStage label(String label); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TypeStage, _FinalStage { - private String name; - - private SearchResultType type; - - private Optional label = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SearchResultDto other) { - links(other.getLinks()); - name(other.getName()); - type(other.getType()); - label(other.getLabel()); - return this; - } - - /** - *

The name of the search result.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TypeStage name(String name) { - this.name = name; - return this; - } - - @Override - @JsonSetter("type") - public _FinalStage type(SearchResultType type) { - this.type = type; - return this; - } - - /** - *

An optional label.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; - } - - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SearchResultDto build() { - return new SearchResultDto(links, name, type, label); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SearchResultType.java b/src/main/java/com/squidex/api/types/SearchResultType.java deleted file mode 100644 index 6aedba1..0000000 --- a/src/main/java/com/squidex/api/types/SearchResultType.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum SearchResultType { - ASSET("Asset"), - - CONTENT("Content"), - - DASHBOARD("Dashboard"), - - SETTING("Setting"), - - RULE("Rule"), - - SCHEMA("Schema"); - - private final String value; - - SearchResultType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java b/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java deleted file mode 100644 index 72c9c67..0000000 --- a/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java +++ /dev/null @@ -1,261 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SignalRRuleActionDto.Builder.class) -public final class SignalRRuleActionDto { - private final String connectionString; - - private final String hubName; - - private final ActionTypeEnum action; - - private final Optional methodName; - - private final Optional target; - - private final Optional payload; - - private SignalRRuleActionDto( - String connectionString, - String hubName, - ActionTypeEnum action, - Optional methodName, - Optional target, - Optional payload) { - this.connectionString = connectionString; - this.hubName = hubName; - this.action = action; - this.methodName = methodName; - this.target = target; - this.payload = payload; - } - - /** - * @return The connection string to the Azure SignalR. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("connectionString") - public String getConnectionString() { - return connectionString; - } - - /** - * @return The name of the hub. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("hubName") - public String getHubName() { - return hubName; - } - - @JsonProperty("action") - public ActionTypeEnum getAction() { - return action; - } - - /** - * @return Set the Name of the hub method received by the customer. - */ - @JsonProperty("methodName") - public Optional getMethodName() { - return methodName; - } - - /** - * @return Define target users or groups by id or name. One item per line. Not needed for Broadcast action. - */ - @JsonProperty("target") - public Optional getTarget() { - return target; - } - - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SignalRRuleActionDto && equalTo((SignalRRuleActionDto) other); - } - - private boolean equalTo(SignalRRuleActionDto other) { - return connectionString.equals(other.connectionString) - && hubName.equals(other.hubName) - && action.equals(other.action) - && methodName.equals(other.methodName) - && target.equals(other.target) - && payload.equals(other.payload); - } - - @Override - public int hashCode() { - return Objects.hash( - this.connectionString, this.hubName, this.action, this.methodName, this.target, this.payload); - } - - @Override - public String toString() { - return "SignalRRuleActionDto{" + "connectionString: " + connectionString + ", hubName: " + hubName - + ", action: " + action + ", methodName: " + methodName + ", target: " + target + ", payload: " - + payload + "}"; - } - - public static ConnectionStringStage builder() { - return new Builder(); - } - - public interface ConnectionStringStage { - HubNameStage connectionString(String connectionString); - - Builder from(SignalRRuleActionDto other); - } - - public interface HubNameStage { - ActionStage hubName(String hubName); - } - - public interface ActionStage { - _FinalStage action(ActionTypeEnum action); - } - - public interface _FinalStage { - SignalRRuleActionDto build(); - - _FinalStage methodName(Optional methodName); - - _FinalStage methodName(String methodName); - - _FinalStage target(Optional target); - - _FinalStage target(String target); - - _FinalStage payload(Optional payload); - - _FinalStage payload(String payload); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ConnectionStringStage, HubNameStage, ActionStage, _FinalStage { - private String connectionString; - - private String hubName; - - private ActionTypeEnum action; - - private Optional payload = Optional.empty(); - - private Optional target = Optional.empty(); - - private Optional methodName = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SignalRRuleActionDto other) { - connectionString(other.getConnectionString()); - hubName(other.getHubName()); - action(other.getAction()); - methodName(other.getMethodName()); - target(other.getTarget()); - payload(other.getPayload()); - return this; - } - - /** - *

The connection string to the Azure SignalR. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("connectionString") - public HubNameStage connectionString(String connectionString) { - this.connectionString = connectionString; - return this; - } - - /** - *

The name of the hub. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hubName") - public ActionStage hubName(String hubName) { - this.hubName = hubName; - return this; - } - - @Override - @JsonSetter("action") - public _FinalStage action(ActionTypeEnum action) { - this.action = action; - return this; - } - - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } - - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } - - /** - *

Define target users or groups by id or name. One item per line. Not needed for Broadcast action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage target(String target) { - this.target = Optional.of(target); - return this; - } - - @Override - @JsonSetter(value = "target", nulls = Nulls.SKIP) - public _FinalStage target(Optional target) { - this.target = target; - return this; - } - - /** - *

Set the Name of the hub method received by the customer.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage methodName(String methodName) { - this.methodName = Optional.of(methodName); - return this; - } - - @Override - @JsonSetter(value = "methodName", nulls = Nulls.SKIP) - public _FinalStage methodName(Optional methodName) { - this.methodName = methodName; - return this; - } - - @Override - public SignalRRuleActionDto build() { - return new SignalRRuleActionDto(connectionString, hubName, action, methodName, target, payload); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java deleted file mode 100644 index f9a3cf1..0000000 --- a/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java +++ /dev/null @@ -1,383 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SimulatedRuleEventDto.Builder.class) -public final class SimulatedRuleEventDto { - private final String eventId; - - private final String uniqueId; - - private final String eventName; - - private final Object event; - - private final Optional enrichedEvent; - - private final Optional actionName; - - private final Optional actionData; - - private final Optional error; - - private final List skipReasons; - - private SimulatedRuleEventDto( - String eventId, - String uniqueId, - String eventName, - Object event, - Optional enrichedEvent, - Optional actionName, - Optional actionData, - Optional error, - List skipReasons) { - this.eventId = eventId; - this.uniqueId = uniqueId; - this.eventName = eventName; - this.event = event; - this.enrichedEvent = enrichedEvent; - this.actionName = actionName; - this.actionData = actionData; - this.error = error; - this.skipReasons = skipReasons; - } - - /** - * @return The unique event id. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("eventId") - public String getEventId() { - return eventId; - } - - /** - * @return The the unique id of the simulated event. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("uniqueId") - public String getUniqueId() { - return uniqueId; - } - - /** - * @return The name of the event. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("eventName") - public String getEventName() { - return eventName; - } - - @JsonProperty("event") - public Object getEvent() { - return event; - } - - @JsonProperty("enrichedEvent") - public Optional getEnrichedEvent() { - return enrichedEvent; - } - - /** - * @return The data for the action. - */ - @JsonProperty("actionName") - public Optional getActionName() { - return actionName; - } - - /** - * @return The name of the action. - */ - @JsonProperty("actionData") - public Optional getActionData() { - return actionData; - } - - /** - * @return The name of the event. - */ - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The reason why the event has been skipped. - */ - @JsonProperty("skipReasons") - public List getSkipReasons() { - return skipReasons; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SimulatedRuleEventDto && equalTo((SimulatedRuleEventDto) other); - } - - private boolean equalTo(SimulatedRuleEventDto other) { - return eventId.equals(other.eventId) - && uniqueId.equals(other.uniqueId) - && eventName.equals(other.eventName) - && event.equals(other.event) - && enrichedEvent.equals(other.enrichedEvent) - && actionName.equals(other.actionName) - && actionData.equals(other.actionData) - && error.equals(other.error) - && skipReasons.equals(other.skipReasons); - } - - @Override - public int hashCode() { - return Objects.hash( - this.eventId, - this.uniqueId, - this.eventName, - this.event, - this.enrichedEvent, - this.actionName, - this.actionData, - this.error, - this.skipReasons); - } - - @Override - public String toString() { - return "SimulatedRuleEventDto{" + "eventId: " + eventId + ", uniqueId: " + uniqueId + ", eventName: " - + eventName + ", event: " + event + ", enrichedEvent: " + enrichedEvent + ", actionName: " + actionName - + ", actionData: " + actionData + ", error: " + error + ", skipReasons: " + skipReasons + "}"; - } - - public static EventIdStage builder() { - return new Builder(); - } - - public interface EventIdStage { - UniqueIdStage eventId(String eventId); - - Builder from(SimulatedRuleEventDto other); - } - - public interface UniqueIdStage { - EventNameStage uniqueId(String uniqueId); - } - - public interface EventNameStage { - EventStage eventName(String eventName); - } - - public interface EventStage { - _FinalStage event(Object event); - } - - public interface _FinalStage { - SimulatedRuleEventDto build(); - - _FinalStage enrichedEvent(Optional enrichedEvent); - - _FinalStage enrichedEvent(Object enrichedEvent); - - _FinalStage actionName(Optional actionName); - - _FinalStage actionName(String actionName); - - _FinalStage actionData(Optional actionData); - - _FinalStage actionData(String actionData); - - _FinalStage error(Optional error); - - _FinalStage error(String error); - - _FinalStage skipReasons(List skipReasons); - - _FinalStage addSkipReasons(SkipReason skipReasons); - - _FinalStage addAllSkipReasons(List skipReasons); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EventIdStage, UniqueIdStage, EventNameStage, EventStage, _FinalStage { - private String eventId; - - private String uniqueId; - - private String eventName; - - private Object event; - - private List skipReasons = new ArrayList<>(); - - private Optional error = Optional.empty(); - - private Optional actionData = Optional.empty(); - - private Optional actionName = Optional.empty(); - - private Optional enrichedEvent = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SimulatedRuleEventDto other) { - eventId(other.getEventId()); - uniqueId(other.getUniqueId()); - eventName(other.getEventName()); - event(other.getEvent()); - enrichedEvent(other.getEnrichedEvent()); - actionName(other.getActionName()); - actionData(other.getActionData()); - error(other.getError()); - skipReasons(other.getSkipReasons()); - return this; - } - - /** - *

The unique event id. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventId") - public UniqueIdStage eventId(String eventId) { - this.eventId = eventId; - return this; - } - - /** - *

The the unique id of the simulated event. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("uniqueId") - public EventNameStage uniqueId(String uniqueId) { - this.uniqueId = uniqueId; - return this; - } - - /** - *

The name of the event. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventName") - public EventStage eventName(String eventName) { - this.eventName = eventName; - return this; - } - - @Override - @JsonSetter("event") - public _FinalStage event(Object event) { - this.event = event; - return this; - } - - /** - *

The reason why the event has been skipped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllSkipReasons(List skipReasons) { - this.skipReasons.addAll(skipReasons); - return this; - } - - /** - *

The reason why the event has been skipped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addSkipReasons(SkipReason skipReasons) { - this.skipReasons.add(skipReasons); - return this; - } - - @Override - @JsonSetter(value = "skipReasons", nulls = Nulls.SKIP) - public _FinalStage skipReasons(List skipReasons) { - this.skipReasons.clear(); - this.skipReasons.addAll(skipReasons); - return this; - } - - /** - *

The name of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage error(String error) { - this.error = Optional.of(error); - return this; - } - - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - /** - *

The name of the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage actionData(String actionData) { - this.actionData = Optional.of(actionData); - return this; - } - - @Override - @JsonSetter(value = "actionData", nulls = Nulls.SKIP) - public _FinalStage actionData(Optional actionData) { - this.actionData = actionData; - return this; - } - - /** - *

The data for the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage actionName(String actionName) { - this.actionName = Optional.of(actionName); - return this; - } - - @Override - @JsonSetter(value = "actionName", nulls = Nulls.SKIP) - public _FinalStage actionName(Optional actionName) { - this.actionName = actionName; - return this; - } - - @Override - public _FinalStage enrichedEvent(Object enrichedEvent) { - this.enrichedEvent = Optional.of(enrichedEvent); - return this; - } - - @Override - @JsonSetter(value = "enrichedEvent", nulls = Nulls.SKIP) - public _FinalStage enrichedEvent(Optional enrichedEvent) { - this.enrichedEvent = enrichedEvent; - return this; - } - - @Override - public SimulatedRuleEventDto build() { - return new SimulatedRuleEventDto( - eventId, uniqueId, eventName, event, enrichedEvent, actionName, actionData, error, skipReasons); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java deleted file mode 100644 index f1f3048..0000000 --- a/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SimulatedRuleEventsDto.Builder.class) -public final class SimulatedRuleEventsDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private SimulatedRuleEventsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of simulated rule events. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The simulated rule events. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SimulatedRuleEventsDto && equalTo((SimulatedRuleEventsDto) other); - } - - private boolean equalTo(SimulatedRuleEventsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); - } - - @Override - public String toString() { - return "SimulatedRuleEventsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(SimulatedRuleEventsDto other); - } - - public interface _FinalStage { - SimulatedRuleEventsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(SimulatedRuleEventDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SimulatedRuleEventsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; - } - - /** - *

The total number of simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(SimulatedRuleEventDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SimulatedRuleEventsDto build() { - return new SimulatedRuleEventsDto(links, total, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SkipReason.java b/src/main/java/com/squidex/api/types/SkipReason.java deleted file mode 100644 index cdbf55b..0000000 --- a/src/main/java/com/squidex/api/types/SkipReason.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum SkipReason { - NONE("None"), - - CONDITION_DOES_NOT_MATCH("ConditionDoesNotMatch"), - - CONDITION_PRECHECK_DOES_NOT_MATCH("ConditionPrecheckDoesNotMatch"), - - DISABLED("Disabled"), - - FAILED("Failed"), - - FROM_RULE("FromRule"), - - NO_ACTION("NoAction"), - - NO_TRIGGER("NoTrigger"), - - TOO_OLD("TooOld"), - - WRONG_EVENT("WrongEvent"), - - WRONG_EVENT_FOR_TRIGGER("WrongEventForTrigger"); - - private final String value; - - SkipReason(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/SlackRuleActionDto.java b/src/main/java/com/squidex/api/types/SlackRuleActionDto.java deleted file mode 100644 index 23aaf86..0000000 --- a/src/main/java/com/squidex/api/types/SlackRuleActionDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SlackRuleActionDto.Builder.class) -public final class SlackRuleActionDto { - private final String webhookUrl; - - private final String text; - - private SlackRuleActionDto(String webhookUrl, String text) { - this.webhookUrl = webhookUrl; - this.text = text; - } - - /** - * @return The slack webhook url. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("webhookUrl") - public String getWebhookUrl() { - return webhookUrl; - } - - /** - * @return The text that is sent as message to slack. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SlackRuleActionDto && equalTo((SlackRuleActionDto) other); - } - - private boolean equalTo(SlackRuleActionDto other) { - return webhookUrl.equals(other.webhookUrl) && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.webhookUrl, this.text); - } - - @Override - public String toString() { - return "SlackRuleActionDto{" + "webhookUrl: " + webhookUrl + ", text: " + text + "}"; - } - - public static WebhookUrlStage builder() { - return new Builder(); - } - - public interface WebhookUrlStage { - TextStage webhookUrl(String webhookUrl); - - Builder from(SlackRuleActionDto other); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - SlackRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements WebhookUrlStage, TextStage, _FinalStage { - private String webhookUrl; - - private String text; - - private Builder() {} - - @Override - public Builder from(SlackRuleActionDto other) { - webhookUrl(other.getWebhookUrl()); - text(other.getText()); - return this; - } - - /** - *

The slack webhook url. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("webhookUrl") - public TextStage webhookUrl(String webhookUrl) { - this.webhookUrl = webhookUrl; - return this; - } - - /** - *

The text that is sent as message to slack. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - @Override - public SlackRuleActionDto build() { - return new SlackRuleActionDto(webhookUrl, text); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SortNode.java b/src/main/java/com/squidex/api/types/SortNode.java deleted file mode 100644 index b4f22c4..0000000 --- a/src/main/java/com/squidex/api/types/SortNode.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SortNode.Builder.class) -public final class SortNode { - private final List path; - - private final SortOrder order; - - private SortNode(List path, SortOrder order) { - this.path = path; - this.order = order; - } - - @JsonProperty("path") - public List getPath() { - return path; - } - - @JsonProperty("order") - public SortOrder getOrder() { - return order; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SortNode && equalTo((SortNode) other); - } - - private boolean equalTo(SortNode other) { - return path.equals(other.path) && order.equals(other.order); - } - - @Override - public int hashCode() { - return Objects.hash(this.path, this.order); - } - - @Override - public String toString() { - return "SortNode{" + "path: " + path + ", order: " + order + "}"; - } - - public static OrderStage builder() { - return new Builder(); - } - - public interface OrderStage { - _FinalStage order(SortOrder order); - - Builder from(SortNode other); - } - - public interface _FinalStage { - SortNode build(); - - _FinalStage path(List path); - - _FinalStage addPath(String path); - - _FinalStage addAllPath(List path); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements OrderStage, _FinalStage { - private SortOrder order; - - private List path = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(SortNode other) { - path(other.getPath()); - order(other.getOrder()); - return this; - } - - @Override - @JsonSetter("order") - public _FinalStage order(SortOrder order) { - this.order = order; - return this; - } - - @Override - public _FinalStage addAllPath(List path) { - this.path.addAll(path); - return this; - } - - @Override - public _FinalStage addPath(String path) { - this.path.add(path); - return this; - } - - @Override - @JsonSetter(value = "path", nulls = Nulls.SKIP) - public _FinalStage path(List path) { - this.path.clear(); - this.path.addAll(path); - return this; - } - - @Override - public SortNode build() { - return new SortNode(path, order); - } - } -} diff --git a/src/main/java/com/squidex/api/types/SortOrder.java b/src/main/java/com/squidex/api/types/SortOrder.java deleted file mode 100644 index c1f1c4d..0000000 --- a/src/main/java/com/squidex/api/types/SortOrder.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum SortOrder { - ASCENDING("Ascending"), - - DESCENDING("Descending"); - - private final String value; - - SortOrder(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/StatusInfoDto.java b/src/main/java/com/squidex/api/types/StatusInfoDto.java deleted file mode 100644 index 9231196..0000000 --- a/src/main/java/com/squidex/api/types/StatusInfoDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StatusInfoDto.Builder.class) -public final class StatusInfoDto { - private final String status; - - private final String color; - - private StatusInfoDto(String status, String color) { - this.status = status; - this.color = color; - } - - /** - * @return The name of the status. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The color of the status. - */ - @JsonProperty("color") - public String getColor() { - return color; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StatusInfoDto && equalTo((StatusInfoDto) other); - } - - private boolean equalTo(StatusInfoDto other) { - return status.equals(other.status) && color.equals(other.color); - } - - @Override - public int hashCode() { - return Objects.hash(this.status, this.color); - } - - @Override - public String toString() { - return "StatusInfoDto{" + "status: " + status + ", color: " + color + "}"; - } - - public static StatusStage builder() { - return new Builder(); - } - - public interface StatusStage { - ColorStage status(String status); - - Builder from(StatusInfoDto other); - } - - public interface ColorStage { - _FinalStage color(String color); - } - - public interface _FinalStage { - StatusInfoDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StatusStage, ColorStage, _FinalStage { - private String status; - - private String color; - - private Builder() {} - - @Override - public Builder from(StatusInfoDto other) { - status(other.getStatus()); - color(other.getColor()); - return this; - } - - /** - *

The name of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public ColorStage status(String status) { - this.status = status; - return this; - } - - /** - *

The color of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("color") - public _FinalStage color(String color) { - this.color = color; - return this; - } - - @Override - public StatusInfoDto build() { - return new StatusInfoDto(status, color); - } - } -} diff --git a/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java b/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java deleted file mode 100644 index a92de77..0000000 --- a/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StorageUsagePerDateDto.Builder.class) -public final class StorageUsagePerDateDto { - private final String date; - - private final int totalCount; - - private final int totalSize; - - private StorageUsagePerDateDto(String date, int totalCount, int totalSize) { - this.date = date; - this.totalCount = totalCount; - this.totalSize = totalSize; - } - - /** - * @return The date when the usage was tracked. - */ - @JsonProperty("date") - public String getDate() { - return date; - } - - /** - * @return The number of assets. - */ - @JsonProperty("totalCount") - public int getTotalCount() { - return totalCount; - } - - /** - * @return The size in bytes. - */ - @JsonProperty("totalSize") - public int getTotalSize() { - return totalSize; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StorageUsagePerDateDto && equalTo((StorageUsagePerDateDto) other); - } - - private boolean equalTo(StorageUsagePerDateDto other) { - return date.equals(other.date) && totalCount == other.totalCount && totalSize == other.totalSize; - } - - @Override - public int hashCode() { - return Objects.hash(this.date, this.totalCount, this.totalSize); - } - - @Override - public String toString() { - return "StorageUsagePerDateDto{" + "date: " + date + ", totalCount: " + totalCount + ", totalSize: " + totalSize - + "}"; - } - - public static DateStage builder() { - return new Builder(); - } - - public interface DateStage { - TotalCountStage date(String date); - - Builder from(StorageUsagePerDateDto other); - } - - public interface TotalCountStage { - TotalSizeStage totalCount(int totalCount); - } - - public interface TotalSizeStage { - _FinalStage totalSize(int totalSize); - } - - public interface _FinalStage { - StorageUsagePerDateDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DateStage, TotalCountStage, TotalSizeStage, _FinalStage { - private String date; - - private int totalCount; - - private int totalSize; - - private Builder() {} - - @Override - public Builder from(StorageUsagePerDateDto other) { - date(other.getDate()); - totalCount(other.getTotalCount()); - totalSize(other.getTotalSize()); - return this; - } - - /** - *

The date when the usage was tracked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("date") - public TotalCountStage date(String date) { - this.date = date; - return this; - } - - /** - *

The number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCount") - public TotalSizeStage totalCount(int totalCount) { - this.totalCount = totalCount; - return this; - } - - /** - *

The size in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalSize") - public _FinalStage totalSize(int totalSize) { - this.totalSize = totalSize; - return this; - } - - @Override - public StorageUsagePerDateDto build() { - return new StorageUsagePerDateDto(date, totalCount, totalSize); - } - } -} diff --git a/src/main/java/com/squidex/api/types/StringContentType.java b/src/main/java/com/squidex/api/types/StringContentType.java deleted file mode 100644 index 135cefa..0000000 --- a/src/main/java/com/squidex/api/types/StringContentType.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum StringContentType { - UNSPECIFIED("Unspecified"), - - HTML("Html"), - - MARKDOWN("Markdown"); - - private final String value; - - StringContentType(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/StringFieldEditor.java b/src/main/java/com/squidex/api/types/StringFieldEditor.java deleted file mode 100644 index ef7a09c..0000000 --- a/src/main/java/com/squidex/api/types/StringFieldEditor.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum StringFieldEditor { - INPUT("Input"), - - COLOR("Color"), - - MARKDOWN("Markdown"), - - DROPDOWN("Dropdown"), - - HTML("Html"), - - RADIO("Radio"), - - RICH_TEXT("RichText"), - - SLUG("Slug"), - - STOCK_PHOTO("StockPhoto"), - - TEXT_AREA("TextArea"); - - private final String value; - - StringFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java deleted file mode 100644 index 27b558a..0000000 --- a/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java +++ /dev/null @@ -1,603 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StringFieldPropertiesDto.Builder.class) -public final class StringFieldPropertiesDto { - private final Optional> defaultValues; - - private final Optional defaultValue; - - private final Optional pattern; - - private final Optional patternMessage; - - private final Optional folderId; - - private final Optional minLength; - - private final Optional maxLength; - - private final Optional minCharacters; - - private final Optional maxCharacters; - - private final Optional minWords; - - private final Optional maxWords; - - private final Optional> allowedValues; - - private final Optional> schemaIds; - - private final Optional isUnique; - - private final Optional isEmbeddable; - - private final Optional inlineEditable; - - private final Optional createEnum; - - private final Optional contentType; - - private final Optional editor; - - private StringFieldPropertiesDto( - Optional> defaultValues, - Optional defaultValue, - Optional pattern, - Optional patternMessage, - Optional folderId, - Optional minLength, - Optional maxLength, - Optional minCharacters, - Optional maxCharacters, - Optional minWords, - Optional maxWords, - Optional> allowedValues, - Optional> schemaIds, - Optional isUnique, - Optional isEmbeddable, - Optional inlineEditable, - Optional createEnum, - Optional contentType, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.pattern = pattern; - this.patternMessage = patternMessage; - this.folderId = folderId; - this.minLength = minLength; - this.maxLength = maxLength; - this.minCharacters = minCharacters; - this.maxCharacters = maxCharacters; - this.minWords = minWords; - this.maxWords = maxWords; - this.allowedValues = allowedValues; - this.schemaIds = schemaIds; - this.isUnique = isUnique; - this.isEmbeddable = isEmbeddable; - this.inlineEditable = inlineEditable; - this.createEnum = createEnum; - this.contentType = contentType; - this.editor = editor; - } - - @JsonProperty("defaultValues") - public Optional> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The pattern to enforce a specific format for the field value. - */ - @JsonProperty("pattern") - public Optional getPattern() { - return pattern; - } - - /** - * @return The validation message for the pattern. - */ - @JsonProperty("patternMessage") - public Optional getPatternMessage() { - return patternMessage; - } - - /** - * @return The initial id to the folder when the control supports file uploads. - */ - @JsonProperty("folderId") - public Optional getFolderId() { - return folderId; - } - - /** - * @return The minimum allowed length for the field value. - */ - @JsonProperty("minLength") - public Optional getMinLength() { - return minLength; - } - - /** - * @return The maximum allowed length for the field value. - */ - @JsonProperty("maxLength") - public Optional getMaxLength() { - return maxLength; - } - - /** - * @return The minimum allowed of normal characters for the field value. - */ - @JsonProperty("minCharacters") - public Optional getMinCharacters() { - return minCharacters; - } - - /** - * @return The maximum allowed of normal characters for the field value. - */ - @JsonProperty("maxCharacters") - public Optional getMaxCharacters() { - return maxCharacters; - } - - /** - * @return The minimum allowed number of words for the field value. - */ - @JsonProperty("minWords") - public Optional getMinWords() { - return minWords; - } - - /** - * @return The maximum allowed number of words for the field value. - */ - @JsonProperty("maxWords") - public Optional getMaxWords() { - return maxWords; - } - - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } - - /** - * @return The allowed schema ids that can be embedded. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return Indicates if the field value must be unique. Ignored for nested fields and localized fields. - */ - @JsonProperty("isUnique") - public Optional getIsUnique() { - return isUnique; - } - - /** - * @return Indicates that other content items or references are embedded. - */ - @JsonProperty("isEmbeddable") - public Optional getIsEmbeddable() { - return isEmbeddable; - } - - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; - } - - /** - * @return Indicates whether GraphQL Enum should be created. - */ - @JsonProperty("createEnum") - public Optional getCreateEnum() { - return createEnum; - } - - @JsonProperty("contentType") - public Optional getContentType() { - return contentType; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StringFieldPropertiesDto && equalTo((StringFieldPropertiesDto) other); - } - - private boolean equalTo(StringFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && pattern.equals(other.pattern) - && patternMessage.equals(other.patternMessage) - && folderId.equals(other.folderId) - && minLength.equals(other.minLength) - && maxLength.equals(other.maxLength) - && minCharacters.equals(other.minCharacters) - && maxCharacters.equals(other.maxCharacters) - && minWords.equals(other.minWords) - && maxWords.equals(other.maxWords) - && allowedValues.equals(other.allowedValues) - && schemaIds.equals(other.schemaIds) - && isUnique.equals(other.isUnique) - && isEmbeddable.equals(other.isEmbeddable) - && inlineEditable.equals(other.inlineEditable) - && createEnum.equals(other.createEnum) - && contentType.equals(other.contentType) - && editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.pattern, - this.patternMessage, - this.folderId, - this.minLength, - this.maxLength, - this.minCharacters, - this.maxCharacters, - this.minWords, - this.maxWords, - this.allowedValues, - this.schemaIds, - this.isUnique, - this.isEmbeddable, - this.inlineEditable, - this.createEnum, - this.contentType, - this.editor); - } - - @Override - public String toString() { - return "StringFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", pattern: " + pattern + ", patternMessage: " + patternMessage + ", folderId: " + folderId - + ", minLength: " + minLength + ", maxLength: " + maxLength + ", minCharacters: " + minCharacters - + ", maxCharacters: " + maxCharacters + ", minWords: " + minWords + ", maxWords: " + maxWords - + ", allowedValues: " + allowedValues + ", schemaIds: " + schemaIds + ", isUnique: " + isUnique - + ", isEmbeddable: " + isEmbeddable + ", inlineEditable: " + inlineEditable + ", createEnum: " - + createEnum + ", contentType: " + contentType + ", editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional pattern = Optional.empty(); - - private Optional patternMessage = Optional.empty(); - - private Optional folderId = Optional.empty(); - - private Optional minLength = Optional.empty(); - - private Optional maxLength = Optional.empty(); - - private Optional minCharacters = Optional.empty(); - - private Optional maxCharacters = Optional.empty(); - - private Optional minWords = Optional.empty(); - - private Optional maxWords = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Optional isUnique = Optional.empty(); - - private Optional isEmbeddable = Optional.empty(); - - private Optional inlineEditable = Optional.empty(); - - private Optional createEnum = Optional.empty(); - - private Optional contentType = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(StringFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - pattern(other.getPattern()); - patternMessage(other.getPatternMessage()); - folderId(other.getFolderId()); - minLength(other.getMinLength()); - maxLength(other.getMaxLength()); - minCharacters(other.getMinCharacters()); - maxCharacters(other.getMaxCharacters()); - minWords(other.getMinWords()); - maxWords(other.getMaxWords()); - allowedValues(other.getAllowedValues()); - schemaIds(other.getSchemaIds()); - isUnique(other.getIsUnique()); - isEmbeddable(other.getIsEmbeddable()); - inlineEditable(other.getInlineEditable()); - createEnum(other.getCreateEnum()); - contentType(other.getContentType()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(String defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "pattern", nulls = Nulls.SKIP) - public Builder pattern(Optional pattern) { - this.pattern = pattern; - return this; - } - - public Builder pattern(String pattern) { - this.pattern = Optional.of(pattern); - return this; - } - - @JsonSetter(value = "patternMessage", nulls = Nulls.SKIP) - public Builder patternMessage(Optional patternMessage) { - this.patternMessage = patternMessage; - return this; - } - - public Builder patternMessage(String patternMessage) { - this.patternMessage = Optional.of(patternMessage); - return this; - } - - @JsonSetter(value = "folderId", nulls = Nulls.SKIP) - public Builder folderId(Optional folderId) { - this.folderId = folderId; - return this; - } - - public Builder folderId(String folderId) { - this.folderId = Optional.of(folderId); - return this; - } - - @JsonSetter(value = "minLength", nulls = Nulls.SKIP) - public Builder minLength(Optional minLength) { - this.minLength = minLength; - return this; - } - - public Builder minLength(Integer minLength) { - this.minLength = Optional.of(minLength); - return this; - } - - @JsonSetter(value = "maxLength", nulls = Nulls.SKIP) - public Builder maxLength(Optional maxLength) { - this.maxLength = maxLength; - return this; - } - - public Builder maxLength(Integer maxLength) { - this.maxLength = Optional.of(maxLength); - return this; - } - - @JsonSetter(value = "minCharacters", nulls = Nulls.SKIP) - public Builder minCharacters(Optional minCharacters) { - this.minCharacters = minCharacters; - return this; - } - - public Builder minCharacters(Integer minCharacters) { - this.minCharacters = Optional.of(minCharacters); - return this; - } - - @JsonSetter(value = "maxCharacters", nulls = Nulls.SKIP) - public Builder maxCharacters(Optional maxCharacters) { - this.maxCharacters = maxCharacters; - return this; - } - - public Builder maxCharacters(Integer maxCharacters) { - this.maxCharacters = Optional.of(maxCharacters); - return this; - } - - @JsonSetter(value = "minWords", nulls = Nulls.SKIP) - public Builder minWords(Optional minWords) { - this.minWords = minWords; - return this; - } - - public Builder minWords(Integer minWords) { - this.minWords = Optional.of(minWords); - return this; - } - - @JsonSetter(value = "maxWords", nulls = Nulls.SKIP) - public Builder maxWords(Optional maxWords) { - this.maxWords = maxWords; - return this; - } - - public Builder maxWords(Integer maxWords) { - this.maxWords = Optional.of(maxWords); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @JsonSetter(value = "isUnique", nulls = Nulls.SKIP) - public Builder isUnique(Optional isUnique) { - this.isUnique = isUnique; - return this; - } - - public Builder isUnique(Boolean isUnique) { - this.isUnique = Optional.of(isUnique); - return this; - } - - @JsonSetter(value = "isEmbeddable", nulls = Nulls.SKIP) - public Builder isEmbeddable(Optional isEmbeddable) { - this.isEmbeddable = isEmbeddable; - return this; - } - - public Builder isEmbeddable(Boolean isEmbeddable) { - this.isEmbeddable = Optional.of(isEmbeddable); - return this; - } - - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; - } - - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; - } - - @JsonSetter(value = "createEnum", nulls = Nulls.SKIP) - public Builder createEnum(Optional createEnum) { - this.createEnum = createEnum; - return this; - } - - public Builder createEnum(Boolean createEnum) { - this.createEnum = Optional.of(createEnum); - return this; - } - - @JsonSetter(value = "contentType", nulls = Nulls.SKIP) - public Builder contentType(Optional contentType) { - this.contentType = contentType; - return this; - } - - public Builder contentType(StringContentType contentType) { - this.contentType = Optional.of(contentType); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(StringFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public StringFieldPropertiesDto build() { - return new StringFieldPropertiesDto( - defaultValues, - defaultValue, - pattern, - patternMessage, - folderId, - minLength, - maxLength, - minCharacters, - maxCharacters, - minWords, - maxWords, - allowedValues, - schemaIds, - isUnique, - isEmbeddable, - inlineEditable, - createEnum, - contentType, - editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TagsFieldEditor.java b/src/main/java/com/squidex/api/types/TagsFieldEditor.java deleted file mode 100644 index ea08fab..0000000 --- a/src/main/java/com/squidex/api/types/TagsFieldEditor.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum TagsFieldEditor { - TAGS("Tags"), - - CHECKBOXES("Checkboxes"), - - DROPDOWN("Dropdown"); - - private final String value; - - TagsFieldEditor(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java deleted file mode 100644 index 61f9a81..0000000 --- a/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TagsFieldPropertiesDto.Builder.class) -public final class TagsFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional> allowedValues; - - private final Optional createEnum; - - private final Optional editor; - - private TagsFieldPropertiesDto( - Optional>> defaultValues, - Optional> defaultValue, - Optional minItems, - Optional maxItems, - Optional> allowedValues, - Optional createEnum, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.minItems = minItems; - this.maxItems = maxItems; - this.allowedValues = allowedValues; - this.createEnum = createEnum; - this.editor = editor; - } - - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } - - /** - * @return Indicates whether GraphQL Enum should be created. - */ - @JsonProperty("createEnum") - public Optional getCreateEnum() { - return createEnum; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TagsFieldPropertiesDto && equalTo((TagsFieldPropertiesDto) other); - } - - private boolean equalTo(TagsFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && allowedValues.equals(other.allowedValues) - && createEnum.equals(other.createEnum) - && editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.minItems, - this.maxItems, - this.allowedValues, - this.createEnum, - this.editor); - } - - @Override - public String toString() { - return "TagsFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue - + ", minItems: " + minItems + ", maxItems: " + maxItems + ", allowedValues: " + allowedValues - + ", createEnum: " + createEnum + ", editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional createEnum = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(TagsFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - allowedValues(other.getAllowedValues()); - createEnum(other.getCreateEnum()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "createEnum", nulls = Nulls.SKIP) - public Builder createEnum(Optional createEnum) { - this.createEnum = createEnum; - return this; - } - - public Builder createEnum(Boolean createEnum) { - this.createEnum = Optional.of(createEnum); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(TagsFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public TagsFieldPropertiesDto build() { - return new TagsFieldPropertiesDto( - defaultValues, defaultValue, minItems, maxItems, allowedValues, createEnum, editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TeamDto.java b/src/main/java/com/squidex/api/types/TeamDto.java deleted file mode 100644 index 489fade..0000000 --- a/src/main/java/com/squidex/api/types/TeamDto.java +++ /dev/null @@ -1,310 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.time.OffsetDateTime; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TeamDto.Builder.class) -public final class TeamDto implements IResource { - private final Map links; - - private final String id; - - private final String name; - - private final int version; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final Optional roleName; - - private TeamDto( - Map links, - String id, - String name, - int version, - OffsetDateTime created, - OffsetDateTime lastModified, - Optional roleName) { - this.links = links; - this.id = id; - this.name = name; - this.version = version; - this.created = created; - this.lastModified = lastModified; - this.roleName = roleName; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the team. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The version of the team. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The timestamp when the team has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The timestamp when the team has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The role name of the user. - */ - @JsonProperty("roleName") - public Optional getRoleName() { - return roleName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TeamDto && equalTo((TeamDto) other); - } - - private boolean equalTo(TeamDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && version == other.version - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && roleName.equals(other.roleName); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.id, this.name, this.version, this.created, this.lastModified, this.roleName); - } - - @Override - public String toString() { - return "TeamDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", version: " + version - + ", created: " + created + ", lastModified: " + lastModified + ", roleName: " + roleName + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - NameStage id(String id); - - Builder from(TeamDto other); - } - - public interface NameStage { - VersionStage name(String name); - } - - public interface VersionStage { - CreatedStage version(int version); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - _FinalStage lastModified(OffsetDateTime lastModified); - } - - public interface _FinalStage { - TeamDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage roleName(Optional roleName); - - _FinalStage roleName(String roleName); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, NameStage, VersionStage, CreatedStage, LastModifiedStage, _FinalStage { - private String id; - - private String name; - - private int version; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private Optional roleName = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TeamDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - version(other.getVersion()); - created(other.getCreated()); - lastModified(other.getLastModified()); - roleName(other.getRoleName()); - return this; - } - - /** - *

The ID of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; - } - - /** - *

The name of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public VersionStage name(String name) { - this.name = name; - return this; - } - - /** - *

The version of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public CreatedStage version(int version) { - this.version = version; - return this; - } - - /** - *

The timestamp when the team has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The timestamp when the team has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public _FinalStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The role name of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleName(String roleName) { - this.roleName = Optional.of(roleName); - return this; - } - - @Override - @JsonSetter(value = "roleName", nulls = Nulls.SKIP) - public _FinalStage roleName(Optional roleName) { - this.roleName = roleName; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public TeamDto build() { - return new TeamDto(links, id, name, version, created, lastModified, roleName); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TemplateDetailsDto.java b/src/main/java/com/squidex/api/types/TemplateDetailsDto.java deleted file mode 100644 index b4dfb3e..0000000 --- a/src/main/java/com/squidex/api/types/TemplateDetailsDto.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplateDetailsDto.Builder.class) -public final class TemplateDetailsDto implements IResource { - private final Map links; - - private final String details; - - private TemplateDetailsDto(Map links, String details) { - this.links = links; - this.details = details; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The details of the template. - */ - @JsonProperty("details") - public String getDetails() { - return details; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplateDetailsDto && equalTo((TemplateDetailsDto) other); - } - - private boolean equalTo(TemplateDetailsDto other) { - return links.equals(other.links) && details.equals(other.details); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.details); - } - - @Override - public String toString() { - return "TemplateDetailsDto{" + "links: " + links + ", details: " + details + "}"; - } - - public static DetailsStage builder() { - return new Builder(); - } - - public interface DetailsStage { - _FinalStage details(String details); - - Builder from(TemplateDetailsDto other); - } - - public interface _FinalStage { - TemplateDetailsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DetailsStage, _FinalStage { - private String details; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TemplateDetailsDto other) { - links(other.getLinks()); - details(other.getDetails()); - return this; - } - - /** - *

The details of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("details") - public _FinalStage details(String details) { - this.details = details; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public TemplateDetailsDto build() { - return new TemplateDetailsDto(links, details); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TemplateDto.java b/src/main/java/com/squidex/api/types/TemplateDto.java deleted file mode 100644 index d745297..0000000 --- a/src/main/java/com/squidex/api/types/TemplateDto.java +++ /dev/null @@ -1,234 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplateDto.Builder.class) -public final class TemplateDto implements IResource { - private final Map links; - - private final String name; - - private final String title; - - private final String description; - - private final boolean isStarter; - - private TemplateDto( - Map links, String name, String title, String description, boolean isStarter) { - this.links = links; - this.name = name; - this.title = title; - this.description = description; - this.isStarter = isStarter; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The name of the template. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The title of the template. - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * @return The description of the template. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return True, if the template is a starter. - */ - @JsonProperty("isStarter") - public boolean getIsStarter() { - return isStarter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplateDto && equalTo((TemplateDto) other); - } - - private boolean equalTo(TemplateDto other) { - return links.equals(other.links) - && name.equals(other.name) - && title.equals(other.title) - && description.equals(other.description) - && isStarter == other.isStarter; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.name, this.title, this.description, this.isStarter); - } - - @Override - public String toString() { - return "TemplateDto{" + "links: " + links + ", name: " + name + ", title: " + title + ", description: " - + description + ", isStarter: " + isStarter + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - TitleStage name(String name); - - Builder from(TemplateDto other); - } - - public interface TitleStage { - DescriptionStage title(String title); - } - - public interface DescriptionStage { - IsStarterStage description(String description); - } - - public interface IsStarterStage { - _FinalStage isStarter(boolean isStarter); - } - - public interface _FinalStage { - TemplateDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TitleStage, DescriptionStage, IsStarterStage, _FinalStage { - private String name; - - private String title; - - private String description; - - private boolean isStarter; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TemplateDto other) { - links(other.getLinks()); - name(other.getName()); - title(other.getTitle()); - description(other.getDescription()); - isStarter(other.getIsStarter()); - return this; - } - - /** - *

The name of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TitleStage name(String name) { - this.name = name; - return this; - } - - /** - *

The title of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("title") - public DescriptionStage title(String title) { - this.title = title; - return this; - } - - /** - *

The description of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public IsStarterStage description(String description) { - this.description = description; - return this; - } - - /** - *

True, if the template is a starter.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isStarter") - public _FinalStage isStarter(boolean isStarter) { - this.isStarter = isStarter; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public TemplateDto build() { - return new TemplateDto(links, name, title, description, isStarter); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TemplatesDto.java b/src/main/java/com/squidex/api/types/TemplatesDto.java deleted file mode 100644 index f8ec459..0000000 --- a/src/main/java/com/squidex/api/types/TemplatesDto.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplatesDto.Builder.class) -public final class TemplatesDto implements IResource { - private final Map links; - - private final List items; - - private TemplatesDto(Map links, List items) { - this.links = links; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The event consumers. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplatesDto && equalTo((TemplatesDto) other); - } - - private boolean equalTo(TemplatesDto other) { - return links.equals(other.links) && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); - } - - @Override - public String toString() { - return "TemplatesDto{" + "links: " + links + ", items: " + items + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private Builder() {} - - public Builder from(TemplatesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(TemplateDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - public TemplatesDto build() { - return new TemplatesDto(links, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TranslationDto.java b/src/main/java/com/squidex/api/types/TranslationDto.java deleted file mode 100644 index d2751a7..0000000 --- a/src/main/java/com/squidex/api/types/TranslationDto.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TranslationDto.Builder.class) -public final class TranslationDto { - private final TranslationResultCode result; - - private final Optional text; - - private TranslationDto(TranslationResultCode result, Optional text) { - this.result = result; - this.text = text; - } - - @JsonProperty("result") - public TranslationResultCode getResult() { - return result; - } - - /** - * @return The translated text. - */ - @JsonProperty("text") - public Optional getText() { - return text; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TranslationDto && equalTo((TranslationDto) other); - } - - private boolean equalTo(TranslationDto other) { - return result.equals(other.result) && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.result, this.text); - } - - @Override - public String toString() { - return "TranslationDto{" + "result: " + result + ", text: " + text + "}"; - } - - public static ResultStage builder() { - return new Builder(); - } - - public interface ResultStage { - _FinalStage result(TranslationResultCode result); - - Builder from(TranslationDto other); - } - - public interface _FinalStage { - TranslationDto build(); - - _FinalStage text(Optional text); - - _FinalStage text(String text); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ResultStage, _FinalStage { - private TranslationResultCode result; - - private Optional text = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(TranslationDto other) { - result(other.getResult()); - text(other.getText()); - return this; - } - - @Override - @JsonSetter("result") - public _FinalStage result(TranslationResultCode result) { - this.result = result; - return this; - } - - /** - *

The translated text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage text(String text) { - this.text = Optional.of(text); - return this; - } - - @Override - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public _FinalStage text(Optional text) { - this.text = text; - return this; - } - - @Override - public TranslationDto build() { - return new TranslationDto(result, text); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TranslationResultCode.java b/src/main/java/com/squidex/api/types/TranslationResultCode.java deleted file mode 100644 index f52c479..0000000 --- a/src/main/java/com/squidex/api/types/TranslationResultCode.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum TranslationResultCode { - TRANSLATED("Translated"), - - LANGUAGE_NOT_SUPPORTED("LanguageNotSupported"), - - NOT_TRANSLATED("NotTranslated"), - - NOT_CONFIGURED("NotConfigured"), - - UNAUTHORIZED("Unauthorized"), - - FAILED("Failed"); - - private final String value; - - TranslationResultCode(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/TweetRuleActionDto.java b/src/main/java/com/squidex/api/types/TweetRuleActionDto.java deleted file mode 100644 index 77ad8be..0000000 --- a/src/main/java/com/squidex/api/types/TweetRuleActionDto.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TweetRuleActionDto.Builder.class) -public final class TweetRuleActionDto { - private final String accessToken; - - private final String accessSecret; - - private final String text; - - private TweetRuleActionDto(String accessToken, String accessSecret, String text) { - this.accessToken = accessToken; - this.accessSecret = accessSecret; - this.text = text; - } - - /** - * @return The generated access token. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("accessToken") - public String getAccessToken() { - return accessToken; - } - - /** - * @return The generated access secret. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("accessSecret") - public String getAccessSecret() { - return accessSecret; - } - - /** - * @return The text that is sent as tweet to twitter. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TweetRuleActionDto && equalTo((TweetRuleActionDto) other); - } - - private boolean equalTo(TweetRuleActionDto other) { - return accessToken.equals(other.accessToken) - && accessSecret.equals(other.accessSecret) - && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.accessToken, this.accessSecret, this.text); - } - - @Override - public String toString() { - return "TweetRuleActionDto{" + "accessToken: " + accessToken + ", accessSecret: " + accessSecret + ", text: " - + text + "}"; - } - - public static AccessTokenStage builder() { - return new Builder(); - } - - public interface AccessTokenStage { - AccessSecretStage accessToken(String accessToken); - - Builder from(TweetRuleActionDto other); - } - - public interface AccessSecretStage { - TextStage accessSecret(String accessSecret); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - TweetRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccessTokenStage, AccessSecretStage, TextStage, _FinalStage { - private String accessToken; - - private String accessSecret; - - private String text; - - private Builder() {} - - @Override - public Builder from(TweetRuleActionDto other) { - accessToken(other.getAccessToken()); - accessSecret(other.getAccessSecret()); - text(other.getText()); - return this; - } - - /** - *

The generated access token. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessToken") - public AccessSecretStage accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - *

The generated access secret. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessSecret") - public TextStage accessSecret(String accessSecret) { - this.accessSecret = accessSecret; - return this; - } - - /** - *

The text that is sent as tweet to twitter. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - @Override - public TweetRuleActionDto build() { - return new TweetRuleActionDto(accessToken, accessSecret, text); - } - } -} diff --git a/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java b/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java deleted file mode 100644 index 2f741e6..0000000 --- a/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TypesenseRuleActionDto.Builder.class) -public final class TypesenseRuleActionDto { - private final String host; - - private final String indexName; - - private final String apiKey; - - private final Optional document; - - private final Optional delete; - - private TypesenseRuleActionDto( - String host, String indexName, String apiKey, Optional document, Optional delete) { - this.host = host; - this.indexName = indexName; - this.apiKey = apiKey; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The api key. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TypesenseRuleActionDto && equalTo((TypesenseRuleActionDto) other); - } - - private boolean equalTo(TypesenseRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && apiKey.equals(other.apiKey) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.apiKey, this.document, this.delete); - } - - @Override - public String toString() { - return "TypesenseRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", apiKey: " + apiKey - + ", document: " + document + ", delete: " + delete + "}"; - } - - public static HostStage builder() { - return new Builder(); - } - - public interface HostStage { - IndexNameStage host(String host); - - Builder from(TypesenseRuleActionDto other); - } - - public interface IndexNameStage { - ApiKeyStage indexName(String indexName); - } - - public interface ApiKeyStage { - _FinalStage apiKey(String apiKey); - } - - public interface _FinalStage { - TypesenseRuleActionDto build(); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, ApiKeyStage, _FinalStage { - private String host; - - private String indexName; - - private String apiKey; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(TypesenseRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - apiKey(other.getApiKey()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; - } - - /** - *

The name of the index. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public ApiKeyStage indexName(String indexName) { - this.indexName = indexName; - return this; - } - - /** - *

The api key. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public _FinalStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - @Override - public TypesenseRuleActionDto build() { - return new TypesenseRuleActionDto(host, indexName, apiKey, document, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java deleted file mode 100644 index d1e6db8..0000000 --- a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UiFieldPropertiesDto.Builder.class) -public final class UiFieldPropertiesDto { - private final Optional editor; - - private UiFieldPropertiesDto(Optional editor) { - this.editor = editor; - } - - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UiFieldPropertiesDto && equalTo((UiFieldPropertiesDto) other); - } - - private boolean equalTo(UiFieldPropertiesDto other) { - return editor.equals(other.editor); - } - - @Override - public int hashCode() { - return Objects.hash(this.editor); - } - - @Override - public String toString() { - return "UiFieldPropertiesDto{" + "editor: " + editor + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(UiFieldPropertiesDto other) { - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(String editor) { - this.editor = Optional.of(editor); - return this; - } - - public UiFieldPropertiesDto build() { - return new UiFieldPropertiesDto(editor); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UiSettingsDto.java b/src/main/java/com/squidex/api/types/UiSettingsDto.java deleted file mode 100644 index a6a9478..0000000 --- a/src/main/java/com/squidex/api/types/UiSettingsDto.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UiSettingsDto.Builder.class) -public final class UiSettingsDto { - private final boolean canCreateApps; - - private final boolean canCreateTeams; - - private UiSettingsDto(boolean canCreateApps, boolean canCreateTeams) { - this.canCreateApps = canCreateApps; - this.canCreateTeams = canCreateTeams; - } - - /** - * @return True when the user can create apps. - */ - @JsonProperty("canCreateApps") - public boolean getCanCreateApps() { - return canCreateApps; - } - - /** - * @return True when the user can create teams. - */ - @JsonProperty("canCreateTeams") - public boolean getCanCreateTeams() { - return canCreateTeams; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UiSettingsDto && equalTo((UiSettingsDto) other); - } - - private boolean equalTo(UiSettingsDto other) { - return canCreateApps == other.canCreateApps && canCreateTeams == other.canCreateTeams; - } - - @Override - public int hashCode() { - return Objects.hash(this.canCreateApps, this.canCreateTeams); - } - - @Override - public String toString() { - return "UiSettingsDto{" + "canCreateApps: " + canCreateApps + ", canCreateTeams: " + canCreateTeams + "}"; - } - - public static CanCreateAppsStage builder() { - return new Builder(); - } - - public interface CanCreateAppsStage { - CanCreateTeamsStage canCreateApps(boolean canCreateApps); - - Builder from(UiSettingsDto other); - } - - public interface CanCreateTeamsStage { - _FinalStage canCreateTeams(boolean canCreateTeams); - } - - public interface _FinalStage { - UiSettingsDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CanCreateAppsStage, CanCreateTeamsStage, _FinalStage { - private boolean canCreateApps; - - private boolean canCreateTeams; - - private Builder() {} - - @Override - public Builder from(UiSettingsDto other) { - canCreateApps(other.getCanCreateApps()); - canCreateTeams(other.getCanCreateTeams()); - return this; - } - - /** - *

True when the user can create apps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canCreateApps") - public CanCreateTeamsStage canCreateApps(boolean canCreateApps) { - this.canCreateApps = canCreateApps; - return this; - } - - /** - *

True when the user can create teams.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canCreateTeams") - public _FinalStage canCreateTeams(boolean canCreateTeams) { - this.canCreateTeams = canCreateTeams; - return this; - } - - @Override - public UiSettingsDto build() { - return new UiSettingsDto(canCreateApps, canCreateTeams); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpdateFieldDto.java b/src/main/java/com/squidex/api/types/UpdateFieldDto.java deleted file mode 100644 index d081fb0..0000000 --- a/src/main/java/com/squidex/api/types/UpdateFieldDto.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateFieldDto.Builder.class) -public final class UpdateFieldDto { - private final FieldPropertiesDto properties; - - private UpdateFieldDto(FieldPropertiesDto properties) { - this.properties = properties; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateFieldDto && equalTo((UpdateFieldDto) other); - } - - private boolean equalTo(UpdateFieldDto other) { - return properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.properties); - } - - @Override - public String toString() { - return "UpdateFieldDto{" + "properties: " + properties + "}"; - } - - public static PropertiesStage builder() { - return new Builder(); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - - Builder from(UpdateFieldDto other); - } - - public interface _FinalStage { - UpdateFieldDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PropertiesStage, _FinalStage { - private FieldPropertiesDto properties; - - private Builder() {} - - @Override - public Builder from(UpdateFieldDto other) { - properties(other.getProperties()); - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - @Override - public UpdateFieldDto build() { - return new UpdateFieldDto(properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpdateSettingDto.java b/src/main/java/com/squidex/api/types/UpdateSettingDto.java deleted file mode 100644 index 88f0c2d..0000000 --- a/src/main/java/com/squidex/api/types/UpdateSettingDto.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateSettingDto.Builder.class) -public final class UpdateSettingDto { - private final Object value; - - private UpdateSettingDto(Object value) { - this.value = value; - } - - @JsonProperty("value") - public Object getValue() { - return value; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSettingDto && equalTo((UpdateSettingDto) other); - } - - private boolean equalTo(UpdateSettingDto other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "UpdateSettingDto{" + "value: " + value + "}"; - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - _FinalStage value(Object value); - - Builder from(UpdateSettingDto other); - } - - public interface _FinalStage { - UpdateSettingDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ValueStage, _FinalStage { - private Object value; - - private Builder() {} - - @Override - public Builder from(UpdateSettingDto other) { - value(other.getValue()); - return this; - } - - @Override - @JsonSetter("value") - public _FinalStage value(Object value) { - this.value = value; - return this; - } - - @Override - public UpdateSettingDto build() { - return new UpdateSettingDto(value); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpsertCommentDto.java b/src/main/java/com/squidex/api/types/UpsertCommentDto.java deleted file mode 100644 index 08841b0..0000000 --- a/src/main/java/com/squidex/api/types/UpsertCommentDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertCommentDto.Builder.class) -public final class UpsertCommentDto { - private final String text; - - private final Optional url; - - private UpsertCommentDto(String text, Optional url) { - this.text = text; - this.url = url; - } - - /** - * @return The comment text. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The url where the comment is created. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertCommentDto && equalTo((UpsertCommentDto) other); - } - - private boolean equalTo(UpsertCommentDto other) { - return text.equals(other.text) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.text, this.url); - } - - @Override - public String toString() { - return "UpsertCommentDto{" + "text: " + text + ", url: " + url + "}"; - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - _FinalStage text(String text); - - Builder from(UpsertCommentDto other); - } - - public interface _FinalStage { - UpsertCommentDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertCommentDto other) { - text(other.getText()); - url(other.getUrl()); - return this; - } - - /** - *

The comment text. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

The url where the comment is created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public UpsertCommentDto build() { - return new UpsertCommentDto(text, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaDto.java deleted file mode 100644 index 6d5a5f6..0000000 --- a/src/main/java/com/squidex/api/types/UpsertSchemaDto.java +++ /dev/null @@ -1,322 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaDto.Builder.class) -public final class UpsertSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private UpsertSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - } - - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; - } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; - } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; - } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; - } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaDto && equalTo((UpsertSchemaDto) other); - } - - private boolean equalTo(UpsertSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished); - } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished); - } - - @Override - public String toString() { - return "UpsertSchemaDto{" + "properties: " + properties + ", scripts: " + scripts + ", fieldsInReferences: " - + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " + fields + ", previewUrls: " - + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category + ", isPublished: " - + isPublished + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional properties = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Builder() {} - - public Builder from(UpsertSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - return this; - } - - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional properties) { - this.properties = properties; - return this; - } - - public Builder properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public Builder scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - public Builder scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public Builder fields(Optional> fields) { - this.fields = fields; - return this; - } - - public Builder fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public Builder previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - public Builder previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { - this.category = category; - return this; - } - - public Builder category(String category) { - this.category = Optional.of(category); - return this; - } - - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public Builder isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - public Builder isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - public UpsertSchemaDto build() { - return new UpsertSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java deleted file mode 100644 index 287f91b..0000000 --- a/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaFieldDto.Builder.class) -public final class UpsertSchemaFieldDto { - private final String name; - - private final Optional isHidden; - - private final Optional isLocked; - - private final Optional isDisabled; - - private final Optional partitioning; - - private final FieldPropertiesDto properties; - - private final Optional> nested; - - private UpsertSchemaFieldDto( - String name, - Optional isHidden, - Optional isLocked, - Optional isDisabled, - Optional partitioning, - FieldPropertiesDto properties, - Optional> nested) { - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.partitioning = partitioning; - this.properties = properties; - this.nested = nested; - } - - /** - * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public Optional getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public Optional getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public Optional getIsDisabled() { - return isDisabled; - } - - /** - * @return Determines the optional partitioning of the field. - */ - @JsonProperty("partitioning") - public Optional getPartitioning() { - return partitioning; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - /** - * @return The nested fields. - */ - @JsonProperty("nested") - public Optional> getNested() { - return nested; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaFieldDto && equalTo((UpsertSchemaFieldDto) other); - } - - private boolean equalTo(UpsertSchemaFieldDto other) { - return name.equals(other.name) - && isHidden.equals(other.isHidden) - && isLocked.equals(other.isLocked) - && isDisabled.equals(other.isDisabled) - && partitioning.equals(other.partitioning) - && properties.equals(other.properties) - && nested.equals(other.nested); - } - - @Override - public int hashCode() { - return Objects.hash( - this.name, - this.isHidden, - this.isLocked, - this.isDisabled, - this.partitioning, - this.properties, - this.nested); - } - - @Override - public String toString() { - return "UpsertSchemaFieldDto{" + "name: " + name + ", isHidden: " + isHidden + ", isLocked: " + isLocked - + ", isDisabled: " + isDisabled + ", partitioning: " + partitioning + ", properties: " + properties - + ", nested: " + nested + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - PropertiesStage name(String name); - - Builder from(UpsertSchemaFieldDto other); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - } - - public interface _FinalStage { - UpsertSchemaFieldDto build(); - - _FinalStage isHidden(Optional isHidden); - - _FinalStage isHidden(Boolean isHidden); - - _FinalStage isLocked(Optional isLocked); - - _FinalStage isLocked(Boolean isLocked); - - _FinalStage isDisabled(Optional isDisabled); - - _FinalStage isDisabled(Boolean isDisabled); - - _FinalStage partitioning(Optional partitioning); - - _FinalStage partitioning(String partitioning); - - _FinalStage nested(Optional> nested); - - _FinalStage nested(List nested); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - - private FieldPropertiesDto properties; - - private Optional> nested = Optional.empty(); - - private Optional partitioning = Optional.empty(); - - private Optional isDisabled = Optional.empty(); - - private Optional isLocked = Optional.empty(); - - private Optional isHidden = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertSchemaFieldDto other) { - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - nested(other.getNested()); - return this; - } - - /** - *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

The nested fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nested(List nested) { - this.nested = Optional.of(nested); - return this; - } - - @Override - @JsonSetter(value = "nested", nulls = Nulls.SKIP) - public _FinalStage nested(Optional> nested) { - this.nested = nested; - return this; - } - - /** - *

Determines the optional partitioning of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage partitioning(String partitioning) { - this.partitioning = Optional.of(partitioning); - return this; - } - - @Override - @JsonSetter(value = "partitioning", nulls = Nulls.SKIP) - public _FinalStage partitioning(Optional partitioning) { - this.partitioning = partitioning; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isDisabled(Boolean isDisabled) { - this.isDisabled = Optional.of(isDisabled); - return this; - } - - @Override - @JsonSetter(value = "isDisabled", nulls = Nulls.SKIP) - public _FinalStage isDisabled(Optional isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isLocked(Boolean isLocked) { - this.isLocked = Optional.of(isLocked); - return this; - } - - @Override - @JsonSetter(value = "isLocked", nulls = Nulls.SKIP) - public _FinalStage isLocked(Optional isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isHidden(Boolean isHidden) { - this.isHidden = Optional.of(isHidden); - return this; - } - - @Override - @JsonSetter(value = "isHidden", nulls = Nulls.SKIP) - public _FinalStage isHidden(Optional isHidden) { - this.isHidden = isHidden; - return this; - } - - @Override - public UpsertSchemaFieldDto build() { - return new UpsertSchemaFieldDto(name, isHidden, isLocked, isDisabled, partitioning, properties, nested); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java deleted file mode 100644 index f1e50f5..0000000 --- a/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaNestedFieldDto.Builder.class) -public final class UpsertSchemaNestedFieldDto { - private final String name; - - private final Optional isHidden; - - private final Optional isLocked; - - private final Optional isDisabled; - - private final FieldPropertiesDto properties; - - private UpsertSchemaNestedFieldDto( - String name, - Optional isHidden, - Optional isLocked, - Optional isDisabled, - FieldPropertiesDto properties) { - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.properties = properties; - } - - /** - * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public Optional getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public Optional getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public Optional getIsDisabled() { - return isDisabled; - } - - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaNestedFieldDto && equalTo((UpsertSchemaNestedFieldDto) other); - } - - private boolean equalTo(UpsertSchemaNestedFieldDto other) { - return name.equals(other.name) - && isHidden.equals(other.isHidden) - && isLocked.equals(other.isLocked) - && isDisabled.equals(other.isDisabled) - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.isHidden, this.isLocked, this.isDisabled, this.properties); - } - - @Override - public String toString() { - return "UpsertSchemaNestedFieldDto{" + "name: " + name + ", isHidden: " + isHidden + ", isLocked: " + isLocked - + ", isDisabled: " + isDisabled + ", properties: " + properties + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - PropertiesStage name(String name); - - Builder from(UpsertSchemaNestedFieldDto other); - } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - } - - public interface _FinalStage { - UpsertSchemaNestedFieldDto build(); - - _FinalStage isHidden(Optional isHidden); - - _FinalStage isHidden(Boolean isHidden); - - _FinalStage isLocked(Optional isLocked); - - _FinalStage isLocked(Boolean isLocked); - - _FinalStage isDisabled(Optional isDisabled); - - _FinalStage isDisabled(Boolean isDisabled); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - - private FieldPropertiesDto properties; - - private Optional isDisabled = Optional.empty(); - - private Optional isLocked = Optional.empty(); - - private Optional isHidden = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertSchemaNestedFieldDto other) { - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - properties(other.getProperties()); - return this; - } - - /** - *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; - } - - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isDisabled(Boolean isDisabled) { - this.isDisabled = Optional.of(isDisabled); - return this; - } - - @Override - @JsonSetter(value = "isDisabled", nulls = Nulls.SKIP) - public _FinalStage isDisabled(Optional isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isLocked(Boolean isLocked) { - this.isLocked = Optional.of(isLocked); - return this; - } - - @Override - @JsonSetter(value = "isLocked", nulls = Nulls.SKIP) - public _FinalStage isLocked(Optional isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isHidden(Boolean isHidden) { - this.isHidden = Optional.of(isHidden); - return this; - } - - @Override - @JsonSetter(value = "isHidden", nulls = Nulls.SKIP) - public _FinalStage isHidden(Optional isHidden) { - this.isHidden = isHidden; - return this; - } - - @Override - public UpsertSchemaNestedFieldDto build() { - return new UpsertSchemaNestedFieldDto(name, isHidden, isLocked, isDisabled, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java b/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java deleted file mode 100644 index f6a5e26..0000000 --- a/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsageRuleTriggerDto.Builder.class) -public final class UsageRuleTriggerDto { - private final int limit; - - private final Optional numDays; - - private UsageRuleTriggerDto(int limit, Optional numDays) { - this.limit = limit; - this.numDays = numDays; - } - - /** - * @return The number of monthly api calls. - */ - @JsonProperty("limit") - public int getLimit() { - return limit; - } - - /** - * @return The number of days to check or null for the current month. - */ - @JsonProperty("numDays") - public Optional getNumDays() { - return numDays; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageRuleTriggerDto && equalTo((UsageRuleTriggerDto) other); - } - - private boolean equalTo(UsageRuleTriggerDto other) { - return limit == other.limit && numDays.equals(other.numDays); - } - - @Override - public int hashCode() { - return Objects.hash(this.limit, this.numDays); - } - - @Override - public String toString() { - return "UsageRuleTriggerDto{" + "limit: " + limit + ", numDays: " + numDays + "}"; - } - - public static LimitStage builder() { - return new Builder(); - } - - public interface LimitStage { - _FinalStage limit(int limit); - - Builder from(UsageRuleTriggerDto other); - } - - public interface _FinalStage { - UsageRuleTriggerDto build(); - - _FinalStage numDays(Optional numDays); - - _FinalStage numDays(Integer numDays); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LimitStage, _FinalStage { - private int limit; - - private Optional numDays = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UsageRuleTriggerDto other) { - limit(other.getLimit()); - numDays(other.getNumDays()); - return this; - } - - /** - *

The number of monthly api calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("limit") - public _FinalStage limit(int limit) { - this.limit = limit; - return this; - } - - /** - *

The number of days to check or null for the current month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage numDays(Integer numDays) { - this.numDays = Optional.of(numDays); - return this; - } - - @Override - @JsonSetter(value = "numDays", nulls = Nulls.SKIP) - public _FinalStage numDays(Optional numDays) { - this.numDays = numDays; - return this; - } - - @Override - public UsageRuleTriggerDto build() { - return new UsageRuleTriggerDto(limit, numDays); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UserDto.java b/src/main/java/com/squidex/api/types/UserDto.java deleted file mode 100644 index 6fa8995..0000000 --- a/src/main/java/com/squidex/api/types/UserDto.java +++ /dev/null @@ -1,290 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserDto.Builder.class) -public final class UserDto implements IResource { - private final Map links; - - private final String id; - - private final String email; - - private final String displayName; - - private final boolean isLocked; - - private final List permissions; - - private UserDto( - Map links, - String id, - String email, - String displayName, - boolean isLocked, - List permissions) { - this.links = links; - this.id = id; - this.email = email; - this.displayName = displayName; - this.isLocked = isLocked; - this.permissions = permissions; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the user. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The email of the user. Unique value. - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The display name (usually first name and last name) of the user. - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return Determines if the user is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserDto && equalTo((UserDto) other); - } - - private boolean equalTo(UserDto other) { - return links.equals(other.links) - && id.equals(other.id) - && email.equals(other.email) - && displayName.equals(other.displayName) - && isLocked == other.isLocked - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.email, this.displayName, this.isLocked, this.permissions); - } - - @Override - public String toString() { - return "UserDto{" + "links: " + links + ", id: " + id + ", email: " + email + ", displayName: " + displayName - + ", isLocked: " + isLocked + ", permissions: " + permissions + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - EmailStage id(String id); - - Builder from(UserDto other); - } - - public interface EmailStage { - DisplayNameStage email(String email); - } - - public interface DisplayNameStage { - IsLockedStage displayName(String displayName); - } - - public interface IsLockedStage { - _FinalStage isLocked(boolean isLocked); - } - - public interface _FinalStage { - UserDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, EmailStage, DisplayNameStage, IsLockedStage, _FinalStage { - private String id; - - private String email; - - private String displayName; - - private boolean isLocked; - - private List permissions = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(UserDto other) { - links(other.getLinks()); - id(other.getId()); - email(other.getEmail()); - displayName(other.getDisplayName()); - isLocked(other.getIsLocked()); - permissions(other.getPermissions()); - return this; - } - - /** - *

The ID of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public EmailStage id(String id) { - this.id = id; - return this; - } - - /** - *

The email of the user. Unique value.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public IsLockedStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

Determines if the user is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public _FinalStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public UserDto build() { - return new UserDto(links, id, email, displayName, isLocked, permissions); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UserProperty.java b/src/main/java/com/squidex/api/types/UserProperty.java deleted file mode 100644 index b04b629..0000000 --- a/src/main/java/com/squidex/api/types/UserProperty.java +++ /dev/null @@ -1,118 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserProperty.Builder.class) -public final class UserProperty { - private final String name; - - private final String value; - - private UserProperty(String name, String value) { - this.name = name; - this.value = value; - } - - /** - * @return <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("value") - public String getValue() { - return value; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserProperty && equalTo((UserProperty) other); - } - - private boolean equalTo(UserProperty other) { - return name.equals(other.name) && value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.value); - } - - @Override - public String toString() { - return "UserProperty{" + "name: " + name + ", value: " + value + "}"; - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - ValueStage name(String name); - - Builder from(UserProperty other); - } - - public interface ValueStage { - _FinalStage value(String value); - } - - public interface _FinalStage { - UserProperty build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, ValueStage, _FinalStage { - private String name; - - private String value; - - private Builder() {} - - @Override - public Builder from(UserProperty other) { - name(other.getName()); - value(other.getValue()); - return this; - } - - /** - *

<span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public ValueStage name(String name) { - this.name = name; - return this; - } - - /** - *

<span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("value") - public _FinalStage value(String value) { - this.value = value; - return this; - } - - @Override - public UserProperty build() { - return new UserProperty(name, value); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UsersDto.java b/src/main/java/com/squidex/api/types/UsersDto.java deleted file mode 100644 index 4401ed7..0000000 --- a/src/main/java/com/squidex/api/types/UsersDto.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsersDto.Builder.class) -public final class UsersDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private UsersDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of users. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The users. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsersDto && equalTo((UsersDto) other); - } - - private boolean equalTo(UsersDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); - } - - @Override - public String toString() { - return "UsersDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; - } - - public static TotalStage builder() { - return new Builder(); - } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(UsersDto other); - } - - public interface _FinalStage { - UsersDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(UserDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(UsersDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; - } - - /** - *

The total number of users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

The users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(UserDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public UsersDto build() { - return new UsersDto(links, total, items); - } - } -} diff --git a/src/main/java/com/squidex/api/types/WebhookMethod.java b/src/main/java/com/squidex/api/types/WebhookMethod.java deleted file mode 100644 index 6fe9654..0000000 --- a/src/main/java/com/squidex/api/types/WebhookMethod.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum WebhookMethod { - POST("POST"), - - PUT("PUT"), - - GET("GET"), - - DELETE("DELETE"), - - PATCH("PATCH"); - - private final String value; - - WebhookMethod(String value) { - this.value = value; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java b/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java deleted file mode 100644 index 5c3e45c..0000000 --- a/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java +++ /dev/null @@ -1,265 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WebhookRuleActionDto.Builder.class) -public final class WebhookRuleActionDto { - private final String url; - - private final WebhookMethod method; - - private final Optional payload; - - private final Optional payloadType; - - private final Optional headers; - - private final Optional sharedSecret; - - private WebhookRuleActionDto( - String url, - WebhookMethod method, - Optional payload, - Optional payloadType, - Optional headers, - Optional sharedSecret) { - this.url = url; - this.method = method; - this.payload = payload; - this.payloadType = payloadType; - this.headers = headers; - this.sharedSecret = sharedSecret; - } - - /** - * @return The url to the webhook. <span style="white-space: nowrap">non-empty</span> - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @JsonProperty("method") - public WebhookMethod getMethod() { - return method; - } - - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } - - /** - * @return The mime type of the payload. - */ - @JsonProperty("payloadType") - public Optional getPayloadType() { - return payloadType; - } - - /** - * @return The message headers in the format '[Key]=[Value]', one entry per line. - */ - @JsonProperty("headers") - public Optional getHeaders() { - return headers; - } - - /** - * @return The shared secret that is used to calculate the payload signature. - */ - @JsonProperty("sharedSecret") - public Optional getSharedSecret() { - return sharedSecret; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WebhookRuleActionDto && equalTo((WebhookRuleActionDto) other); - } - - private boolean equalTo(WebhookRuleActionDto other) { - return url.equals(other.url) - && method.equals(other.method) - && payload.equals(other.payload) - && payloadType.equals(other.payloadType) - && headers.equals(other.headers) - && sharedSecret.equals(other.sharedSecret); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.method, this.payload, this.payloadType, this.headers, this.sharedSecret); - } - - @Override - public String toString() { - return "WebhookRuleActionDto{" + "url: " + url + ", method: " + method + ", payload: " + payload - + ", payloadType: " + payloadType + ", headers: " + headers + ", sharedSecret: " + sharedSecret + "}"; - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - MethodStage url(String url); - - Builder from(WebhookRuleActionDto other); - } - - public interface MethodStage { - _FinalStage method(WebhookMethod method); - } - - public interface _FinalStage { - WebhookRuleActionDto build(); - - _FinalStage payload(Optional payload); - - _FinalStage payload(String payload); - - _FinalStage payloadType(Optional payloadType); - - _FinalStage payloadType(String payloadType); - - _FinalStage headers(Optional headers); - - _FinalStage headers(String headers); - - _FinalStage sharedSecret(Optional sharedSecret); - - _FinalStage sharedSecret(String sharedSecret); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, MethodStage, _FinalStage { - private String url; - - private WebhookMethod method; - - private Optional sharedSecret = Optional.empty(); - - private Optional headers = Optional.empty(); - - private Optional payloadType = Optional.empty(); - - private Optional payload = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(WebhookRuleActionDto other) { - url(other.getUrl()); - method(other.getMethod()); - payload(other.getPayload()); - payloadType(other.getPayloadType()); - headers(other.getHeaders()); - sharedSecret(other.getSharedSecret()); - return this; - } - - /** - *

The url to the webhook. <span style="white-space: nowrap">non-empty</span>

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public MethodStage url(String url) { - this.url = url; - return this; - } - - @Override - @JsonSetter("method") - public _FinalStage method(WebhookMethod method) { - this.method = method; - return this; - } - - /** - *

The shared secret that is used to calculate the payload signature.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage sharedSecret(String sharedSecret) { - this.sharedSecret = Optional.of(sharedSecret); - return this; - } - - @Override - @JsonSetter(value = "sharedSecret", nulls = Nulls.SKIP) - public _FinalStage sharedSecret(Optional sharedSecret) { - this.sharedSecret = sharedSecret; - return this; - } - - /** - *

The message headers in the format '[Key]=[Value]', one entry per line.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage headers(String headers) { - this.headers = Optional.of(headers); - return this; - } - - @Override - @JsonSetter(value = "headers", nulls = Nulls.SKIP) - public _FinalStage headers(Optional headers) { - this.headers = headers; - return this; - } - - /** - *

The mime type of the payload.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payloadType(String payloadType) { - this.payloadType = Optional.of(payloadType); - return this; - } - - @Override - @JsonSetter(value = "payloadType", nulls = Nulls.SKIP) - public _FinalStage payloadType(Optional payloadType) { - this.payloadType = payloadType; - return this; - } - - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } - - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } - - @Override - public WebhookRuleActionDto build() { - return new WebhookRuleActionDto(url, method, payload, payloadType, headers, sharedSecret); - } - } -} diff --git a/src/main/java/com/squidex/api/types/WorkflowDto.java b/src/main/java/com/squidex/api/types/WorkflowDto.java deleted file mode 100644 index 7e7ce28..0000000 --- a/src/main/java/com/squidex/api/types/WorkflowDto.java +++ /dev/null @@ -1,302 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowDto.Builder.class) -public final class WorkflowDto implements IResource { - private final Map links; - - private final String id; - - private final Optional name; - - private final Map steps; - - private final Optional> schemaIds; - - private final String initial; - - private WorkflowDto( - Map links, - String id, - Optional name, - Map steps, - Optional> schemaIds, - String initial) { - this.links = links; - this.id = id; - this.name = name; - this.steps = steps; - this.schemaIds = schemaIds; - this.initial = initial; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The workflow id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the workflow. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The workflow steps. - */ - @JsonProperty("steps") - public Map getSteps() { - return steps; - } - - /** - * @return The schema ids. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return The initial step. - */ - @JsonProperty("initial") - public String getInitial() { - return initial; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowDto && equalTo((WorkflowDto) other); - } - - private boolean equalTo(WorkflowDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && steps.equals(other.steps) - && schemaIds.equals(other.schemaIds) - && initial.equals(other.initial); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.name, this.steps, this.schemaIds, this.initial); - } - - @Override - public String toString() { - return "WorkflowDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", steps: " + steps - + ", schemaIds: " + schemaIds + ", initial: " + initial + "}"; - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - InitialStage id(String id); - - Builder from(WorkflowDto other); - } - - public interface InitialStage { - _FinalStage initial(String initial); - } - - public interface _FinalStage { - WorkflowDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage steps(Map steps); - - _FinalStage putAllSteps(Map steps); - - _FinalStage steps(String key, WorkflowStepDto value); - - _FinalStage schemaIds(Optional> schemaIds); - - _FinalStage schemaIds(List schemaIds); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, InitialStage, _FinalStage { - private String id; - - private String initial; - - private Optional> schemaIds = Optional.empty(); - - private Map steps = new LinkedHashMap<>(); - - private Optional name = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(WorkflowDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - steps(other.getSteps()); - schemaIds(other.getSchemaIds()); - initial(other.getInitial()); - return this; - } - - /** - *

The workflow id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public InitialStage id(String id) { - this.id = id; - return this; - } - - /** - *

The initial step.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("initial") - public _FinalStage initial(String initial) { - this.initial = initial; - return this; - } - - /** - *

The schema ids.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @Override - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public _FinalStage schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage steps(String key, WorkflowStepDto value) { - this.steps.put(key, value); - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllSteps(Map steps) { - this.steps.putAll(steps); - return this; - } - - @Override - @JsonSetter(value = "steps", nulls = Nulls.SKIP) - public _FinalStage steps(Map steps) { - this.steps.clear(); - this.steps.putAll(steps); - return this; - } - - /** - *

The name of the workflow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public WorkflowDto build() { - return new WorkflowDto(links, id, name, steps, schemaIds, initial); - } - } -} diff --git a/src/main/java/com/squidex/api/types/WorkflowStepDto.java b/src/main/java/com/squidex/api/types/WorkflowStepDto.java deleted file mode 100644 index 5e2938d..0000000 --- a/src/main/java/com/squidex/api/types/WorkflowStepDto.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowStepDto.Builder.class) -public final class WorkflowStepDto { - private final Optional> transitions; - - private final Optional color; - - private final Optional validate; - - private final Optional noUpdate; - - private final Optional noUpdateExpression; - - private final Optional> noUpdateRoles; - - private WorkflowStepDto( - Optional> transitions, - Optional color, - Optional validate, - Optional noUpdate, - Optional noUpdateExpression, - Optional> noUpdateRoles) { - this.transitions = transitions; - this.color = color; - this.validate = validate; - this.noUpdate = noUpdate; - this.noUpdateExpression = noUpdateExpression; - this.noUpdateRoles = noUpdateRoles; - } - - /** - * @return The transitions. - */ - @JsonProperty("transitions") - public Optional> getTransitions() { - return transitions; - } - - /** - * @return The optional color. - */ - @JsonProperty("color") - public Optional getColor() { - return color; - } - - /** - * @return True if the content should be validated when moving to this step. - */ - @JsonProperty("validate") - public Optional getValidate() { - return validate; - } - - /** - * @return Indicates if updates should not be allowed. - */ - @JsonProperty("noUpdate") - public Optional getNoUpdate() { - return noUpdate; - } - - /** - * @return Optional expression that must evaluate to true when you want to prevent updates. - */ - @JsonProperty("noUpdateExpression") - public Optional getNoUpdateExpression() { - return noUpdateExpression; - } - - /** - * @return Optional list of roles to restrict the updates for users with these roles. - */ - @JsonProperty("noUpdateRoles") - public Optional> getNoUpdateRoles() { - return noUpdateRoles; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowStepDto && equalTo((WorkflowStepDto) other); - } - - private boolean equalTo(WorkflowStepDto other) { - return transitions.equals(other.transitions) - && color.equals(other.color) - && validate.equals(other.validate) - && noUpdate.equals(other.noUpdate) - && noUpdateExpression.equals(other.noUpdateExpression) - && noUpdateRoles.equals(other.noUpdateRoles); - } - - @Override - public int hashCode() { - return Objects.hash( - this.transitions, - this.color, - this.validate, - this.noUpdate, - this.noUpdateExpression, - this.noUpdateRoles); - } - - @Override - public String toString() { - return "WorkflowStepDto{" + "transitions: " + transitions + ", color: " + color + ", validate: " + validate - + ", noUpdate: " + noUpdate + ", noUpdateExpression: " + noUpdateExpression + ", noUpdateRoles: " - + noUpdateRoles + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> transitions = Optional.empty(); - - private Optional color = Optional.empty(); - - private Optional validate = Optional.empty(); - - private Optional noUpdate = Optional.empty(); - - private Optional noUpdateExpression = Optional.empty(); - - private Optional> noUpdateRoles = Optional.empty(); - - private Builder() {} - - public Builder from(WorkflowStepDto other) { - transitions(other.getTransitions()); - color(other.getColor()); - validate(other.getValidate()); - noUpdate(other.getNoUpdate()); - noUpdateExpression(other.getNoUpdateExpression()); - noUpdateRoles(other.getNoUpdateRoles()); - return this; - } - - @JsonSetter(value = "transitions", nulls = Nulls.SKIP) - public Builder transitions(Optional> transitions) { - this.transitions = transitions; - return this; - } - - public Builder transitions(Map transitions) { - this.transitions = Optional.of(transitions); - return this; - } - - @JsonSetter(value = "color", nulls = Nulls.SKIP) - public Builder color(Optional color) { - this.color = color; - return this; - } - - public Builder color(String color) { - this.color = Optional.of(color); - return this; - } - - @JsonSetter(value = "validate", nulls = Nulls.SKIP) - public Builder validate(Optional validate) { - this.validate = validate; - return this; - } - - public Builder validate(Boolean validate) { - this.validate = Optional.of(validate); - return this; - } - - @JsonSetter(value = "noUpdate", nulls = Nulls.SKIP) - public Builder noUpdate(Optional noUpdate) { - this.noUpdate = noUpdate; - return this; - } - - public Builder noUpdate(Boolean noUpdate) { - this.noUpdate = Optional.of(noUpdate); - return this; - } - - @JsonSetter(value = "noUpdateExpression", nulls = Nulls.SKIP) - public Builder noUpdateExpression(Optional noUpdateExpression) { - this.noUpdateExpression = noUpdateExpression; - return this; - } - - public Builder noUpdateExpression(String noUpdateExpression) { - this.noUpdateExpression = Optional.of(noUpdateExpression); - return this; - } - - @JsonSetter(value = "noUpdateRoles", nulls = Nulls.SKIP) - public Builder noUpdateRoles(Optional> noUpdateRoles) { - this.noUpdateRoles = noUpdateRoles; - return this; - } - - public Builder noUpdateRoles(List noUpdateRoles) { - this.noUpdateRoles = Optional.of(noUpdateRoles); - return this; - } - - public WorkflowStepDto build() { - return new WorkflowStepDto(transitions, color, validate, noUpdate, noUpdateExpression, noUpdateRoles); - } - } -} diff --git a/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java b/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java deleted file mode 100644 index c0ea314..0000000 --- a/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowTransitionDto.Builder.class) -public final class WorkflowTransitionDto { - private final Optional expression; - - private final Optional> roles; - - private WorkflowTransitionDto(Optional expression, Optional> roles) { - this.expression = expression; - this.roles = roles; - } - - /** - * @return The optional expression. - */ - @JsonProperty("expression") - public Optional getExpression() { - return expression; - } - - /** - * @return The optional restricted role. - */ - @JsonProperty("roles") - public Optional> getRoles() { - return roles; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowTransitionDto && equalTo((WorkflowTransitionDto) other); - } - - private boolean equalTo(WorkflowTransitionDto other) { - return expression.equals(other.expression) && roles.equals(other.roles); - } - - @Override - public int hashCode() { - return Objects.hash(this.expression, this.roles); - } - - @Override - public String toString() { - return "WorkflowTransitionDto{" + "expression: " + expression + ", roles: " + roles + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional expression = Optional.empty(); - - private Optional> roles = Optional.empty(); - - private Builder() {} - - public Builder from(WorkflowTransitionDto other) { - expression(other.getExpression()); - roles(other.getRoles()); - return this; - } - - @JsonSetter(value = "expression", nulls = Nulls.SKIP) - public Builder expression(Optional expression) { - this.expression = expression; - return this; - } - - public Builder expression(String expression) { - this.expression = Optional.of(expression); - return this; - } - - @JsonSetter(value = "roles", nulls = Nulls.SKIP) - public Builder roles(Optional> roles) { - this.roles = roles; - return this; - } - - public Builder roles(List roles) { - this.roles = Optional.of(roles); - return this; - } - - public WorkflowTransitionDto build() { - return new WorkflowTransitionDto(expression, roles); - } - } -} diff --git a/src/main/java/com/squidex/api/types/WorkflowsDto.java b/src/main/java/com/squidex/api/types/WorkflowsDto.java deleted file mode 100644 index ea4a055..0000000 --- a/src/main/java/com/squidex/api/types/WorkflowsDto.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowsDto.Builder.class) -public final class WorkflowsDto implements IResource { - private final Map links; - - private final List items; - - private final List errors; - - private WorkflowsDto(Map links, List items, List errors) { - this.links = links; - this.items = items; - this.errors = errors; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The workflow. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The errros that should be fixed. - */ - @JsonProperty("errors") - public List getErrors() { - return errors; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowsDto && equalTo((WorkflowsDto) other); - } - - private boolean equalTo(WorkflowsDto other) { - return links.equals(other.links) && items.equals(other.items) && errors.equals(other.errors); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.errors); - } - - @Override - public String toString() { - return "WorkflowsDto{" + "links: " + links + ", items: " + items + ", errors: " + errors + "}"; - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private List items = new ArrayList<>(); - - private List errors = new ArrayList<>(); - - private Builder() {} - - public Builder from(WorkflowsDto other) { - links(other.getLinks()); - items(other.getItems()); - errors(other.getErrors()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - public Builder addItems(WorkflowDto items) { - this.items.add(items); - return this; - } - - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } - - @JsonSetter(value = "errors", nulls = Nulls.SKIP) - public Builder errors(List errors) { - this.errors.clear(); - this.errors.addAll(errors); - return this; - } - - public Builder addErrors(String errors) { - this.errors.add(errors); - return this; - } - - public Builder addAllErrors(List errors) { - this.errors.addAll(errors); - return this; - } - - public WorkflowsDto build() { - return new WorkflowsDto(links, items, errors); - } - } -}