Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.

Commit 26f8a01

Browse files
committed
Documentation: updates
1 parent a56c3ac commit 26f8a01

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

algoliasearch/src/main/java/com/algolia/search/saas/BaseAPIClient.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void setUserToken(String userToken) {
133133

134134
/**
135135
* List all existing indexes
136-
* return an JSON Object in the form:
136+
* @return a JSON Object in the form:
137137
* { "items": [ {"name": "contacts", "createdAt": "2013-01-18T15:33:13.556Z"},
138138
* {"name": "notes", "createdAt": "2013-01-18T15:33:13.556Z"}]}
139139
*/
@@ -145,7 +145,7 @@ protected JSONObject listIndexes() throws AlgoliaException {
145145
* Delete an index
146146
*
147147
* @param indexName the name of index to delete
148-
* return an object containing a "deletedAt" attribute
148+
* @return an object containing a "deletedAt" attribute
149149
*/
150150
protected JSONObject deleteIndex(String indexName) throws AlgoliaException {
151151
try {
@@ -317,6 +317,13 @@ protected JSONObject putRequest(String url, String obj) throws AlgoliaException
317317
return _request(Method.PUT, url, obj, writeHostsArray, httpConnectTimeoutMS, httpSocketTimeoutMS);
318318
}
319319

320+
/**
321+
* Reads the answer and return it as a String
322+
*
323+
* @param istream the InputStream to read
324+
* @return the stream's content
325+
* @throws IOException
326+
*/
320327
private String _getAnswer(InputStream istream) throws IOException {
321328
InputStreamReader is = new InputStreamReader(istream, "UTF-8");
322329
StringBuilder builder= new StringBuilder();
@@ -338,6 +345,18 @@ private JSONObject _getAnswerObject(InputStream istream) throws IOException, JSO
338345
return _getJSONObject(_getAnswer(istream));
339346
}
340347

348+
/**
349+
* Send the query according to parameters and returns its result as a JSONObject
350+
*
351+
* @param m HTTP Method to use
352+
* @param url endpoint URL
353+
* @param json optional JSON Object to send
354+
* @param hostsArray array of hosts to try successively
355+
* @param connectTimeout maximum wait time to open connection
356+
* @param readTimeout maximum time to read data on socket
357+
* @return a JSONObject containing the resulting data or error
358+
* @throws AlgoliaException
359+
*/
341360
private synchronized JSONObject _request(Method m, String url, String json, List<String> hostsArray, int connectTimeout, int readTimeout) throws AlgoliaException {
342361
String requestMethod;
343362
HashMap<String, String> errors = new HashMap<String, String>();

0 commit comments

Comments
 (0)