Skip to content

Commit 36b4cf8

Browse files
CS-42937 : Support for Early Access Header
CS-42936 : Taxonomy document and Test
1 parent eacce9c commit 36b4cf8

File tree

12 files changed

+121
-11
lines changed

12 files changed

+121
-11
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012 - 2023 Contentstack
3+
Copyright (c) 2012 - 2024 Contentstack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ if(response.isSuccessful()){
137137

138138
### The MIT License (MIT)
139139

140-
Copyright © 2012-2023 [Contentstack](https://www.contentstack.com/). All Rights Reserved
140+
Copyright © 2012-2024 [Contentstack](https://www.contentstack.com/). All Rights Reserved
141141

142142
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
143143
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the

changelog.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
# Changelog
22

3+
## v1.2.0
4+
5+
### Dec 18, 2023
6+
7+
- New Features:
8+
- Early access header support
9+
10+
11+
12+
## v1.1.0
13+
14+
### Oct 31, 2023
15+
16+
- New Features:
17+
- Taxonomy
18+
- Teams
19+
20+
Bug Fixes:
21+
- KeepAliveDuration
22+
- SNYK issues fixed
23+
24+
325
## v1.0.0
426

527
### Aug 01, 2023
28+
629
- Bug Fixed For un-localize An Entry
730
- Fixed Timeout Issue
8-
- #32 Fixed
31+
- #32 Fixed
932
- Code coverage improvements
1033
- NRP support added
1134
- General improvements with minor breaking changes
@@ -15,4 +38,5 @@
1538
### Initial Release
1639

1740
### Oct 20, 2022
41+
1842
Initial release for Contentstack CMA base Java management SDK

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<artifactId>cms</artifactId>
88
<packaging>jar</packaging>
99
<name>contentstack-management-java</name>
10-
<version>1.1.0</version>
10+
<version>1.3.0</version>
1111
<description>Contentstack Java Management SDK for Content Management API, Contentstack is a headless CMS with an
1212
API-first approach
1313
</description>

src/main/java/com/contentstack/cms/core/Util.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
*/
1616
public class Util {
1717

18-
// The line `public static final String SDK_VERSION = "1.0.0";`
18+
// The line `public static final String SDK_VERSION = "1.2.0";`
1919
// named `SDK_VERSION` of type `String`. The value of this constant is set to
20-
// "1.0.0".
21-
public static final String SDK_VERSION = "1.0.0";
20+
// "1.2.0".
21+
public static final String SDK_VERSION = "1.2.0";
2222

2323
static final String PRIVATE_CONSTRUCTOR = "private constructor can't be accessed outside the class";
2424
public static final Boolean RETRY_ON_FAILURE = true;

src/main/java/com/contentstack/cms/stack/Entry.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,12 +744,12 @@ public Call<ResponseBody> publishWithReference(@NotNull JSONObject requestBody)
744744
}
745745

746746
/**
747-
* To Unpublish an entry call will unpublish an entry at once, and also, gives
748-
* you the provision to unpublish an
747+
* To Un-publish an entry call will un-publish an entry at once, and also, gives
748+
* you the provision to un-publish an
749749
* entry automatically at a later date/time.
750750
* <p>
751751
* In the 'Body' section, you can specify the locales and environments from
752-
* which you want to unpublish the entry.
752+
* which you want to un-publish the entry.
753753
* These details should be specified in the
754754
* <p>
755755
* <b>entry</b> parameter. However, if
@@ -778,4 +778,21 @@ public Call<ResponseBody> unpublish(@NotNull JSONObject requestBody) {
778778
return this.service.unpublish(this.headers, this.contentTypeUid, this.entryUid, requestBody);
779779
}
780780

781+
782+
/**
783+
* Get instance of taxonomy search filter class instance through which we can query on taxonomy based on content type
784+
* <p><b>Examples</b></p>
785+
* <p>
786+
* <pre>
787+
* JSONObject query = new JSONObject();
788+
* query.put("taxonomies.taxonomy_uid", "{ \"$in\" : [\"term_uid1\" , \"term_uid2\" ] }");
789+
* Response<ResponseBody> response = entry.query(query).execute();
790+
* </pre>
791+
* instance of {@link Terms}
792+
*/
793+
public Call<ResponseBody> query(@NotNull JSONObject query) {
794+
validateCT();
795+
return this.service.filterTaxonomy(this.headers, this.contentTypeUid, query);
796+
}
797+
781798
}

src/main/java/com/contentstack/cms/stack/EntryService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,11 @@ Call<ResponseBody> unpublish(
146146
@Path("content_type_uid") String contentTypeUid,
147147
@Path("entry_uid") String entryUid,
148148
@Body JSONObject requestBody);
149+
150+
@GET("content_types/{content_type_uid}/entries")
151+
Call<ResponseBody> filterTaxonomy(
152+
@HeaderMap Map<String, Object> headers,
153+
@Path("content_type_uid") String contentTypeUid,
154+
@Query("query") JSONObject queryObject);
155+
149156
}

src/main/java/com/contentstack/cms/stack/Taxonomy.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,16 @@ public Terms terms() {
251251
return new Terms(this.taxonomyService, this.headers, this.taxonomyId);
252252
}
253253

254+
255+
/**
256+
* Get instance of taxonomy search filter class instance through which we can query on taxonomy based on Entry
257+
* <p>Example usage:</p>
258+
* <pre>JSONObject object = new JSonObject();</pre>
259+
* <pre>object.put("taxonomies.color", Object)</pre>
260+
* <pre>Taxonomy taxonomy = stack("authtoken").taxonomy("taxonomyId").filterTaxonomy(object);</pre>
261+
*/
262+
public Call<ResponseBody> query(JSONObject query) {
263+
return this.taxonomyService.filterTaxonomy(this.headers, query);
264+
}
265+
254266
}

src/main/java/com/contentstack/cms/stack/TaxonomyService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,11 @@ Call<ResponseBody> reorder(
9191
Call<ResponseBody> searchTerm(
9292
@HeaderMap HashMap<String, Object> headers,
9393
@Query("typeahead") String termString);
94+
95+
96+
@GET("taxonomies/entries")
97+
Call<ResponseBody> filterTaxonomy(
98+
@HeaderMap HashMap<String, Object> headers,
99+
@Query("query") JSONObject queryObject
100+
);
94101
}

src/test/java/com/contentstack/cms/ContentstackUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public void testValidOrganization() {
250250
@Test
251251
public void testNullOrganizationUid() {
252252
Contentstack client = new Contentstack.Builder().setAuthtoken("fake@authtoken").build();
253-
Assertions.assertThrows(IllegalArgumentException.class, () -> client.organization(null));
253+
Assertions.assertThrows(NullPointerException.class, () -> client.organization(null));
254254
}
255255

256256
@Test

0 commit comments

Comments
 (0)