Skip to content

Commit 42d8620

Browse files
Merge pull request #31 from contentstack/next
Next: v1.0.0: contains, branch-compare and merge and timeout issue
2 parents 2f31c69 + 58d1a52 commit 42d8620

File tree

151 files changed

+10096
-4541
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+10096
-4541
lines changed

.github/workflows/coverage.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Java CI with Code Coverage
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build-and-test:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
- name: Code Coverage
13+
uses: actions/setup-java@v3
14+
with:
15+
java-version: "11"
16+
distribution: "adopt"
17+
18+
- name: Build with Maven`
19+
run: mvn clean package
20+
21+
- name: Run Tests with JaCoCo
22+
run: mvn jacoco:prepare-agent jacoco:report
23+
24+
- name: Upload Code Coverage Report
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: code-coverage-report
28+
path: target/site/jacoco

.github/workflows/maven-publish.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish package to the Maven Central Repository
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
jobs:
8+
publish-maven:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Set up Maven Central Repository
16+
uses: actions/setup-java@v3
17+
with:
18+
java-version: "11"
19+
distribution: "adopt"
20+
server-id: ossrh
21+
server-username: MAVEN_USERNAME
22+
server-password: MAVEN_PASSWORD
23+
gpg-passphrase: GPG_PASSPHRASE
24+
- name: Publish to the Maven Central Repository
25+
run: mvn --batch-mode deploy
26+
env:
27+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
28+
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
29+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
30+
publish-github:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
- name: Set up Java for publishing to GitHub Packages
35+
uses: actions/setup-java@v3
36+
with:
37+
java-version: "8"
38+
distribution: "adopt"
39+
server-id: github
40+
- name: Publish to GitHub Packages
41+
run: mvn --batch-mode deploy
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

-40
This file was deleted.

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -270,3 +270,6 @@ src/main/resources/
270270
/test-report/
271271
/.apt_generated_tests/
272272
.dccache
273+
.vscode/settings.json
274+
.vscode/
275+
/.vscode/

.vscode/settings.json

-3
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012 - 2022 Contentstack
3+
Copyright (c) 2012 - 2023 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

+53-35
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,60 @@
22

33
## Contentstack Management Java SDK
44

5-
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. All you have to do is build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
6-
7-
This SDK uses the [Content Management API](https://www.contentstack.com/docs/developers/apis/content-management-api/) (CMA). The CMA is used to manage the content of your Contentstack account. This includes creating, updating, deleting, and fetching content of your account. To use the CMA, you will need to authenticate your users with a [Management Token](https://www.contentstack.com/docs/developers/create-tokens/about-management-tokens) or an [Authtoken](https://www.contentstack.com/docs/developers/apis/content-management-api/#how-to-get-authtoken). Read more about it in [Authentication](https://www.contentstack.com/docs/developers/apis/content-management-api/#authentication).
8-
9-
Note: By using CMA, you can execute GET requests for fetching content. However, we strongly recommend that you always use the [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/) to deliver content to your web or mobile properties.
5+
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful
6+
cross-platform applications in their favorite languages. All you have to do is build your application frontend, and
7+
Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
8+
9+
This SDK uses the [Content Management API](https://www.contentstack.com/docs/developers/apis/content-management-api/) (
10+
CMA). The CMA is used to manage the content of your Contentstack account. This includes creating, updating, deleting,
11+
and fetching content of your account. To use the CMA, you will need to authenticate your users with
12+
a [Management Token](https://www.contentstack.com/docs/developers/create-tokens/about-management-tokens) or
13+
an [Authtoken](https://www.contentstack.com/docs/developers/apis/content-management-api/#how-to-get-authtoken). Read
14+
more about it
15+
in [Authentication](https://www.contentstack.com/docs/developers/apis/content-management-api/#authentication).
16+
17+
Note: By using CMA, you can execute GET requests for fetching content. However, we strongly recommend that you always
18+
use the [Content Delivery API](https://www.contentstack.com/docs/developers/apis/content-delivery-api/) to deliver
19+
content to your web or mobile properties.
1020

1121
### Prerequisite
1222

1323
You need Java 8 or above installed on your machine to use the Contentstack Management Java SDK.
1424

1525
### Installation
1626

17-
Install it via maven:
27+
**Install it via maven:**
1828

1929
```java
2030
<dependency>
21-
<groupId>com.contentstack.sdk</groupId>
22-
<artifactId>cms</artifactId>
23-
<version>{version}</version>
31+
<groupId>com.contentstack.sdk</groupId>
32+
<artifactId>cms</artifactId>
33+
<version>{version}</version>
2434
</dependency>
2535
```
2636

27-
Install it via gradle:
37+
**Install it via gradle:**
2838

2939
```java
30-
implementation 'com.contentstack.sdk:cms:{version}'
40+
implementation'com.contentstack.sdk:cms:{version}'
3141
```
3242

3343
To import the SDK, use the following command:
3444

3545
```java
3646
package com.contentstack.cms;
37-
3847
Contentstack contentstack = new Contentstack.Builder().build();
3948
```
4049

4150
### Authentication
4251

43-
To use this SDK, you need to authenticate your users by using the Authtoken, credentials, or Management Token (stack-level token).
52+
To use this SDK, you need to authenticate your users by using the Authtoken, credentials, or Management Token (
53+
stack-level token).
4454

4555
### Authtoken
4656

47-
An [Authtoken](https://www.contentstack.com/docs/developers/create-tokens/types-of-tokens/#authentication-tokens-authtokens-) is a read-write token used to make authorized CMA requests, and it is a **user-specific** token.
57+
An [Authtoken](https://www.contentstack.com/docs/developers/create-tokens/types-of-tokens/#authentication-tokens-authtokens-)
58+
is a read-write token used to make authorized CMA requests, and it is a **user-specific** token.
4859

4960
```java
5061
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
@@ -56,16 +67,17 @@ To Login to Contentstack by using credentials, you can use the following lines o
5667

