Skip to content

Commit 0e1e7c9

Browse files
committed
Release 0.0.14
1 parent 6f1f607 commit 0e1e7c9

File tree

16 files changed

+287
-1
lines changed

16 files changed

+287
-1
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ publishing {
4040
maven(MavenPublication) {
4141
groupId = 'io.squidex'
4242
artifactId = 'squidex'
43-
version = '0.0.13'
43+
version = '0.0.14'
4444
from components.java
4545
}
4646
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.squidex.api.core;
2+
3+
import com.fasterxml.jackson.core.JsonParser;
4+
import com.fasterxml.jackson.core.JsonToken;
5+
import com.fasterxml.jackson.databind.DeserializationContext;
6+
import com.fasterxml.jackson.databind.JsonDeserializer;
7+
import com.fasterxml.jackson.databind.module.SimpleModule;
8+
import java.io.IOException;
9+
import java.time.Instant;
10+
import java.time.LocalDateTime;
11+
import java.time.OffsetDateTime;
12+
import java.time.ZoneOffset;
13+
import java.time.format.DateTimeFormatter;
14+
import java.time.temporal.TemporalAccessor;
15+
import java.time.temporal.TemporalQueries;
16+
17+
/**
18+
* Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects.
19+
*/
20+
class DateTimeDeserializer extends JsonDeserializer<OffsetDateTime> {
21+
private static final SimpleModule MODULE;
22+
23+
static {
24+
MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer());
25+
}
26+
27+
/**
28+
* Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper.
29+
*
30+
* @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper.
31+
*/
32+
public static SimpleModule getModule() {
33+
return MODULE;
34+
}
35+
36+
@Override
37+
public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException {
38+
JsonToken token = parser.currentToken();
39+
if (token == JsonToken.VALUE_NUMBER_INT) {
40+
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC);
41+
} else {
42+
TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest(
43+
parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from);
44+
45+
if (temporal.query(TemporalQueries.offset()) == null) {
46+
return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC);
47+
} else {
48+
return OffsetDateTime.from(temporal);
49+
}
50+
}
51+
}
52+
}

src/main/java/com/squidex/api/core/ObjectMappers.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonInclude;
44
import com.fasterxml.jackson.databind.DeserializationFeature;
55
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import com.fasterxml.jackson.databind.SerializationFeature;
67
import com.fasterxml.jackson.databind.json.JsonMapper;
78
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
89
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
@@ -12,7 +13,9 @@ public final class ObjectMappers {
1213
public static final ObjectMapper JSON_MAPPER = JsonMapper.builder()
1314
.addModule(new Jdk8Module())
1415
.addModule(new JavaTimeModule())
16+
.addModule(DateTimeDeserializer.getModule())
1517
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
18+
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
1619
.build();
1720

1821
private ObjectMappers() {}

src/main/java/com/squidex/api/resources/apps/AppsClient.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request, RequestOpt
139139
}
140140
}
141141

142+
public AssetScriptsDto putAssetScripts() {
143+
return putAssetScripts(UpdateAssetScriptsDto.builder().build());
144+
}
145+
142146
public ClientsDto getClients() {
143147
return getClients(null);
144148
}
@@ -264,6 +268,10 @@ public ClientsDto putClient(String id, UpdateClientDto request, RequestOptions r
264268
}
265269
}
266270

271+
public ClientsDto putClient(String id) {
272+
return putClient(id, UpdateClientDto.builder().build());
273+
}
274+
267275
public ClientsDto deleteClient(String id) {
268276
return deleteClient(id, null);
269277
}
@@ -638,6 +646,10 @@ public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request, R
638646
}
639647
}
640648

649+
public AppLanguagesDto putLanguage(String language) {
650+
return putLanguage(language, UpdateLanguageDto.builder().build());
651+
}
652+
641653
public AppLanguagesDto deleteLanguage(String language) {
642654
return deleteLanguage(language, null);
643655
}
@@ -1019,6 +1031,10 @@ public AppDto putApp(UpdateAppDto request, RequestOptions requestOptions) {
10191031
}
10201032
}
10211033

1034+
public AppDto putApp() {
1035+
return putApp(UpdateAppDto.builder().build());
1036+
}
1037+
10221038
public void deleteApp() {
10231039
deleteApp(null);
10241040
}
@@ -1089,6 +1105,10 @@ public AppDto putAppTeam(TransferToTeamDto request, RequestOptions requestOption
10891105
}
10901106
}
10911107

1108+
public AppDto putAppTeam() {
1109+
return putAppTeam(TransferToTeamDto.builder().build());
1110+
}
1111+
10921112
public AppSettingsDto getSettings() {
10931113
return getSettings(null);
10941114
}

src/main/java/com/squidex/api/resources/assets/AssetsClient.java

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ public InputStream getAssetContentBySlug(
125125
}
126126
}
127127

