1+
2+ /**
3+ * The top most package to access contentstack instance
4+ */
15package com .contentstack .cms ;
26
37import com .contentstack .cms .core .AuthInterceptor ;
4- import com .contentstack .cms .models .Error ;
58import com .contentstack .cms .core .Util ;
9+ import com .contentstack .cms .models .Error ;
610import com .contentstack .cms .models .LoginDetails ;
711import com .contentstack .cms .organization .Organization ;
812import com .contentstack .cms .stack .Stack ;
913import com .contentstack .cms .user .User ;
1014import com .google .gson .Gson ;
1115import okhttp3 .OkHttpClient ;
1216import okhttp3 .ResponseBody ;
17+ import okhttp3 .logging .HttpLoggingInterceptor ;
1318import org .jetbrains .annotations .NotNull ;
1419import retrofit2 .Response ;
1520import retrofit2 .Retrofit ;
1621import retrofit2 .converter .gson .GsonConverterFactory ;
17- import okhttp3 .logging .HttpLoggingInterceptor ;
1822
1923import java .io .IOException ;
2024import java .net .Proxy ;
2529import static com .contentstack .cms .core .Util .*;
2630
2731/**
28- * The type Contentstack.
32+ * <b>Contentstack Java Management SDK</b>
33+ * <br>
34+ * <b>Contentstack Java Management SDK</b> interact with the Content Management APIs and allow you to create, update,
35+ * delete, and fetch content from your Contentstack account. They are read-write in nature.
36+ * <br>
37+ * You can use them to build your own apps and manage your content from Contentstack.
2938 */
3039public class Contentstack {
3140
@@ -63,7 +72,11 @@ public class Contentstack {
6372 * </pre>
6473 * <br>
6574 *
66- * @return User user
75+ * @return User
76+ * @author ***REMOVED***
77+ * @see <a href="https://www.contentstack.com/docs/developers/apis/content-management-api/#users">User
78+ * </a>
79+ * @since 2022-05-19
6780 */
6881 public User user () {
6982 if (this .authtoken == null )
@@ -103,12 +116,15 @@ public User user() {
103116 * <br>
104117 *
105118 * @param emailId
106- * the email id
119+ * the email id of the user
107120 * @param password
108- * the password
109- * @return response the Response type of @{@link LoginDetails}
121+ * the password of the user
122+ * @return LoginDetails
110123 * @throws IOException
111- * the io exception
124+ * the IOException
125+ * @author ***REMOVED***
126+ * @see <a href="https://www.contentstack.com/docs/developers/apis/content-management-api/#users">User
127+ * </a>
112128 */
113129 public Response <LoginDetails > login (String emailId , String password ) throws IOException {
114130 if (this .authtoken != null )
@@ -155,9 +171,16 @@ public Response<LoginDetails> login(String emailId, String password) throws IOEx
155171 * the password
156172 * @param tfaToken
157173 * the tfa token
158- * @return response the Response type of @{@link LoginDetails} throws {@link IOException}
174+ * @return LoginDetails
159175 * @throws IOException
160176 * the io exception
177+ * @throws IOException
178+ * the IOException
179+ * @author ***REMOVED***
180+ * @see <a
181+ * href="https://www.contentstack.com/docs/developers/apis/content-management-api/#log-in-to-your-account">Login
182+ * your account
183+ * </a>
161184 */
162185 public Response <LoginDetails > login (String emailId , String password , String tfaToken ) throws IOException {
163186 if (this .authtoken != null )
@@ -264,7 +287,7 @@ public Organization organization() {
264287 public Stack stack () {
265288 if (this .authtoken == null )
266289 throw new IllegalStateException (ILLEGAL_USER );
267- return new Stack (this .instance );
290+ return new Stack (this .instance , this . authtoken );
268291 }
269292
270293
@@ -288,7 +311,9 @@ public Stack stack() {
288311 */
289312 public Stack stack (@ NotNull Map <String , Object > header ) {
290313 if (this .authtoken == null )
291- throw new IllegalStateException (PLEASE_LOGIN );
314+ if (header .size () == 0 ) {
315+ throw new IllegalStateException (PLEASE_LOGIN );
316+ }
292317 return new Stack (this .instance , header );
293318 }
294319
@@ -398,9 +423,11 @@ public Builder() {
398423 * InetSocketAddress(proxyHost, proxyPort));
399424 * <br>
400425 * <pre>
401- * Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("hostname", 433));
402- * Contentstack contentstack = new Contentstack.Builder().setProxy(proxy).build();
403- * </pre>
426+ * {
427+ * Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("hostname", 433));
428+ * Contentstack contentstack = new Contentstack.Builder().setProxy(proxy).build();
429+ * }
430+ * </pre>
404431 *
405432 * @param proxy
406433 * the proxy
0 commit comments