5768
```java
5869
Contentstack contentstack = new Contentstack.Builder().build();
59-
contentstack.login("EMAIL", "PASSWORD");
70+
contentstack.login("EMAIL","PASSWORD");
6071
```
6172

6273
### Management Token
6374

64-
[Management Tokens](https://www.contentstack.com/docs/developers/create-tokens/about-management-tokens/) are **stack-level** tokens, with no users attached to them.
75+
[Management Tokens](https://www.contentstack.com/docs/developers/create-tokens/about-management-tokens/) are *
76+
*stack-level** tokens, with no users attached to them.
6577

6678
```java
67-
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
68-
Stack stack = contentstack.stack("API_KEY", "MANAGEMENT_TOKEN");
79+
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
80+
Stack stack=contentstack.stack("API_KEY","MANAGEMENT_TOKEN");
6981
```
7082

7183
### Contentstack Management Java SDK: 5-minute Quickstart
@@ -93,11 +105,11 @@ To create an entry in a specific content type of a stack, use the following line
93105

94106
```java
95107
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
96-
Stack stack = contentstack.stack("API_KEY");
108+
Stack stack=contentstack.stack("API_KEY");
97109
JSONObject body = ....
98-
Response<ResponseBody> response = entry.create(body).execute();
99-
if (response.isSuccessful()){
100-
System.out.println(response.body());
110+
Response<ResponseBody> response=entry.create(body).execute();
111+
if(response.isSuccessful()){
112+
System.out.println(response.body());
101113
}
102114
```
103115

@@ -107,28 +119,34 @@ The following lines of code can be used to upload assets to your stack:
107119

108120
```java
109121
Contentstack contentstack = new Contentstack.Builder().setAuthtoken("AUTHTOKEN").build();
110-
Stack stack = contentstack.stack("API_KEY");
111-
Asset asset = stack.asset();
112-
Response<ResponseBody> response = asset.uploadAsset("filePath", "description").execute();
113-
if (response.isSuccessful()){
114-
System.out.println(response.body());
115-
}else {
116-
System.out.println(response.errorBody());
122+
Stack stack=contentstack.stack("API_KEY");
123+
Asset asset=stack.asset();
124+
Response<ResponseBody> response=asset.uploadAsset("filePath","description").execute();
125+
if(response.isSuccessful()){
126+
System.out.println(response.body());
127+
}else{
128+
System.out.println(response.errorBody());
117129
}
118130
```
119131

120132
### Helpful Links
121133

122134
- [Contentstack Website](https://www.contentstack.com/)
123-
- [Official Documentation](https://contentstack.com/docs)
135+
- [API Reference Documentation](https://www.contentstack.com/docs/developers/sdks/content-management-sdk/java)
124136
- [Content Management API Docs](https://www.contentstack.com/docs/developers/apis/content-management-api)
125137

126138
### The MIT License (MIT)
127139

128-
Copyright © 2012-2022 [Contentstack](https://www.contentstack.com/). All Rights Reserved
129-
130-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
140+
Copyright © 2012-2023 [Contentstack](https://www.contentstack.com/). All Rights Reserved
131141

132-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
142+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
143+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
144+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
145+
persons to whom the Software is furnished to do so, subject to the following conditions:
133146

134-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
147+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
148+
Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
149+
TO THE
150+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
151+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
152+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SECURITY.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
## Security
22

3-
Contentstack takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations.
3+
Contentstack takes the security of our software products and services seriously, which includes all source code
4+
repositories managed through our GitHub organizations.
45

5-
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as described below.
6+
If you believe you have found a security vulnerability in any Contentstack-owned repository, please report it to us as
7+
described below.
68

79
## Reporting Security Issues
810

911
**Please do not report security vulnerabilities through public GitHub issues.**
1012

1113
Send email to [[email protected]](mailto:[email protected]).
1214

13-
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message.
15+
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we
16+
received your original message.
1417

15-
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
18+
Please include the requested information listed below (as much as you can provide) to help us better understand the
19+
nature and scope of the possible issue:
1620

1721
- Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
1822
- Full paths of source file(s) related to the manifestation of the issue

changelog.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# Changelog
22

3+
## v1.0.0
4+
5+
### Jul 12, 2023
6+
- Bug Fixed For Unlocalize An Entry
7+
- Fixed Timeout Issue
8+
- Code coverage improvements
9+
- NRP support added
10+
- General improvements with minor breaking changes
11+
312
## v0.1.0
413

5-
### 20-OCT-2022
14+
### Initial Release
615

16+
### Oct 20, 2022
717
Initial release for Contentstack CMA base Java management SDK

cms.iml

-42
This file was deleted.

jitpack.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
jdk:
2+
- openjdk17
3+
before_install:
4+
- sdk install java 17.0.3-tem
5+
- sdk use java 17.0.3-tem
6+
- sdk install maven
7+
- mvn -v
8+
install:
9+
- mvn install -Dmaven.javadoc.skip=true -DskipTests

0 commit comments

Comments
 (0)