@@ -14,42 +14,67 @@ public class Config implements Serializable {
1414 protected final String signature ;
1515 protected final String returnUrl ;
1616
17- /** Construct basic config. */
17+ /**
18+ * Constructs configuration for {@link Client} class.
19+ * @param apiKey - an API key obtained from the Developer Portal
20+ * @param policy - access policy, one can be created with {@link Policy.Builder}
21+ */
22+ public Config (String apiKey , Policy policy ) {
23+ this (apiKey , null , policy .getEncodedPolicy (), policy .getSignature ());
24+ }
25+
26+ /**
27+ * Constructs basic configuration for {@link Client} class without any security policy.
28+ * @param apiKey - an API key obtained from the Developer Portal
29+ */
1830 public Config (String apiKey ) {
19- this .apiKey = apiKey ;
20- this .returnUrl = null ;
21- this .policy = null ;
22- this .signature = null ;
31+ this (apiKey , null , null , null );
2332 }
2433
25- /** Construct config for auth.*/
34+ /**
35+ * Constructs basic configuration for {@link Client} class without any security policy.
36+ * @param apiKey - an API key obtained from the Developer Portal
37+ * @param returnUrl - returnUrl used for building JSON bodies with {@link com.filestack.internal.CloudServiceUtil}
38+ * @deprecated use {@link #Config(String)} instead and manually pass returnUrl to
39+ * {@link com.filestack.internal.CloudServiceUtil#buildBaseJson(Config, String, String)} if necessary
40+ */
41+ @ Deprecated
2642 public Config (String apiKey , String returnUrl ) {
27- this .apiKey = apiKey ;
28- this .returnUrl = returnUrl ;
29- this .policy = null ;
30- this .signature = null ;
43+ this (apiKey , returnUrl , null , null );
3144 }
3245
33- /** Construct config for security. */
34- public Config (String apiKey , String policy , String signature ) {
35- this .apiKey = apiKey ;
36- this .returnUrl = null ;
37- this .policy = policy ;
38- this .signature = signature ;
46+ /**
47+ * Constructs configuration for {@link Client} class.
48+ * @param apiKey - an API key obtained from the Developer Portal
49+ * @param encodedPolicy - encoded policy, obtain one using {@link Policy#getEncodedPolicy()}
50+ * @param signature - policy signature, obtain one using {@link Policy#getSignature()}
51+ */
52+ public Config (String apiKey , String encodedPolicy , String signature ) {
53+ this (apiKey , null , encodedPolicy , signature );
3954 }
4055
41- /** Construct config for auth and security. */
42- public Config (String apiKey , String returnUrl , String policy , String signature ) {
56+ /**
57+ * Constructs configuration for {@link Client} class.
58+ * @param apiKey - an API key obtained from the Developer Portal
59+ * @param encodedPolicy - encoded policy, obtain one using {@link Policy#getEncodedPolicy()}
60+ * @param signature - policy signature, obtain one using {@link Policy#getSignature()}
61+ * @param returnUrl - returnUrl used for building JSON bodies with {@link com.filestack.internal.CloudServiceUtil}
62+ * @deprecated use {@link #Config(String, String, String)} instead and manually pass returnUrl to
63+ * {@link com.filestack.internal.CloudServiceUtil#buildBaseJson(Config, String, String)} if necessary
64+ */
65+ @ Deprecated
66+ public Config (String apiKey , String returnUrl , String encodedPolicy , String signature ) {
4367 this .apiKey = apiKey ;
4468 this .returnUrl = returnUrl ;
45- this .policy = policy ;
69+ this .policy = encodedPolicy ;
4670 this .signature = signature ;
4771 }
4872
4973 public String getApiKey () {
5074 return apiKey ;
5175 }
5276
77+ @ Deprecated
5378 public String getReturnUrl () {
5479 return returnUrl ;
5580 }
0 commit comments