Skip to content

Commit 3f692ae

Browse files
algolia-botmillotp
andcommitted
chore: generated code for commit 4003918. [skip ci]
Co-authored-by: Pierre Millot <[email protected]>
1 parent 4003918 commit 3f692ae

23 files changed

+215
-306
lines changed

snippets/java/src/test/java/com/algolia/Ingestion.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void snippetForCreateAuthentication() {
1919
// Call the API
2020
client.createAuthentication(
2121
new AuthenticationCreate()
22-
.setType(AuthenticationType.fromValue("oauth"))
22+
.setType(AuthenticationType.OAUTH)
2323
.setName("authName")
2424
.setInput(new AuthOAuth().setUrl("http://test.oauth").setClientId("myID").setClientSecret("mySecret"))
2525
);
@@ -37,7 +37,7 @@ void snippetForCreateDestination() {
3737
// Call the API
3838
client.createDestination(
3939
new DestinationCreate()
40-
.setType(DestinationType.fromValue("search"))
40+
.setType(DestinationType.SEARCH)
4141
.setName("destinationName")
4242
.setInput(new DestinationIndexPrefix().setIndexPrefix("prefix_"))
4343
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
@@ -56,7 +56,7 @@ void snippetForCreateSource() {
5656
// Call the API
5757
client.createSource(
5858
new SourceCreate()
59-
.setType(SourceType.fromValue("commercetools"))
59+
.setType(SourceType.COMMERCETOOLS)
6060
.setName("sourceName")
6161
.setInput(
6262
new SourceCommercetools()
@@ -83,8 +83,8 @@ void snippetForCreateTask() {
8383
new TaskCreate()
8484
.setSourceID("search")
8585
.setDestinationID("destinationName")
86-
.setTrigger(new OnDemandTriggerInput().setType(OnDemandTriggerType.fromValue("onDemand")))
87-
.setAction(ActionType.fromValue("replace"))
86+
.setTrigger(new OnDemandTriggerInput().setType(OnDemandTriggerType.ON_DEMAND))
87+
.setAction(ActionType.REPLACE)
8888
);
8989
// SEPARATOR<
9090
}

snippets/java/src/test/java/com/algolia/Insights.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void snippetForPushEvents() {
8787
.setEvents(
8888
List.of(
8989
new ClickedObjectIDsAfterSearch()
90-
.setEventType(ClickEvent.fromValue("click"))
90+
.setEventType(ClickEvent.CLICK)
9191
.setEventName("Product Clicked")
9292
.setIndex("products")
9393
.setUserToken("user-123456")

snippets/java/src/test/java/com/algolia/Monitoring.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void snippetForGetMetrics() {
134134
MonitoringClient client = new MonitoringClient("YOUR_APP_ID", "YOUR_API_KEY");
135135

136136
// Call the API
137-
client.getMetrics(Metric.fromValue("avg_build_time"), Period.fromValue("minute"));
137+
client.getMetrics(Metric.AVG_BUILD_TIME, Period.MINUTE);
138138
// SEPARATOR<
139139
}
140140

snippets/java/src/test/java/com/algolia/Personalization.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void snippetForSetPersonalizationStrategy() {
110110
// Call the API
111111
client.setPersonalizationStrategy(
112112
new PersonalizationStrategyParams()
113-
.setEventScoring(List.of(new EventScoring().setScore(42).setEventName("Algolia").setEventType(EventType.fromValue("click"))))
113+
.setEventScoring(List.of(new EventScoring().setScore(42).setEventName("Algolia").setEventType(EventType.CLICK)))
114114
.setFacetScoring(List.of(new FacetScoring().setScore(42).setFacetName("Event")))
115115
.setPersonalizationImpact(42)
116116
);

snippets/java/src/test/java/com/algolia/Recommend.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void snippetForDeleteRecommendRule() {
6969
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");
7070

7171
// Call the API
72-
client.deleteRecommendRule("indexName", RecommendModels.fromValue("related-products"), "objectID");
72+
client.deleteRecommendRule("indexName", RecommendModels.RELATED_PRODUCTS, "objectID");
7373
// SEPARATOR<
7474
}
7575

@@ -82,7 +82,7 @@ void snippetForGetRecommendRule() {
8282
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");
8383

8484
// Call the API
85-
client.getRecommendRule("indexName", RecommendModels.fromValue("related-products"), "objectID");
85+
client.getRecommendRule("indexName", RecommendModels.RELATED_PRODUCTS, "objectID");
8686
// SEPARATOR<
8787
}
8888

@@ -95,7 +95,7 @@ void snippetForGetRecommendStatus() {
9595
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");
9696

9797
// Call the API
98-
client.getRecommendStatus("indexName", RecommendModels.fromValue("related-products"), 12345L);
98+
client.getRecommendStatus("indexName", RecommendModels.RELATED_PRODUCTS, 12345L);
9999
// SEPARATOR<
100100
}
101101

@@ -112,11 +112,7 @@ void snippetForGetRecommendations() {
112112
new GetRecommendationsParams()
113113
.setRequests(
114114
List.of(
115-
new RelatedQuery()
116-
.setIndexName("indexName")
117-
.setObjectID("objectID")
118-
.setModel(RelatedModel.fromValue("related-products"))
119-
.setThreshold(42.1)
115+
new RelatedQuery().setIndexName("indexName").setObjectID("objectID").setModel(RelatedModel.RELATED_PRODUCTS).setThreshold(42.1)
120116
)
121117
)
122118
);
@@ -132,7 +128,7 @@ void snippetForSearchRecommendRules() {
132128
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");
133129

134130
// Call the API
135-
client.searchRecommendRules("indexName", RecommendModels.fromValue("related-products"));
131+
client.searchRecommendRules("indexName", RecommendModels.RELATED_PRODUCTS);
136132
// SEPARATOR<
137133
}
138134
}

snippets/java/src/test/java/com/algolia/Search.java

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void snippetForAddApiKey() {
1919
// Call the API
2020
client.addApiKey(
2121
new ApiKey()
22-
.setAcl(List.of(Acl.fromValue("search"), Acl.fromValue("addObject")))
22+
.setAcl(List.of(Acl.SEARCH, Acl.ADD_OBJECT))
2323
.setDescription("my new api key")
2424
.setValidity(300)
2525
.setMaxQueriesPerIPPerHour(100)
@@ -81,8 +81,8 @@ void snippetForBatch() {
8181
new BatchWriteParams()
8282
.setRequests(
8383
List.of(
84-
new BatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "bar", "foo", "1")),
85-
new BatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "baz", "foo", "2"))
84+
new BatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "bar", "foo", "1")),
85+
new BatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "baz", "foo", "2"))
8686
)
8787
)
8888
);
@@ -100,7 +100,7 @@ void snippetForBatch1() {
100100
// Call the API
101101
client.batch(
102102
"<YOUR_INDEX_NAME>",
103-
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.fromValue("clear")).setBody(Map.of("key", "value"))))
103+
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.CLEAR).setBody(Map.of("key", "value"))))
104104
);
105105
// SEPARATOR<
106106
}
@@ -116,7 +116,7 @@ void snippetForBatch2() {
116116
// Call the API
117117
client.batch(
118118
"<YOUR_INDEX_NAME>",
119-
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.fromValue("delete")).setBody(Map.of("key", "value"))))
119+
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.DELETE).setBody(Map.of("key", "value"))))
120120
);
121121
// SEPARATOR<
122122
}
@@ -132,8 +132,7 @@ void snippetForBatch3() {
132132
// Call the API
133133
client.batch(
134134
"<YOUR_INDEX_NAME>",
135-
new BatchWriteParams()
136-
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("deleteObject")).setBody(Map.of("key", "value"))))
135+
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.DELETE_OBJECT).setBody(Map.of("key", "value"))))
137136
);
138137
// SEPARATOR<
139138
}
@@ -150,7 +149,7 @@ void snippetForBatch4() {
150149
client.batch(
151150
"<YOUR_INDEX_NAME>",
152151
new BatchWriteParams()
153-
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("partialUpdateObject")).setBody(Map.of("key", "value"))))
152+
.setRequests(List.of(new BatchRequest().setAction(Action.PARTIAL_UPDATE_OBJECT).setBody(Map.of("key", "value"))))
154153
);
155154
// SEPARATOR<
156155
}
@@ -167,7 +166,7 @@ void snippetForBatch5() {
167166
client.batch(
168167
"<YOUR_INDEX_NAME>",
169168
new BatchWriteParams()
170-
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("partialUpdateObjectNoCreate")).setBody(Map.of("key", "value"))))
169+
.setRequests(List.of(new BatchRequest().setAction(Action.PARTIAL_UPDATE_OBJECT_NO_CREATE).setBody(Map.of("key", "value"))))
171170
);
172171
// SEPARATOR<
173172
}
@@ -183,8 +182,7 @@ void snippetForBatch6() {
183182
// Call the API
184183
client.batch(
185184
"<YOUR_INDEX_NAME>",
186-
new BatchWriteParams()
187-
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("updateObject")).setBody(Map.of("key", "value"))))
185+
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.UPDATE_OBJECT).setBody(Map.of("key", "value"))))
188186
);
189187
// SEPARATOR<
190188
}
@@ -212,21 +210,21 @@ void snippetForBatchDictionaryEntries() {
212210

213211
// Call the API
214212
client.batchDictionaryEntries(
215-
DictionaryType.fromValue("plurals"),
213+
DictionaryType.PLURALS,
216214
new BatchDictionaryEntriesParams()
217215
.setClearExistingDictionaryEntries(true)
218216
.setRequests(
219217
List.of(
220218
new BatchDictionaryEntriesRequest()
221-
.setAction(DictionaryAction.fromValue("addEntry"))
219+
.setAction(DictionaryAction.ADD_ENTRY)
222220
.setBody(
223221
new DictionaryEntry()
224222
.setObjectID("1")
225-
.setLanguage(SupportedLanguage.fromValue("en"))
223+
.setLanguage(SupportedLanguage.EN)
226224
.setWord("fancy")
227225
.setWords(List.of("believe", "algolia"))
228226
.setDecomposition(List.of("trust", "algolia"))
229-
.setState(DictionaryEntryState.fromValue("enabled"))
227+
.setState(DictionaryEntryState.ENABLED)
230228
)
231229
)
232230
)
@@ -244,21 +242,21 @@ void snippetForBatchDictionaryEntries1() {
244242

245243
// Call the API
246244
client.batchDictionaryEntries(
247-
DictionaryType.fromValue("plurals"),
245+
DictionaryType.PLURALS,
248246
new BatchDictionaryEntriesParams()
249247
.setClearExistingDictionaryEntries(true)
250248
.setRequests(
251249
List.of(
252250
new BatchDictionaryEntriesRequest()
253-
.setAction(DictionaryAction.fromValue("deleteEntry"))
251+
.setAction(DictionaryAction.DELETE_ENTRY)
254252
.setBody(
255253
new DictionaryEntry()
256254
.setObjectID("1")
257-
.setLanguage(SupportedLanguage.fromValue("en"))
255+
.setLanguage(SupportedLanguage.EN)
258256
.setWord("fancy")
259257
.setWords(List.of("believe", "algolia"))
260258
.setDecomposition(List.of("trust", "algolia"))
261-
.setState(DictionaryEntryState.fromValue("enabled"))
259+
.setState(DictionaryEntryState.ENABLED)
262260
)
263261
)
264262
)
@@ -276,17 +274,14 @@ void snippetForBatchDictionaryEntries2() {
276274

277275
// Call the API
278276
client.batchDictionaryEntries(
279-
DictionaryType.fromValue("stopwords"),
277+
DictionaryType.STOPWORDS,
280278
new BatchDictionaryEntriesParams()
281279
.setRequests(
282280
List.of(
283281
new BatchDictionaryEntriesRequest()
284-
.setAction(DictionaryAction.fromValue("addEntry"))
282+
.setAction(DictionaryAction.ADD_ENTRY)
285283
.setBody(
286-
new DictionaryEntry()
287-
.setObjectID("1")
288-
.setLanguage(SupportedLanguage.fromValue("en"))
289-
.setAdditionalProperty("additional", "try me")
284+
new DictionaryEntry().setObjectID("1").setLanguage(SupportedLanguage.EN).setAdditionalProperty("additional", "try me")
290285
)
291286
)
292287
)
@@ -756,9 +751,7 @@ void snippetForMultipleBatch() {
756751
client.multipleBatch(
757752
new BatchParams()
758753
.setRequests(
759-
List.of(
760-
new MultipleBatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "value")).setIndexName("theIndexName")
761-
)
754+
List.of(new MultipleBatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "value")).setIndexName("theIndexName"))
762755
)
763756
);
764757
// SEPARATOR<
@@ -776,9 +769,9 @@ void snippetForOperationIndex() {
776769
client.operationIndex(
777770
"<SOURCE_INDEX_NAME>",
778771
new OperationIndexParams()
779-
.setOperation(OperationType.fromValue("move"))
772+
.setOperation(OperationType.MOVE)
780773
.setDestination("<DESTINATION_INDEX_NAME>")
781-
.setScope(List.of(ScopeType.fromValue("rules"), ScopeType.fromValue("settings")))
774+
.setScope(List.of(ScopeType.RULES, ScopeType.SETTINGS))
782775
);
783776
// SEPARATOR<
784777
}
@@ -794,7 +787,7 @@ void snippetForOperationIndex1() {
794787
// Call the API
795788
client.operationIndex(
796789
"<SOURCE_INDEX_NAME>",
797-
new OperationIndexParams().setOperation(OperationType.fromValue("copy")).setDestination("<DESTINATION_INDEX_NAME>")
790+
new OperationIndexParams().setOperation(OperationType.COPY).setDestination("<DESTINATION_INDEX_NAME>")
798791
);
799792
// SEPARATOR<
800793
}
@@ -810,7 +803,7 @@ void snippetForOperationIndex2() {
810803
// Call the API
811804
client.operationIndex(
812805
"<SOURCE_INDEX_NAME>",
813-
new OperationIndexParams().setOperation(OperationType.fromValue("move")).setDestination("<DESTINATION_INDEX_NAME>")
806+
new OperationIndexParams().setOperation(OperationType.MOVE).setDestination("<DESTINATION_INDEX_NAME>")
814807
);
815808
// SEPARATOR<
816809
}
@@ -831,7 +824,7 @@ void snippetForPartialUpdateObject() {
831824
"id1",
832825
AttributeToUpdate.of("test"),
833826
"id2",
834-
new BuiltInOperation().setOperation(BuiltInOperationType.fromValue("AddUnique")).setValue("test2")
827+
new BuiltInOperation().setOperation(BuiltInOperationType.ADD_UNIQUE).setValue("test2")
835828
),
836829
true
837830
);
@@ -902,9 +895,7 @@ void snippetForSaveRule() {
902895
client.saveRule(
903896
"indexName",
904897
"id1",
905-
new Rule()
906-
.setObjectID("id1")
907-
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.fromValue("contains"))))
898+
new Rule().setObjectID("id1").setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.CONTAINS)))
908899
);
909900
// SEPARATOR<
910901
}
@@ -923,10 +914,10 @@ void snippetForSaveRules() {
923914
List.of(
924915
new Rule()
925916
.setObjectID("a-rule-id")
926-
.setConditions(List.of(new Condition().setPattern("smartphone").setAnchoring(Anchoring.fromValue("contains")))),
917+
.setConditions(List.of(new Condition().setPattern("smartphone").setAnchoring(Anchoring.CONTAINS))),
927918
new Rule()
928919
.setObjectID("a-second-rule-id")
929-
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.fromValue("contains"))))
920+
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.CONTAINS)))
930921
),
931922
false,
932923
true
@@ -946,7 +937,7 @@ void snippetForSaveSynonym() {
946937
client.saveSynonym(
947938
"indexName",
948939
"id1",
949-
new SynonymHit().setObjectID("id1").setType(SynonymType.fromValue("synonym")).setSynonyms(List.of("car", "vehicule", "auto")),
940+
new SynonymHit().setObjectID("id1").setType(SynonymType.SYNONYM).setSynonyms(List.of("car", "vehicule", "auto")),
950941
true
951942
);
952943
// SEPARATOR<
@@ -964,10 +955,10 @@ void snippetForSaveSynonyms() {
964955
client.saveSynonyms(
965956
"<YOUR_INDEX_NAME>",
966957
List.of(
967-
new SynonymHit().setObjectID("id1").setType(SynonymType.fromValue("synonym")).setSynonyms(List.of("car", "vehicule", "auto")),
958+
new SynonymHit().setObjectID("id1").setType(SynonymType.SYNONYM).setSynonyms(List.of("car", "vehicule", "auto")),
968959
new SynonymHit()
969960
.setObjectID("id2")
970-
.setType(SynonymType.fromValue("onewaysynonym"))
961+
.setType(SynonymType.ONEWAYSYNONYM)
971962
.setInput("iphone")
972963
.setSynonyms(List.of("ephone", "aphone", "yphone"))
973964
),
@@ -1101,7 +1092,7 @@ void snippetForSearchDictionaryEntries() {
11011092
SearchClient client = new SearchClient("YOUR_APP_ID", "YOUR_API_KEY");
11021093

11031094
// Call the API
1104-
client.searchDictionaryEntries(DictionaryType.fromValue("stopwords"), new SearchDictionaryEntriesParams().setQuery("about"));
1095+
client.searchDictionaryEntries(DictionaryType.STOPWORDS, new SearchDictionaryEntriesParams().setQuery("about"));
11051096
// SEPARATOR<
11061097
}
11071098

@@ -1213,11 +1204,7 @@ void snippetForUpdateApiKey() {
12131204
// Call the API
12141205
client.updateApiKey(
12151206
"myApiKey",
1216-
new ApiKey()
1217-
.setAcl(List.of(Acl.fromValue("search"), Acl.fromValue("addObject")))
1218-
.setValidity(300)
1219-
.setMaxQueriesPerIPPerHour(100)
1220-
.setMaxHitsPerQuery(20)
1207+
new ApiKey().setAcl(List.of(Acl.SEARCH, Acl.ADD_OBJECT)).setValidity(300).setMaxQueriesPerIPPerHour(100).setMaxHitsPerQuery(20)
12211208
);
12221209
// SEPARATOR<
12231210
}

snippets/java/src/test/java/com/algolia/Usage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void snippetForGetIndexUsage() {
6969
UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
7070

7171
// Call the API
72-
client.getIndexUsage(Statistic.fromValue("queries_operations"), "myIndexName", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z");
72+
client.getIndexUsage(Statistic.QUERIES_OPERATIONS, "myIndexName", "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z");
7373
// SEPARATOR<
7474
}
7575

@@ -82,7 +82,7 @@ void snippetForGetUsage() {
8282
UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");
8383

8484
// Call the API
85-
client.getUsage(Statistic.fromValue("queries_operations"), "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z");
85+
client.getUsage(Statistic.QUERIES_OPERATIONS, "2024-04-03T12:46:43Z", "2024-04-05T12:46:43Z");
8686
// SEPARATOR<
8787
}
8888
}

0 commit comments

Comments
 (0)