Skip to content

Commit

Permalink
chore: generated code for commit 4003918. [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Jun 12, 2024
1 parent 4003918 commit 3f692ae
Show file tree
Hide file tree
Showing 23 changed files with 215 additions and 306 deletions.
10 changes: 5 additions & 5 deletions snippets/java/src/test/java/com/algolia/Ingestion.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void snippetForCreateAuthentication() {
// Call the API
client.createAuthentication(
new AuthenticationCreate()
.setType(AuthenticationType.fromValue("oauth"))
.setType(AuthenticationType.OAUTH)
.setName("authName")
.setInput(new AuthOAuth().setUrl("http://test.oauth").setClientId("myID").setClientSecret("mySecret"))
);
Expand All @@ -37,7 +37,7 @@ void snippetForCreateDestination() {
// Call the API
client.createDestination(
new DestinationCreate()
.setType(DestinationType.fromValue("search"))
.setType(DestinationType.SEARCH)
.setName("destinationName")
.setInput(new DestinationIndexPrefix().setIndexPrefix("prefix_"))
.setAuthenticationID("6c02aeb1-775e-418e-870b-1faccd4b2c0f")
Expand All @@ -56,7 +56,7 @@ void snippetForCreateSource() {
// Call the API
client.createSource(
new SourceCreate()
.setType(SourceType.fromValue("commercetools"))
.setType(SourceType.COMMERCETOOLS)
.setName("sourceName")
.setInput(
new SourceCommercetools()
Expand All @@ -83,8 +83,8 @@ void snippetForCreateTask() {
new TaskCreate()
.setSourceID("search")
.setDestinationID("destinationName")
.setTrigger(new OnDemandTriggerInput().setType(OnDemandTriggerType.fromValue("onDemand")))
.setAction(ActionType.fromValue("replace"))
.setTrigger(new OnDemandTriggerInput().setType(OnDemandTriggerType.ON_DEMAND))
.setAction(ActionType.REPLACE)
);
// SEPARATOR<
}
Expand Down
2 changes: 1 addition & 1 deletion snippets/java/src/test/java/com/algolia/Insights.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void snippetForPushEvents() {
.setEvents(
List.of(
new ClickedObjectIDsAfterSearch()
.setEventType(ClickEvent.fromValue("click"))
.setEventType(ClickEvent.CLICK)
.setEventName("Product Clicked")
.setIndex("products")
.setUserToken("user-123456")
Expand Down
2 changes: 1 addition & 1 deletion snippets/java/src/test/java/com/algolia/Monitoring.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void snippetForGetMetrics() {
MonitoringClient client = new MonitoringClient("YOUR_APP_ID", "YOUR_API_KEY");

// Call the API
client.getMetrics(Metric.fromValue("avg_build_time"), Period.fromValue("minute"));
client.getMetrics(Metric.AVG_BUILD_TIME, Period.MINUTE);
// SEPARATOR<
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void snippetForSetPersonalizationStrategy() {
// Call the API
client.setPersonalizationStrategy(
new PersonalizationStrategyParams()
.setEventScoring(List.of(new EventScoring().setScore(42).setEventName("Algolia").setEventType(EventType.fromValue("click"))))
.setEventScoring(List.of(new EventScoring().setScore(42).setEventName("Algolia").setEventType(EventType.CLICK)))
.setFacetScoring(List.of(new FacetScoring().setScore(42).setFacetName("Event")))
.setPersonalizationImpact(42)
);
Expand Down
14 changes: 5 additions & 9 deletions snippets/java/src/test/java/com/algolia/Recommend.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void snippetForDeleteRecommendRule() {
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");

// Call the API
client.deleteRecommendRule("indexName", RecommendModels.fromValue("related-products"), "objectID");
client.deleteRecommendRule("indexName", RecommendModels.RELATED_PRODUCTS, "objectID");
// SEPARATOR<
}

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

// Call the API
client.getRecommendRule("indexName", RecommendModels.fromValue("related-products"), "objectID");
client.getRecommendRule("indexName", RecommendModels.RELATED_PRODUCTS, "objectID");
// SEPARATOR<
}

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

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

Expand All @@ -112,11 +112,7 @@ void snippetForGetRecommendations() {
new GetRecommendationsParams()
.setRequests(
List.of(
new RelatedQuery()
.setIndexName("indexName")
.setObjectID("objectID")
.setModel(RelatedModel.fromValue("related-products"))
.setThreshold(42.1)
new RelatedQuery().setIndexName("indexName").setObjectID("objectID").setModel(RelatedModel.RELATED_PRODUCTS).setThreshold(42.1)
)
)
);
Expand All @@ -132,7 +128,7 @@ void snippetForSearchRecommendRules() {
RecommendClient client = new RecommendClient("YOUR_APP_ID", "YOUR_API_KEY");

// Call the API
client.searchRecommendRules("indexName", RecommendModels.fromValue("related-products"));
client.searchRecommendRules("indexName", RecommendModels.RELATED_PRODUCTS);
// SEPARATOR<
}
}
81 changes: 34 additions & 47 deletions snippets/java/src/test/java/com/algolia/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void snippetForAddApiKey() {
// Call the API
client.addApiKey(
new ApiKey()
.setAcl(List.of(Acl.fromValue("search"), Acl.fromValue("addObject")))
.setAcl(List.of(Acl.SEARCH, Acl.ADD_OBJECT))
.setDescription("my new api key")
.setValidity(300)
.setMaxQueriesPerIPPerHour(100)
Expand Down Expand Up @@ -81,8 +81,8 @@ void snippetForBatch() {
new BatchWriteParams()
.setRequests(
List.of(
new BatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "bar", "foo", "1")),
new BatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "baz", "foo", "2"))
new BatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "bar", "foo", "1")),
new BatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "baz", "foo", "2"))
)
)
);
Expand All @@ -100,7 +100,7 @@ void snippetForBatch1() {
// Call the API
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.fromValue("clear")).setBody(Map.of("key", "value"))))
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.CLEAR).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand All @@ -116,7 +116,7 @@ void snippetForBatch2() {
// Call the API
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.fromValue("delete")).setBody(Map.of("key", "value"))))
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.DELETE).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand All @@ -132,8 +132,7 @@ void snippetForBatch3() {
// Call the API
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams()
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("deleteObject")).setBody(Map.of("key", "value"))))
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.DELETE_OBJECT).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand All @@ -150,7 +149,7 @@ void snippetForBatch4() {
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams()
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("partialUpdateObject")).setBody(Map.of("key", "value"))))
.setRequests(List.of(new BatchRequest().setAction(Action.PARTIAL_UPDATE_OBJECT).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand All @@ -167,7 +166,7 @@ void snippetForBatch5() {
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams()
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("partialUpdateObjectNoCreate")).setBody(Map.of("key", "value"))))
.setRequests(List.of(new BatchRequest().setAction(Action.PARTIAL_UPDATE_OBJECT_NO_CREATE).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand All @@ -183,8 +182,7 @@ void snippetForBatch6() {
// Call the API
client.batch(
"<YOUR_INDEX_NAME>",
new BatchWriteParams()
.setRequests(List.of(new BatchRequest().setAction(Action.fromValue("updateObject")).setBody(Map.of("key", "value"))))
new BatchWriteParams().setRequests(List.of(new BatchRequest().setAction(Action.UPDATE_OBJECT).setBody(Map.of("key", "value"))))
);
// SEPARATOR<
}
Expand Down Expand Up @@ -212,21 +210,21 @@ void snippetForBatchDictionaryEntries() {

// Call the API
client.batchDictionaryEntries(
DictionaryType.fromValue("plurals"),
DictionaryType.PLURALS,
new BatchDictionaryEntriesParams()
.setClearExistingDictionaryEntries(true)
.setRequests(
List.of(
new BatchDictionaryEntriesRequest()
.setAction(DictionaryAction.fromValue("addEntry"))
.setAction(DictionaryAction.ADD_ENTRY)
.setBody(
new DictionaryEntry()
.setObjectID("1")
.setLanguage(SupportedLanguage.fromValue("en"))
.setLanguage(SupportedLanguage.EN)
.setWord("fancy")
.setWords(List.of("believe", "algolia"))
.setDecomposition(List.of("trust", "algolia"))
.setState(DictionaryEntryState.fromValue("enabled"))
.setState(DictionaryEntryState.ENABLED)
)
)
)
Expand All @@ -244,21 +242,21 @@ void snippetForBatchDictionaryEntries1() {

// Call the API
client.batchDictionaryEntries(
DictionaryType.fromValue("plurals"),
DictionaryType.PLURALS,
new BatchDictionaryEntriesParams()
.setClearExistingDictionaryEntries(true)
.setRequests(
List.of(
new BatchDictionaryEntriesRequest()
.setAction(DictionaryAction.fromValue("deleteEntry"))
.setAction(DictionaryAction.DELETE_ENTRY)
.setBody(
new DictionaryEntry()
.setObjectID("1")
.setLanguage(SupportedLanguage.fromValue("en"))
.setLanguage(SupportedLanguage.EN)
.setWord("fancy")
.setWords(List.of("believe", "algolia"))
.setDecomposition(List.of("trust", "algolia"))
.setState(DictionaryEntryState.fromValue("enabled"))
.setState(DictionaryEntryState.ENABLED)
)
)
)
Expand All @@ -276,17 +274,14 @@ void snippetForBatchDictionaryEntries2() {

// Call the API
client.batchDictionaryEntries(
DictionaryType.fromValue("stopwords"),
DictionaryType.STOPWORDS,
new BatchDictionaryEntriesParams()
.setRequests(
List.of(
new BatchDictionaryEntriesRequest()
.setAction(DictionaryAction.fromValue("addEntry"))
.setAction(DictionaryAction.ADD_ENTRY)
.setBody(
new DictionaryEntry()
.setObjectID("1")
.setLanguage(SupportedLanguage.fromValue("en"))
.setAdditionalProperty("additional", "try me")
new DictionaryEntry().setObjectID("1").setLanguage(SupportedLanguage.EN).setAdditionalProperty("additional", "try me")
)
)
)
Expand Down Expand Up @@ -756,9 +751,7 @@ void snippetForMultipleBatch() {
client.multipleBatch(
new BatchParams()
.setRequests(
List.of(
new MultipleBatchRequest().setAction(Action.fromValue("addObject")).setBody(Map.of("key", "value")).setIndexName("theIndexName")
)
List.of(new MultipleBatchRequest().setAction(Action.ADD_OBJECT).setBody(Map.of("key", "value")).setIndexName("theIndexName"))
)
);
// SEPARATOR<
Expand All @@ -776,9 +769,9 @@ void snippetForOperationIndex() {
client.operationIndex(
"<SOURCE_INDEX_NAME>",
new OperationIndexParams()
.setOperation(OperationType.fromValue("move"))
.setOperation(OperationType.MOVE)
.setDestination("<DESTINATION_INDEX_NAME>")
.setScope(List.of(ScopeType.fromValue("rules"), ScopeType.fromValue("settings")))
.setScope(List.of(ScopeType.RULES, ScopeType.SETTINGS))
);
// SEPARATOR<
}
Expand All @@ -794,7 +787,7 @@ void snippetForOperationIndex1() {
// Call the API
client.operationIndex(
"<SOURCE_INDEX_NAME>",
new OperationIndexParams().setOperation(OperationType.fromValue("copy")).setDestination("<DESTINATION_INDEX_NAME>")
new OperationIndexParams().setOperation(OperationType.COPY).setDestination("<DESTINATION_INDEX_NAME>")
);
// SEPARATOR<
}
Expand All @@ -810,7 +803,7 @@ void snippetForOperationIndex2() {
// Call the API
client.operationIndex(
"<SOURCE_INDEX_NAME>",
new OperationIndexParams().setOperation(OperationType.fromValue("move")).setDestination("<DESTINATION_INDEX_NAME>")
new OperationIndexParams().setOperation(OperationType.MOVE).setDestination("<DESTINATION_INDEX_NAME>")
);
// SEPARATOR<
}
Expand All @@ -831,7 +824,7 @@ void snippetForPartialUpdateObject() {
"id1",
AttributeToUpdate.of("test"),
"id2",
new BuiltInOperation().setOperation(BuiltInOperationType.fromValue("AddUnique")).setValue("test2")
new BuiltInOperation().setOperation(BuiltInOperationType.ADD_UNIQUE).setValue("test2")
),
true
);
Expand Down Expand Up @@ -902,9 +895,7 @@ void snippetForSaveRule() {
client.saveRule(
"indexName",
"id1",
new Rule()
.setObjectID("id1")
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.fromValue("contains"))))
new Rule().setObjectID("id1").setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.CONTAINS)))
);
// SEPARATOR<
}
Expand All @@ -923,10 +914,10 @@ void snippetForSaveRules() {
List.of(
new Rule()
.setObjectID("a-rule-id")
.setConditions(List.of(new Condition().setPattern("smartphone").setAnchoring(Anchoring.fromValue("contains")))),
.setConditions(List.of(new Condition().setPattern("smartphone").setAnchoring(Anchoring.CONTAINS))),
new Rule()
.setObjectID("a-second-rule-id")
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.fromValue("contains"))))
.setConditions(List.of(new Condition().setPattern("apple").setAnchoring(Anchoring.CONTAINS)))
),
false,
true
Expand All @@ -946,7 +937,7 @@ void snippetForSaveSynonym() {
client.saveSynonym(
"indexName",
"id1",
new SynonymHit().setObjectID("id1").setType(SynonymType.fromValue("synonym")).setSynonyms(List.of("car", "vehicule", "auto")),
new SynonymHit().setObjectID("id1").setType(SynonymType.SYNONYM).setSynonyms(List.of("car", "vehicule", "auto")),
true
);
// SEPARATOR<
Expand All @@ -964,10 +955,10 @@ void snippetForSaveSynonyms() {
client.saveSynonyms(
"<YOUR_INDEX_NAME>",
List.of(
new SynonymHit().setObjectID("id1").setType(SynonymType.fromValue("synonym")).setSynonyms(List.of("car", "vehicule", "auto")),
new SynonymHit().setObjectID("id1").setType(SynonymType.SYNONYM).setSynonyms(List.of("car", "vehicule", "auto")),
new SynonymHit()
.setObjectID("id2")
.setType(SynonymType.fromValue("onewaysynonym"))
.setType(SynonymType.ONEWAYSYNONYM)
.setInput("iphone")
.setSynonyms(List.of("ephone", "aphone", "yphone"))
),
Expand Down Expand Up @@ -1101,7 +1092,7 @@ void snippetForSearchDictionaryEntries() {
SearchClient client = new SearchClient("YOUR_APP_ID", "YOUR_API_KEY");

// Call the API
client.searchDictionaryEntries(DictionaryType.fromValue("stopwords"), new SearchDictionaryEntriesParams().setQuery("about"));
client.searchDictionaryEntries(DictionaryType.STOPWORDS, new SearchDictionaryEntriesParams().setQuery("about"));
// SEPARATOR<
}

Expand Down Expand Up @@ -1213,11 +1204,7 @@ void snippetForUpdateApiKey() {
// Call the API
client.updateApiKey(
"myApiKey",
new ApiKey()
.setAcl(List.of(Acl.fromValue("search"), Acl.fromValue("addObject")))
.setValidity(300)
.setMaxQueriesPerIPPerHour(100)
.setMaxHitsPerQuery(20)
new ApiKey().setAcl(List.of(Acl.SEARCH, Acl.ADD_OBJECT)).setValidity(300).setMaxQueriesPerIPPerHour(100).setMaxHitsPerQuery(20)
);
// SEPARATOR<
}
Expand Down
4 changes: 2 additions & 2 deletions snippets/java/src/test/java/com/algolia/Usage.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void snippetForGetIndexUsage() {
UsageClient client = new UsageClient("YOUR_APP_ID", "YOUR_API_KEY");

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

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

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

0 comments on commit 3f692ae

Please sign in to comment.