Skip to content

Commit

Permalink
Release 0.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Sep 9, 2023
1 parent 6f1f607 commit 0e1e7c9
Show file tree
Hide file tree
Showing 16 changed files with 287 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ publishing {
maven(MavenPublication) {
groupId = 'io.squidex'
artifactId = 'squidex'
version = '0.0.13'
version = '0.0.14'
from components.java
}
}
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/com/squidex/api/core/DateTimeDeserializer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.squidex.api.core;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.module.SimpleModule;
import java.io.IOException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalQueries;

/**
* Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects.
*/
class DateTimeDeserializer extends JsonDeserializer<OffsetDateTime> {
private static final SimpleModule MODULE;

static {
MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer());
}

/**
* Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper.
*
* @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper.
*/
public static SimpleModule getModule() {
return MODULE;
}

@Override
public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException {
JsonToken token = parser.currentToken();
if (token == JsonToken.VALUE_NUMBER_INT) {
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC);
} else {
TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from);

if (temporal.query(TemporalQueries.offset()) == null) {
return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC);
} else {
return OffsetDateTime.from(temporal);
}
}
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/squidex/api/core/ObjectMappers.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
Expand All @@ -12,7 +13,9 @@ public final class ObjectMappers {
public static final ObjectMapper JSON_MAPPER = JsonMapper.builder()
.addModule(new Jdk8Module())
.addModule(new JavaTimeModule())
.addModule(DateTimeDeserializer.getModule())
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.build();

private ObjectMappers() {}
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/squidex/api/resources/apps/AppsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request, RequestOpt
}
}

public AssetScriptsDto putAssetScripts() {
return putAssetScripts(UpdateAssetScriptsDto.builder().build());
}

public ClientsDto getClients() {
return getClients(null);
}
Expand Down Expand Up @@ -264,6 +268,10 @@ public ClientsDto putClient(String id, UpdateClientDto request, RequestOptions r
}
}

public ClientsDto putClient(String id) {
return putClient(id, UpdateClientDto.builder().build());
}

public ClientsDto deleteClient(String id) {
return deleteClient(id, null);
}
Expand Down Expand Up @@ -638,6 +646,10 @@ public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request, R
}
}

public AppLanguagesDto putLanguage(String language) {
return putLanguage(language, UpdateLanguageDto.builder().build());
}

public AppLanguagesDto deleteLanguage(String language) {
return deleteLanguage(language, null);
}
Expand Down Expand Up @@ -1019,6 +1031,10 @@ public AppDto putApp(UpdateAppDto request, RequestOptions requestOptions) {
}
}

public AppDto putApp() {
return putApp(UpdateAppDto.builder().build());
}

public void deleteApp() {
deleteApp(null);
}
Expand Down Expand Up @@ -1089,6 +1105,10 @@ public AppDto putAppTeam(TransferToTeamDto request, RequestOptions requestOption
}
}

public AppDto putAppTeam() {
return putAppTeam(TransferToTeamDto.builder().build());
}

public AppSettingsDto getSettings() {
return getSettings(null);
}
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/com/squidex/api/resources/assets/AssetsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ public InputStream getAssetContentBySlug(
}
}

public InputStream getAssetContentBySlug(String idOrSlug, String more) {
return getAssetContentBySlug(
idOrSlug, more, AssetsGetAssetContentBySlugRequest.builder().build());
}

public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request) {
return getAssetContent(id, request, null);
}
Expand Down Expand Up @@ -200,6 +205,10 @@ public InputStream getAssetContent(String id, AssetsGetAssetContentRequest reque
}
}

public InputStream getAssetContent(String id) {
return getAssetContent(id, AssetsGetAssetContentRequest.builder().build());
}

public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request) {
return getAssetFolders(request, null);
}
Expand Down Expand Up @@ -237,6 +246,10 @@ public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request, Req
}
}

public AssetFoldersDto getAssetFolders() {
return getAssetFolders(AssetsGetAssetFoldersRequest.builder().build());
}

public AssetFolderDto postAssetFolder(CreateAssetFolderDto request) {
return postAssetFolder(request, null);
}
Expand Down Expand Up @@ -395,6 +408,10 @@ public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request
}
}

public AssetFolderDto putAssetFolderParent(String id) {
return putAssetFolderParent(id, MoveAssetFolderDto.builder().build());
}

public Map<String, Integer> getTags() {
return getTags(null);
}
Expand Down Expand Up @@ -527,6 +544,10 @@ public AssetsDto getAssets(AssetsGetAssetsRequest request, RequestOptions reques
}
}

public AssetsDto getAssets() {
return getAssets(AssetsGetAssetsRequest.builder().build());
}

public AssetDto postAsset(File file, AssetsPostAssetRequest request) {
return postAsset(file, request, null);
}
Expand Down Expand Up @@ -617,6 +638,10 @@ public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request, RequestOption
}
}

public AssetsDto getAssetsPost() {
return getAssetsPost(AssetsGetAssetsPostRequest.builder().build());
}

public AssetDto getAsset(String id) {
return getAsset(id, null);
}
Expand Down Expand Up @@ -747,6 +772,10 @@ public AssetDto putAsset(String id, AnnotateAssetDto request, RequestOptions req
}
}

public AssetDto putAsset(String id) {
return putAsset(id, AnnotateAssetDto.builder().build());
}

public void deleteAsset(String id, AssetsDeleteAssetRequest request) {
deleteAsset(id, request, null);
}
Expand Down Expand Up @@ -785,6 +814,10 @@ public void deleteAsset(String id, AssetsDeleteAssetRequest request, RequestOpti
}
}

public void deleteAsset(String id) {
deleteAsset(id, AssetsDeleteAssetRequest.builder().build());
}

