@@ -30,15 +30,11 @@ public class ApiClient {
30
30
31
31
private boolean debugging = false ;
32
32
private Map <String , String > defaultHeaderMap = new HashMap <String , String >();
33
- private Map <String , String > defaultCookieMap = new HashMap <String , String >();
34
33
35
34
private String basePath ;
36
35
private String appId , apiKey ;
37
36
38
37
private DateFormat dateFormat ;
39
- private DateFormat datetimeFormat ;
40
- private boolean lenientDatetimeFormat ;
41
- private int dateLength ;
42
38
43
39
private InputStream sslCaCert ;
44
40
private boolean verifyingSsl ;
@@ -207,18 +203,6 @@ public ApiClient addDefaultHeader(String key, String value) {
207
203
return this ;
208
204
}
209
205
210
- /**
211
- * Add a default cookie.
212
- *
213
- * @param key The cookie's key
214
- * @param value The cookie's value
215
- * @return ApiClient
216
- */
217
- public ApiClient addDefaultCookie (String key , String value ) {
218
- defaultCookieMap .put (key , value );
219
- return this ;
220
- }
221
-
222
206
/**
223
207
* Check that whether debugging is enabled for this API client.
224
208
*
@@ -515,7 +499,11 @@ public String selectHeaderAccept(String[] accepts) {
515
499
return accept ;
516
500
}
517
501
}
518
- return StringUtil .join (accepts , "," );
502
+ StringJoiner joiner = new StringJoiner ("," );
503
+ for (String s : accepts ) {
504
+ joiner .add (s );
505
+ }
506
+ return joiner .toString ();
519
507
}
520
508
521
509
/**
@@ -812,9 +800,6 @@ public <T> T handleResponse(Response response, Type returnType)
812
800
* @param collectionQueryParams The collection query parameters
813
801
* @param body The request body object
814
802
* @param headerParams The header parameters
815
- * @param cookieParams The cookie parameters
816
- * @param formParams The form parameters
817
- * @param authNames The authentications to apply
818
803
* @param callback Callback for upload/download progress
819
804
* @return The HTTP call
820
805
* @throws ApiException If fail to serialize the request body object
@@ -826,9 +811,6 @@ public Call buildCall(
826
811
List <Pair > collectionQueryParams ,
827
812
Object body ,
828
813
Map <String , String > headerParams ,
829
- Map <String , String > cookieParams ,
830
- Map <String , Object > formParams ,
831
- String [] authNames ,
832
814
ApiCallback callback
833
815
) throws ApiException {
834
816
Request request = buildRequest (
@@ -838,9 +820,6 @@ public Call buildCall(
838
820
collectionQueryParams ,
839
821
body ,
840
822
headerParams ,
841
- cookieParams ,
842
- formParams ,
843
- authNames ,
844
823
callback
845
824
);
846
825
@@ -857,9 +836,6 @@ public Call buildCall(
857
836
* @param collectionQueryParams The collection query parameters
858
837
* @param body The request body object
859
838
* @param headerParams The header parameters
860
- * @param cookieParams The cookie parameters
861
- * @param formParams The form parameters
862
- * @param authNames The authentications to apply
863
839
* @param callback Callback for upload/download progress
864
840
* @return The HTTP request
865
841
* @throws ApiException If fail to serialize the request body object
@@ -871,17 +847,14 @@ public Request buildRequest(
871
847
List <Pair > collectionQueryParams ,
872
848
Object body ,
873
849
Map <String , String > headerParams ,
874
- Map <String , String > cookieParams ,
875
- Map <String , Object > formParams ,
876
- String [] authNames ,
877
850
ApiCallback callback
878
851
) throws ApiException {
879
- updateParamsForAuth (authNames , queryParams , headerParams , cookieParams );
852
+ headerParams .put ("X-Algolia-Application-Id" , this .appId );
853
+ headerParams .put ("X-Algolia-API-Key" , this .apiKey );
880
854
881
855
final String url = buildUrl (path , queryParams , collectionQueryParams );
882
856
final Request .Builder reqBuilder = new Request .Builder ().url (url );
883
857
processHeaderParams (headerParams , reqBuilder );
884
- processCookieParams (cookieParams , reqBuilder );
885
858
886
859
String contentType = (String ) headerParams .get ("Content-Type" );
887
860
// ensuring a default content type
@@ -892,10 +865,6 @@ public Request buildRequest(
892
865
RequestBody reqBody ;
893
866
if (!HttpMethod .permitsRequestBody (method )) {
894
867
reqBody = null ;
895
- } else if ("application/x-www-form-urlencoded" .equals (contentType )) {
896
- reqBody = buildRequestBodyFormEncoding (formParams );
897
- } else if ("multipart/form-data" .equals (contentType )) {
898
- reqBody = buildRequestBodyMultipart (formParams );
899
868
} else if (body == null ) {
900
869
if ("DELETE" .equals (method )) {
901
870
// allow calling DELETE without sending a request body
@@ -1006,50 +975,6 @@ public void processHeaderParams(
1006
975
}
1007
976
}
1008
977
1009
- /**
1010
- * Set cookie parameters to the request builder, including default cookies.
1011
- *
1012
- * @param cookieParams Cookie parameters in the form of Map
1013
- * @param reqBuilder Request.Builder
1014
- */
1015
- public void processCookieParams (
1016
- Map <String , String > cookieParams ,
1017
- Request .Builder reqBuilder
1018
- ) {
1019
- for (Entry <String , String > param : cookieParams .entrySet ()) {
1020
- reqBuilder .addHeader (
1021
- "Cookie" ,
1022
- String .format ("%s=%s" , param .getKey (), param .getValue ())
1023
- );
1024
- }
1025
- for (Entry <String , String > param : defaultCookieMap .entrySet ()) {
1026
- if (!cookieParams .containsKey (param .getKey ())) {
1027
- reqBuilder .addHeader (
1028
- "Cookie" ,
1029
- String .format ("%s=%s" , param .getKey (), param .getValue ())
1030
- );
1031
- }
1032
- }
1033
- }
1034
-
1035
- /**
1036
- * Update query and header parameters based on authentication settings.
1037
- *
1038
- * @param authNames The authentications to apply
1039
- * @param queryParams List of query parameters
1040
- * @param headerParams Map of header parameters
1041
- * @param cookieParams Map of cookie parameters
1042
- */
1043
- public void updateParamsForAuth (
1044
- String [] authNames ,
1045
- List <Pair > queryParams ,
1046
- Map <String , String > headerParams ,
1047
- Map <String , String > cookieParams
1048
- ) {
1049
- headerParams .put ("X-Algolia-Application-Id" , this .appId );
1050
- headerParams .put ("X-Algolia-API-Key" , this .apiKey );
1051
- }
1052
-
1053
978
/**
1054
979
* Build a form-encoding request body with the given form parameters.
1055
980
*
0 commit comments