Skip to content

Commit b0bb05e

Browse files
❇️ Environment added
1 parent 05e4c4a commit b0bb05e

File tree

20 files changed

+102
-80
lines changed

20 files changed

+102
-80
lines changed

README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,16 @@ Contentstack is a headless CMS with an API-first approach. It is a CMS that deve
2929

3030
To use the Contentstack management sdk for Java, you must have:
3131

32-
- a suitable [Java Development Environment](http://www.oracle.com/technetwork/java/javase/downloads/).
33-
- an [Contentstack](https://www.contentstack.com) account.
34-
- login your account
35-
- get the [Contentstack](https://www.contentstack.com) credentials (API keys and Management Token) set in your stack token section.
36-
- should be Java 1.8 or above installed.
37-
- make sure java environment is set on your machine
32+
- The suitable [Java Development Environment](http://www.oracle.com/technetwork/java/javase/downloads/).
33+
- The [Contentstack](https://www.contentstack.com) account.
34+
- Login your account
35+
- Get the [Contentstack](https://www.contentstack.com) credentials (API keys and Management Token) set in your stack token section.
36+
- Should be Java 1.8 or above installed.
3837

39-
## Installation
38+
## Setup
4039

41-
To include the SDK your project, use one of the following methods depending on your build system or IDE:
40+
To use Contentstack management sdk in our Maven project, we'll need to add the following dependency to our pom.xml:
4241

43-
_Install using maven [Apache Maven](https://maven.apache.org/) --- If you use Apache Maven, you can specify dependency in the dependencies section in your project_
4442

4543
```java
4644
<dependency>
@@ -50,13 +48,13 @@ _Install using maven [Apache Maven](https://maven.apache.org/) --- If you use Ap
5048
</dependency>
5149
```
5250

53-
_Install using maven [Gradle](https://gradle.org/) --- If you use Gradle, you can import the Maven Bill of Materials (BOM) in your Gradle project to automatically manage SDK dependencies_
51+
Or, for a Gradle project:
5452

5553
```java
5654
implementation 'com.contentstack.cms:{version}'
5755
```
5856

59-
- _Get the latest version_ [HERE](https://search.maven.org/artifact/com.contentstack.cma)
57+
- Download the latest version [HERE](https://search.maven.org/artifact/com.contentstack.cma)
6058

6159
## Initialization
6260

@@ -124,7 +122,7 @@ Response<ResponseBody> response = organization.getAll().execute();
124122

125123
## Stacks
126124

127-
A [stack](https://www.contentstack.com/docs/developers/set-up-stack/about-stack) is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.
125+
A [Stack](https://www.contentstack.com/docs/developers/set-up-stack/about-stack) is a space that stores the content of a project (a web or mobile property). Within a stack, you can create content structures, content entries, users, etc. related to the project.
128126

129127
```java
130128
Contentstack client = new Contentstack.Builder().build();

src/main/java/com/contentstack/cms/Contentstack.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.contentstack.cms;
22

33
import com.contentstack.cms.core.AuthInterceptor;
4-
import com.contentstack.cms.core.Error;
4+
import com.contentstack.cms.models.Error;
55
import com.contentstack.cms.core.Util;
66
import com.contentstack.cms.models.LoginDetails;
77
import com.contentstack.cms.organization.Organization;

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public Logger getLOGGER() {
1212
return logger;
1313
}
1414

15-
public CMSLogger(@NotNull Class className) {
15+
public CMSLogger(@NotNull Class<?> className) {
1616
logger = Logger.getLogger(className.getSimpleName());
1717
}
1818

@@ -28,9 +28,7 @@ public void finer(@NotNull String message) {
2828
logger.finer(message);
2929
}
3030

31-
public void warning(@NotNull String message) {
32-
logger.warning(message);
33-
}
31+
public void warning(@NotNull String message) { logger.warning(message);}
3432

3533
public void severe(@NotNull String message) {
3634
logger.severe(message);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.contentstack.cms.core;
2+
3+
public class CMSRuntimeException extends Exception {
4+
5+
public CMSRuntimeException(String message) {
6+
super(message);
7+
}
8+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import java.util.Objects;
99

1010
public class CSResponse {
11+
1112
private static final String MODEL_NULL_CHECK = "model class == null";
1213
private static final String RESPONSE_NULL = "response == null";
1314
private final Response<ResponseBody> response;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.contentstack.cms.core;
2+
3+
public interface Callback {
4+
void result();
5+
void fail();
6+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.contentstack.cms.core;
22

3+
import com.contentstack.cms.models.Error;
34
import com.google.gson.Gson;
45
import retrofit2.Call;
56
import retrofit2.Response;

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public class Util {
1313

1414
static final String PRIVATE_CONSTRUCTOR = "private constructor can't be accessed outside the class";
1515
public static final Boolean RETRY_ON_FAILURE = true;
16-
public static final String PROTOCOL = "https"; // protocol
17-
public static final String HOST = "api.contentstack.io"; // host of the url
18-
public static final String PORT = "443"; // https port
19-
public static final String VERSION = "v3"; // api version
20-
public static final int TIMEOUT = 30; // default timeout in seconds
16+
public static final String PROTOCOL = "https";
17+
public static final String HOST = "api.contentstack.io";
18+
public static final String PORT = "443";
19+
public static final String VERSION = "v3";
20+
public static final int TIMEOUT = 30;
2121
public static final String SDK_NAME = "contentstack-management-java";
2222
public static final String SDK_VERSION = "0.0.1";
2323
public static final String ILLEGAL_USER = "Please Login to access stack instance";
@@ -59,7 +59,11 @@ protected static String defaultUserAgent() {
5959
*/
6060
public static void nullEmptyThrowsException(@NotNull String field) {
6161
Objects.requireNonNull(field);
62-
throw new RuntimeException(field + " cannot take in an empty String or null value");
62+
try {
63+
throw new CMSRuntimeException(field + " cannot take in an empty String or null value");
64+
} catch (CMSRuntimeException e) {
65+
e.printStackTrace();
66+
}
6367
}
6468

6569
/**

src/main/java/com/contentstack/cms/core/Error.java renamed to src/main/java/com/contentstack/cms/models/Error.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.contentstack.cms.core;
1+
package com.contentstack.cms.models;
22

33
import com.google.gson.annotations.SerializedName;
44
import lombok.Getter;

src/main/java/com/contentstack/cms/organization/OrganizationService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ Call<ResponseBody> inviteUser(
2828
@Path("organization_uid") String uid,
2929
@Body RequestBody body);
3030

31-
// @DELETE("organizations/{organization_uid}/share")
3231
@HTTP(method = "DELETE", path = "organizations/{organization_uid}/share", hasBody = true)
3332
Call<ResponseBody> removeUser(
3433
@Path("organization_uid") String uid,

0 commit comments

Comments
 (0)