public List<BulkResultDto> bulkUpdateAssets(BulkUpdateAssetsDto request) {
return bulkUpdateAssets(request, null);
}
Expand Down Expand Up @@ -837,6 +870,10 @@ public List<BulkResultDto> bulkUpdateAssets(BulkUpdateAssetsDto request, Request
}
}

public List<BulkResultDto> bulkUpdateAssets() {
return bulkUpdateAssets(BulkUpdateAssetsDto.builder().build());
}

public AssetDto putAssetContent(String id, File file, AssetsPutAssetContentRequest request) {
return putAssetContent(id, file, request, null);
}
Expand Down Expand Up @@ -919,4 +956,8 @@ public AssetDto putAssetParent(String id, MoveAssetDto request, RequestOptions r
throw new RuntimeException(e);
}
}

public AssetDto putAssetParent(String id) {
return putAssetParent(id, MoveAssetDto.builder().build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public InputStream getBackupContentV2(
}
}

public InputStream getBackupContentV2(String id) {
return getBackupContentV2(id, BackupsGetBackupContentV2Request.builder().build());
}

public BackupJobsDto getBackups() {
return getBackups(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public CommentsDto getComments(
}
}

public CommentsDto getComments(String commentsId) {
return getComments(commentsId, CommentsGetCommentsRequest.builder().build());
}

public CommentDto postComment(String commentsId, UpsertCommentDto request) {
return postComment(commentsId, request, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ public ContentsDto getContents(String schema, ContentsGetContentsRequest request
}
}

public ContentsDto getContents(String schema) {
return getContents(schema, ContentsGetContentsRequest.builder().build());
}

public ContentDto postContent(String schema, ContentsPostContentRequest request) {
return postContent(schema, request, null);
}
Expand Down Expand Up @@ -230,6 +234,10 @@ public ContentsDto getContentsPost(
}
}

public ContentsDto getContentsPost(String schema) {
return getContentsPost(schema, ContentsGetContentsPostRequest.builder().build());
}

public ContentDto getContent(String schema, String id, ContentsGetContentRequest request) {
return getContent(schema, id, request, null);
}
Expand Down Expand Up @@ -279,6 +287,10 @@ public ContentDto getContent(
}
}

public ContentDto getContent(String schema, String id) {
return getContent(schema, id, ContentsGetContentRequest.builder().build());
}

public ContentDto postUpsertContent(String schema, String id, ContentsPostUpsertContentRequest request) {
return postUpsertContent(schema, id, request, null);
}
Expand Down Expand Up @@ -468,6 +480,10 @@ public void deleteContent(
}
}

public void deleteContent(String schema, String id) {
deleteContent(schema, id, ContentsDeleteContentRequest.builder().build());
}

public void getContentValidity(String schema, String id) {
getContentValidity(schema, id, null);
}
Expand Down Expand Up @@ -556,6 +572,10 @@ public ContentsDto getReferences(
}
}

public ContentsDto getReferences(String schema, String id) {
return getReferences(schema, id, ContentsGetReferencesRequest.builder().build());
}

public ContentsDto getReferencing(String schema, String id, ContentsGetReferencingRequest request) {
return getReferencing(schema, id, request, null);
}
Expand Down Expand Up @@ -613,6 +633,11 @@ public ContentsDto getReferencing(
}
}

public ContentsDto getReferencing(String schema, String id) {
return getReferencing(
schema, id, ContentsGetReferencingRequest.builder().build());
}

public InputStream getContentVersion(
String schema, String id, int version, ContentsGetContentVersionRequest request) {
return getContentVersion(schema, id, version, request, null);
Expand Down Expand Up @@ -659,6 +684,11 @@ public InputStream getContentVersion(
}
}

public InputStream getContentVersion(String schema, String id, int version) {
return getContentVersion(
schema, id, version, ContentsGetContentVersionRequest.builder().build());
}

public List<BulkResultDto> postContents(String schema, ImportContentsDto request) {
return postContents(schema, request, null);
}
Expand Down Expand Up @@ -868,6 +898,11 @@ public ContentDto deleteContentStatus(
}
}

public ContentDto deleteContentStatus(String schema, String id) {
return deleteContentStatus(
schema, id, ContentsDeleteContentStatusRequest.builder().build());
}

public ContentDto createDraft(String schema, String id, ContentsCreateDraftRequest request) {
return createDraft(schema, id, request, null);
}
Expand Down Expand Up @@ -909,6 +944,10 @@ public ContentDto createDraft(
}
}

public ContentDto createDraft(String schema, String id) {
return createDraft(schema, id, ContentsCreateDraftRequest.builder().build());
}

public ContentDto deleteVersion(String schema, String id, ContentsDeleteVersionRequest request) {
return deleteVersion(schema, id, request, null);
}
Expand Down Expand Up @@ -949,4 +988,8 @@ public ContentDto deleteVersion(
throw new RuntimeException(e);
}
}

public ContentDto deleteVersion(String schema, String id) {
return deleteVersion(schema, id, ContentsDeleteVersionRequest.builder().build());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public List<HistoryEventDto> getAppHistory(HistoryGetAppHistoryRequest request,
}
}

public List<HistoryEventDto> getAppHistory() {
return getAppHistory(HistoryGetAppHistoryRequest.builder().build());
}

public List<HistoryEventDto> getTeamHistory(String team, HistoryGetTeamHistoryRequest request) {
return getTeamHistory(team, request, null);
}
Expand Down Expand Up @@ -93,4 +97,8 @@ public List<HistoryEventDto> getTeamHistory(
throw new RuntimeException(e);
}
}

public List<HistoryEventDto> getTeamHistory(String team) {
return getTeamHistory(team, HistoryGetTeamHistoryRequest.builder().build());
}
}
Loading

0 comments on commit 0e1e7c9

Please sign in to comment.