128+
public InputStream getAssetContentBySlug(String idOrSlug, String more) {
129+
return getAssetContentBySlug(
130+
idOrSlug, more, AssetsGetAssetContentBySlugRequest.builder().build());
131+
}
132+
128133
public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request) {
129134
return getAssetContent(id, request, null);
130135
}
@@ -200,6 +205,10 @@ public InputStream getAssetContent(String id, AssetsGetAssetContentRequest reque
200205
}
201206
}
202207

208+
public InputStream getAssetContent(String id) {
209+
return getAssetContent(id, AssetsGetAssetContentRequest.builder().build());
210+
}
211+
203212
public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request) {
204213
return getAssetFolders(request, null);
205214
}
@@ -237,6 +246,10 @@ public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request, Req
237246
}
238247
}
239248

249+
public AssetFoldersDto getAssetFolders() {
250+
return getAssetFolders(AssetsGetAssetFoldersRequest.builder().build());
251+
}
252+
240253
public AssetFolderDto postAssetFolder(CreateAssetFolderDto request) {
241254
return postAssetFolder(request, null);
242255
}
@@ -395,6 +408,10 @@ public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request
395408
}
396409
}
397410

411+
public AssetFolderDto putAssetFolderParent(String id) {
412+
return putAssetFolderParent(id, MoveAssetFolderDto.builder().build());
413+
}
414+
398415
public Map<String, Integer> getTags() {
399416
return getTags(null);
400417
}
@@ -527,6 +544,10 @@ public AssetsDto getAssets(AssetsGetAssetsRequest request, RequestOptions reques
527544
}
528545
}
529546

547+
public AssetsDto getAssets() {
548+
return getAssets(AssetsGetAssetsRequest.builder().build());
549+
}
550+
530551
public AssetDto postAsset(File file, AssetsPostAssetRequest request) {
531552
return postAsset(file, request, null);
532553
}
@@ -617,6 +638,10 @@ public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request, RequestOption
617638
}
618639
}
619640

641+
public AssetsDto getAssetsPost() {
642+
return getAssetsPost(AssetsGetAssetsPostRequest.builder().build());
643+
}
644+
620645
public AssetDto getAsset(String id) {
621646
return getAsset(id, null);
622647
}
@@ -747,6 +772,10 @@ public AssetDto putAsset(String id, AnnotateAssetDto request, RequestOptions req
747772
}
748773
}
749774

775+
public AssetDto putAsset(String id) {
776+
return putAsset(id, AnnotateAssetDto.builder().build());
777+
}
778+
750779
public void deleteAsset(String id, AssetsDeleteAssetRequest request) {
751780
deleteAsset(id, request, null);
752781
}
@@ -785,6 +814,10 @@ public void deleteAsset(String id, AssetsDeleteAssetRequest request, RequestOpti
785814
}
786815
}
787816

817+
public void deleteAsset(String id) {
818+
deleteAsset(id, AssetsDeleteAssetRequest.builder().build());
819+
}
820+
788821
public List<BulkResultDto> bulkUpdateAssets(BulkUpdateAssetsDto request) {
789822
return bulkUpdateAssets(request, null);
790823
}
@@ -837,6 +870,10 @@ public List<BulkResultDto> bulkUpdateAssets(BulkUpdateAssetsDto request, Request
837870
}
838871
}
839872

873+
public List<BulkResultDto> bulkUpdateAssets() {
874+
return bulkUpdateAssets(BulkUpdateAssetsDto.builder().build());
875+
}
876+
840877
public AssetDto putAssetContent(String id, File file, AssetsPutAssetContentRequest request) {
841878
return putAssetContent(id, file, request, null);
842879
}
@@ -919,4 +956,8 @@ public AssetDto putAssetParent(String id, MoveAssetDto request, RequestOptions r
919956
throw new RuntimeException(e);
920957
}
921958
}
959+
960+
public AssetDto putAssetParent(String id) {
961+
return putAssetParent(id, MoveAssetDto.builder().build());
962+
}
922963
}

src/main/java/com/squidex/api/resources/backups/BackupsClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public InputStream getBackupContentV2(
124124
}
125125
}
126126

127+
public InputStream getBackupContentV2(String id) {
128+
return getBackupContentV2(id, BackupsGetBackupContentV2Request.builder().build());
129+
}
130+
127131
public BackupJobsDto getBackups() {
128132
return getBackups(null);
129133
}

src/main/java/com/squidex/api/resources/comments/CommentsClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ public CommentsDto getComments(
9393
}
9494
}
9595

96+
public CommentsDto getComments(String commentsId) {
97+
return getComments(commentsId, CommentsGetCommentsRequest.builder().build());
98+
}
99+
96100
public CommentDto postComment(String commentsId, UpsertCommentDto request) {
97101
return postComment(commentsId, request, null);
98102
}

src/main/java/com/squidex/api/resources/contents/ContentsClient.java

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ public ContentsDto getContents(String schema, ContentsGetContentsRequest request
116116
}
117117
}
118118

