Skip to content

Commit eed9957

Browse files
committed
review
1 parent eefd5a4 commit eed9957

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

clients/algoliasearch-client-java-2/.openapi-generator-ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ gradle*
1919

2020
# Selective source file
2121
algoliasearch-core/com/algolia/auth/**
22+
algoliasearch-core/com/algolia/ApiException.java
2223
algoliasearch-core/com/algolia/Configuration.java
2324
algoliasearch-core/com/algolia/Server*.java
2425
algoliasearch-core/com/algolia/StringUtil.java

generators/src/main/java/com/algolia/codegen/AlgoliaJavaGenerator.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ public void processOpts() {
168168
"algoliasearch-core/com/algolia/utils/echo",
169169
"EchoResponse.java"));
170170

171-
// remove ApiException.java
172-
for (int i = 0; i < supportingFiles.size(); i++) {
173-
if (supportingFiles.get(i).getTemplateFile().equals("apiException.mustache")) {
174-
supportingFiles.remove(i);
175-
break;
176-
}
177-
}
178-
179171
// Prevent all useless file to generate
180172
apiTestTemplateFiles.clear();
181173
modelTestTemplateFiles.clear();

playground/java/src/main/java/com/algolia/playground/App.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,29 @@ public static void main(String[] args) {
1313
Dotenv dotenv = Dotenv.configure().directory("../").load();
1414

1515
SearchApi client = new SearchApi(dotenv.get("ALGOLIA_APPLICATION_ID"), dotenv.get("ALGOLIA_SEARCH_KEY"));
16+
1617
String indexName = dotenv.get("SEARCH_INDEX");
1718
SearchParamsObject params = new SearchParamsObject();
1819
params.setAroundRadius(AroundRadius.ofInteger(5));
1920
params.setQuery(dotenv.get("SEARCH_QUERY"));
21+
2022
try {
2123
SearchResponse result = client.search(indexName, SearchParams.ofSearchParamsObject(params));
2224
System.out.println(result);
2325
} catch (AlgoliaApiException e) {
26+
// the API failed
2427
System.err.println("Exception when calling SearchApi#search");
2528
System.err.println("Status code: " + e.getHttpErrorCode());
2629
System.err.println("Reason: " + e.getMessage());
2730
e.printStackTrace();
31+
2832
} catch (AlgoliaRetryException e) {
33+
// the retry failed
2934
System.err.println("Exception in the retry strategy");
3035
e.printStackTrace();
36+
3137
} catch (AlgoliaRuntimeException e) {
38+
// the serialization or something else failed
3239
e.printStackTrace();
3340
}
3441
}

templates/java/libraries/okhttp-gson/api.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ public class {{classname}} extends ApiClient {
3737
public {{classname}}(String appId, String apiKey) {
3838
super(appId, apiKey, new HttpRequester(getDefaultHosts(".")));
3939
}
40+
4041
{{/fallbackToAliasHost}}
4142
public {{classname}}(String appId, String apiKey, String region) {
4243
super(appId, apiKey, new HttpRequester(getDefaultHosts(region)));
4344
}
4445
{{/hasRegionalHost}}
46+
47+
{{^hasRegionalHost}}
4548
public {{classname}}(String appId, String apiKey) {
4649
super(appId, apiKey, new HttpRequester(getDefaultHosts(appId)));
4750
}
51+
{{/hasRegionalHost}}
4852

4953
public {{classname}}(String appId, String apiKey, Requester requester) {
5054
super(appId, apiKey, requester);

0 commit comments

Comments
 (0)