119+
public ContentsDto getContents(String schema) {
120+
return getContents(schema, ContentsGetContentsRequest.builder().build());
121+
}
122+
119123
public ContentDto postContent(String schema, ContentsPostContentRequest request) {
120124
return postContent(schema, request, null);
121125
}
@@ -230,6 +234,10 @@ public ContentsDto getContentsPost(
230234
}
231235
}
232236

237+
public ContentsDto getContentsPost(String schema) {
238+
return getContentsPost(schema, ContentsGetContentsPostRequest.builder().build());
239+
}
240+
233241
public ContentDto getContent(String schema, String id, ContentsGetContentRequest request) {
234242
return getContent(schema, id, request, null);
235243
}
@@ -279,6 +287,10 @@ public ContentDto getContent(
279287
}
280288
}
281289

290+
public ContentDto getContent(String schema, String id) {
291+
return getContent(schema, id, ContentsGetContentRequest.builder().build());
292+
}
293+
282294
public ContentDto postUpsertContent(String schema, String id, ContentsPostUpsertContentRequest request) {
283295
return postUpsertContent(schema, id, request, null);
284296
}
@@ -468,6 +480,10 @@ public void deleteContent(
468480
}
469481
}
470482

483+
public void deleteContent(String schema, String id) {
484+
deleteContent(schema, id, ContentsDeleteContentRequest.builder().build());
485+
}
486+
471487
public void getContentValidity(String schema, String id) {
472488
getContentValidity(schema, id, null);
473489
}
@@ -556,6 +572,10 @@ public ContentsDto getReferences(
556572
}
557573
}
558574

575+
public ContentsDto getReferences(String schema, String id) {
576+
return getReferences(schema, id, ContentsGetReferencesRequest.builder().build());
577+
}
578+
559579
public ContentsDto getReferencing(String schema, String id, ContentsGetReferencingRequest request) {
560580
return getReferencing(schema, id, request, null);
561581
}
@@ -613,6 +633,11 @@ public ContentsDto getReferencing(
613633
}
614634
}
615635

636+
public ContentsDto getReferencing(String schema, String id) {
637+
return getReferencing(
638+
schema, id, ContentsGetReferencingRequest.builder().build());
639+
}
640+
616641
public InputStream getContentVersion(
617642
String schema, String id, int version, ContentsGetContentVersionRequest request) {
618643
return getContentVersion(schema, id, version, request, null);
@@ -659,6 +684,11 @@ public InputStream getContentVersion(
659684
}
660685
}
661686

687+
public InputStream getContentVersion(String schema, String id, int version) {
688+
return getContentVersion(
689+
schema, id, version, ContentsGetContentVersionRequest.builder().build());
690+
}
691+
662692
public List<BulkResultDto> postContents(String schema, ImportContentsDto request) {
663693
return postContents(schema, request, null);
664694
}
@@ -868,6 +898,11 @@ public ContentDto deleteContentStatus(
868898
}
869899
}
870900

901+
public ContentDto deleteContentStatus(String schema, String id) {
902+
return deleteContentStatus(
903+
schema, id, ContentsDeleteContentStatusRequest.builder().build());
904+
}
905+
871906
public ContentDto createDraft(String schema, String id, ContentsCreateDraftRequest request) {
872907
return createDraft(schema, id, request, null);
873908
}
@@ -909,6 +944,10 @@ public ContentDto createDraft(
909944
}
910945
}
911946

947+
public ContentDto createDraft(String schema, String id) {
948+
return createDraft(schema, id, ContentsCreateDraftRequest.builder().build());
949+
}
950+
912951
public ContentDto deleteVersion(String schema, String id, ContentsDeleteVersionRequest request) {
913952
return deleteVersion(schema, id, request, null);
914953
}
@@ -949,4 +988,8 @@ public ContentDto deleteVersion(
949988
throw new RuntimeException(e);
950989
}
951990
}
991+
992+
public ContentDto deleteVersion(String schema, String id) {
993+
return deleteVersion(schema, id, ContentsDeleteVersionRequest.builder().build());
994+
}
952995
}

src/main/java/com/squidex/api/resources/history/HistoryClient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public List<HistoryEventDto> getAppHistory(HistoryGetAppHistoryRequest request,
5858
}
5959
}
6060

61+
public List<HistoryEventDto> getAppHistory() {
62+
return getAppHistory(HistoryGetAppHistoryRequest.builder().build());
63+
}
64+
6165
public List<HistoryEventDto> getTeamHistory(String team, HistoryGetTeamHistoryRequest request) {
6266
return getTeamHistory(team, request, null);
6367
}
@@ -93,4 +97,8 @@ public List<HistoryEventDto> getTeamHistory(
9397
throw new RuntimeException(e);
9498
}
9599
}
100+
101+
public List<HistoryEventDto> getTeamHistory(String team) {
102+
return getTeamHistory(team, HistoryGetTeamHistoryRequest.builder().build());
103+
}
96104
}

0 commit comments

Comments
 (0)