From 05906233f16386023a3ad7072f8d9e16979eb4a1 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 21 Jan 2022 17:06:12 +0100 Subject: [PATCH 1/2] feat: add override method for optional params in java client --- .../com/algolia/search/SearchApi.java | 257 ++++++++---------- .../java/libraries/okhttp-gson/api.mustache | 10 +- 2 files changed, 125 insertions(+), 142 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 7795c1d4464..01618dfc1d1 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -29,7 +29,6 @@ public SearchApi(String appId, String apiKey, Requester requester) { /** * Build call for addApiKey * - * @param apiKey (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -113,9 +112,6 @@ public Call addApiKeyAsync( /** * Build call for addOrUpdateObject * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param body The Algolia object. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -250,7 +246,6 @@ public Call addOrUpdateObjectAsync( /** * Build call for appendSource * - * @param source The source to add. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -334,8 +329,6 @@ public Call appendSourceAsync( /** * Build call for assignUserId * - * @param xAlgoliaUserID userID to assign. (required) - * @param assignUserIdParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -454,8 +447,6 @@ public Call assignUserIdAsync( /** * Build call for batch * - * @param indexName The index in which to perform the request. (required) - * @param batchWriteParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -558,8 +549,6 @@ public Call batchAsync( /** * Build call for batchAssignUserIds * - * @param xAlgoliaUserID userID to assign. (required) - * @param batchAssignUserIdsParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -681,8 +670,6 @@ public Call batchAssignUserIdsAsync( /** * Build call for batchDictionaryEntries * - * @param dictionaryName The dictionary to search in. (required) - * @param batchDictionaryEntries (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -801,12 +788,6 @@ public Call batchDictionaryEntriesAsync( /** * Build call for batchRules * - * @param indexName The index in which to perform the request. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param clearExistingRules When true, existing Rules are cleared before adding this batch. When - * false, existing Rules are kept. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -920,6 +901,11 @@ public UpdatedAtResponse batchRules( return res.getData(); } + public UpdatedAtResponse batchRules(String indexName, List rule) + throws ApiException { + return this.batchRules(indexName, rule, null, null); + } + /** * (asynchronously) Create or update a batch of Rules. * @@ -955,8 +941,6 @@ public Call batchRulesAsync( /** * Build call for browse * - * @param indexName The index in which to perform the request. (required) - * @param browseRequest (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1032,6 +1016,10 @@ public BrowseResponse browse(String indexName, BrowseRequest browseRequest) return res.getData(); } + public BrowseResponse browse(String indexName) throws ApiException { + return this.browse(indexName, null); + } + /** * (asynchronously) This method allows you to retrieve all index content. It can retrieve up to * 1,000 records per call and supports full text search and filters. For performance reasons, some @@ -1061,9 +1049,6 @@ public Call browseAsync( /** * Build call for clearAllSynonyms * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1147,6 +1132,11 @@ public UpdatedAtResponse clearAllSynonyms( return res.getData(); } + public UpdatedAtResponse clearAllSynonyms(String indexName) + throws ApiException { + return this.clearAllSynonyms(indexName, null); + } + /** * (asynchronously) Remove all synonyms from an index. * @@ -1175,7 +1165,6 @@ public Call clearAllSynonymsAsync( /** * Build call for clearObjects * - * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1264,9 +1253,6 @@ public Call clearObjectsAsync( /** * Build call for clearRules * - * @param indexName The index in which to perform the request. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1346,6 +1332,10 @@ public UpdatedAtResponse clearRules( return res.getData(); } + public UpdatedAtResponse clearRules(String indexName) throws ApiException { + return this.clearRules(indexName, null); + } + /** * (asynchronously) Delete all Rules in the index. * @@ -1374,7 +1364,6 @@ public Call clearRulesAsync( /** * Build call for deleteApiKey * - * @param key API Key string. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1462,8 +1451,6 @@ public Call deleteApiKeyAsync( /** * Build call for deleteBy * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1570,7 +1557,6 @@ public Call deleteByAsync( /** * Build call for deleteIndex * - * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1658,8 +1644,6 @@ public Call deleteIndexAsync( /** * Build call for deleteObject * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1764,10 +1748,6 @@ public Call deleteObjectAsync( /** * Build call for deleteRule * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1867,6 +1847,11 @@ public UpdatedAtResponse deleteRule( return res.getData(); } + public UpdatedAtResponse deleteRule(String indexName, String objectID) + throws ApiException { + return this.deleteRule(indexName, objectID, null); + } + /** * (asynchronously) Delete the Rule with the specified objectID. * @@ -1898,7 +1883,6 @@ public Call deleteRuleAsync( /** * Build call for deleteSource * - * @param source The IP range of the source. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -1986,10 +1970,6 @@ public Call deleteSourceAsync( /** * Build call for deleteSynonym * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2089,6 +2069,11 @@ public DeletedAtResponse deleteSynonym( return res.getData(); } + public DeletedAtResponse deleteSynonym(String indexName, String objectID) + throws ApiException { + return this.deleteSynonym(indexName, objectID, null); + } + /** * (asynchronously) Delete a single synonyms set, identified by the given objectID. * @@ -2120,7 +2105,6 @@ public Call deleteSynonymAsync( /** * Build call for getApiKey * - * @param key API Key string. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2352,14 +2336,6 @@ public Call getDictionarySettingsAsync( /** * Build call for getLogs * - * @param offset First entry to retrieve (zero-based). Log entries are sorted by decreasing date, - * therefore 0 designates the most recent log entry. (optional, default to 0) - * @param length Maximum number of entries to retrieve. The maximum allowed value is 1000. - * (optional, default to 10) - * @param indexName Index for which log entries should be retrieved. When omitted, log entries are - * retrieved across all indices. (optional, default to null) - * @param type Type of log entries to retrieve. When omitted, all log entries are retrieved. - * (optional, default to all) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2449,6 +2425,10 @@ public GetLogsResponse getLogs( return res.getData(); } + public GetLogsResponse getLogs() throws ApiException { + return this.getLogs(0, 10, "null", "all"); + } + /** * (asynchronously) Return the lastest log entries. * @@ -2486,10 +2466,6 @@ public Call getLogsAsync( /** * Build call for getObject * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable - * attributes are returned. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2589,6 +2565,11 @@ public Map getObject( return res.getData(); } + public Map getObject(String indexName, String objectID) + throws ApiException { + return this.getObject(indexName, objectID, null); + } + /** * (asynchronously) Retrieve one object from the index. * @@ -2620,7 +2601,6 @@ public Call getObjectAsync( /** * Build call for getObjects * - * @param getObjectsParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2706,8 +2686,6 @@ public Call getObjectsAsync( /** * Build call for getRule * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2811,7 +2789,6 @@ public Call getRuleAsync( /** * Build call for getSettings * - * @param indexName The index in which to perform the request. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -2968,8 +2945,6 @@ public Call getSourcesAsync(final ApiCallback> _callback) /** * Build call for getSynonym * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3074,8 +3049,6 @@ public Call getSynonymAsync( /** * Build call for getTask * - * @param indexName The index in which to perform the request. (required) - * @param taskID Unique identifier of an task. Numeric value (up to 64bits) (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3257,7 +3230,6 @@ public Call getTopUserIdsAsync( /** * Build call for getUserId * - * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3351,7 +3323,6 @@ public Call getUserIdAsync( /** * Build call for hasPendingMappings * - * @param getClusters Whether to get clusters or not. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3416,6 +3387,10 @@ public CreatedAtResponse hasPendingMappings(Boolean getClusters) return res.getData(); } + public CreatedAtResponse hasPendingMappings() throws ApiException { + return this.hasPendingMappings(null); + } + /** * (asynchronously) Get the status of your clusters' migrations or user creations. Creating a * large batch of users or migrating your multi-cluster may take quite some time. This method lets @@ -3585,9 +3560,6 @@ public Call listClustersAsync( /** * Build call for listIndices * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3649,6 +3621,10 @@ public ListIndicesResponse listIndices(Integer page) throws ApiException { return res.getData(); } + public ListIndicesResponse listIndices() throws ApiException { + return this.listIndices(null); + } + /** * (asynchronously) List existing indexes from an application. * @@ -3672,10 +3648,6 @@ public Call listIndicesAsync( /** * Build call for listUserIds * - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3748,6 +3720,10 @@ public ListUserIdsResponse listUserIds(Integer page, Integer hitsPerPage) return res.getData(); } + public ListUserIdsResponse listUserIds() throws ApiException { + return this.listUserIds(null, 100); + } + /** * (asynchronously) List the userIDs assigned to a multi-clusters appID. The data returned will * usually be a few seconds behind real time, because userID usage may take up to a few seconds to @@ -3776,7 +3752,6 @@ public Call listUserIdsAsync( /** * Build call for multipleBatch * - * @param batchParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3863,7 +3838,6 @@ public Call multipleBatchAsync( /** * Build call for multipleQueries * - * @param multipleQueriesParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -3953,8 +3927,6 @@ public Call multipleQueriesAsync( /** * Build call for operationIndex * - * @param indexName The index in which to perform the request. (required) - * @param operationIndexParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4066,11 +4038,6 @@ public Call operationIndexAsync( /** * Build call for partialUpdateObject * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param oneOfstringbuiltInOperation List of attributes to update. (required) - * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to - * true) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4078,11 +4045,11 @@ public Call operationIndexAsync( private Call partialUpdateObjectCall( String indexName, String objectID, - List> oneOfstringbuiltInOperation, + List> builtInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { - Object bodyObj = oneOfstringbuiltInOperation; + Object bodyObj = builtInOperation; // create path and map variables String path = @@ -4120,7 +4087,7 @@ private Call partialUpdateObjectCall( private Call partialUpdateObjectValidateBeforeCall( String indexName, String objectID, - List> oneOfstringbuiltInOperation, + List> builtInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { @@ -4138,10 +4105,10 @@ private Call partialUpdateObjectValidateBeforeCall( ); } - // verify the required parameter 'oneOfstringbuiltInOperation' is set - if (oneOfstringbuiltInOperation == null) { + // verify the required parameter 'builtInOperation' is set + if (builtInOperation == null) { throw new ApiException( - "Missing the required parameter 'oneOfstringbuiltInOperation' when calling" + + "Missing the required parameter 'builtInOperation' when calling" + " partialUpdateObject(Async)" ); } @@ -4149,7 +4116,7 @@ private Call partialUpdateObjectValidateBeforeCall( return partialUpdateObjectCall( indexName, objectID, - oneOfstringbuiltInOperation, + builtInOperation, createIfNotExists, _callback ); @@ -4163,7 +4130,7 @@ private Call partialUpdateObjectValidateBeforeCall( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param oneOfstringbuiltInOperation List of attributes to update. (required) + * @param builtInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @return UpdatedAtWithObjectIdResponse @@ -4173,13 +4140,13 @@ private Call partialUpdateObjectValidateBeforeCall( public UpdatedAtWithObjectIdResponse partialUpdateObject( String indexName, String objectID, - List> oneOfstringbuiltInOperation, + List> builtInOperation, Boolean createIfNotExists ) throws ApiException { Call req = partialUpdateObjectValidateBeforeCall( indexName, objectID, - oneOfstringbuiltInOperation, + builtInOperation, createIfNotExists, null ); @@ -4194,6 +4161,19 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( return res.getData(); } + public UpdatedAtWithObjectIdResponse partialUpdateObject( + String indexName, + String objectID, + List> builtInOperation + ) throws ApiException { + return this.partialUpdateObject( + indexName, + objectID, + builtInOperation, + true + ); + } + /** * (asynchronously) Update one or more attributes of an existing object. This method lets you * update only a part of an existing object, either by adding new attributes or updating existing @@ -4202,7 +4182,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param oneOfstringbuiltInOperation List of attributes to update. (required) + * @param builtInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback The callback to be executed when the API call finishes @@ -4212,14 +4192,14 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( public Call partialUpdateObjectAsync( String indexName, String objectID, - List> oneOfstringbuiltInOperation, + List> builtInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { Call call = partialUpdateObjectValidateBeforeCall( indexName, objectID, - oneOfstringbuiltInOperation, + builtInOperation, createIfNotExists, _callback ); @@ -4232,7 +4212,6 @@ public Call partialUpdateObjectAsync( /** * Build call for removeUserId * - * @param userID userID to assign. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4322,7 +4301,6 @@ public Call removeUserIdAsync( /** * Build call for replaceSources * - * @param source The sources to allow. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4407,7 +4385,6 @@ public Call replaceSourcesAsync( /** * Build call for restoreApiKey * - * @param key API Key string. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4495,8 +4472,6 @@ public Call restoreApiKeyAsync( /** * Build call for saveObject * - * @param indexName The index in which to perform the request. (required) - * @param body The Algolia record. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4597,11 +4572,6 @@ public Call saveObjectAsync( /** * Build call for saveRule * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param rule (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4719,6 +4689,14 @@ public UpdatedRuleResponse saveRule( return res.getData(); } + public UpdatedRuleResponse saveRule( + String indexName, + String objectID, + Rule rule + ) throws ApiException { + return this.saveRule(indexName, objectID, rule, null); + } + /** * (asynchronously) Create or update the Rule with the specified objectID. * @@ -4753,11 +4731,6 @@ public Call saveRuleAsync( /** * Build call for saveSynonym * - * @param indexName The index in which to perform the request. (required) - * @param objectID Unique identifier of an object. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -4875,6 +4848,14 @@ public SaveSynonymResponse saveSynonym( return res.getData(); } + public SaveSynonymResponse saveSynonym( + String indexName, + String objectID, + SynonymHit synonymHit + ) throws ApiException { + return this.saveSynonym(indexName, objectID, synonymHit, null); + } + /** * (asynchronously) Create a new synonym object or update the existing synonym object with the * given object ID. @@ -4910,12 +4891,6 @@ public Call saveSynonymAsync( /** * Build call for saveSynonyms * - * @param indexName The index in which to perform the request. (required) - * @param synonymHit (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) - * @param replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this - * request. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5030,6 +5005,13 @@ public UpdatedAtResponse saveSynonyms( return res.getData(); } + public UpdatedAtResponse saveSynonyms( + String indexName, + List synonymHit + ) throws ApiException { + return this.saveSynonyms(indexName, synonymHit, null, null); + } + /** * (asynchronously) Create/update multiple synonym objects at once, potentially replacing the * entire list of synonyms if replaceExistingSynonyms is true. @@ -5066,8 +5048,6 @@ public Call saveSynonymsAsync( /** * Build call for search * - * @param indexName The index in which to perform the request. (required) - * @param searchParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5168,8 +5148,6 @@ public Call searchAsync( /** * Build call for searchDictionaryEntries * - * @param dictionaryName The dictionary to search in. (required) - * @param searchDictionaryEntries (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5288,9 +5266,6 @@ public Call searchDictionaryEntriesAsync( /** * Build call for searchForFacetValues * - * @param indexName The index in which to perform the request. (required) - * @param facetName The facet name. (required) - * @param searchForFacetValuesRequest (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5391,6 +5366,13 @@ public SearchForFacetValuesResponse searchForFacetValues( return res.getData(); } + public SearchForFacetValuesResponse searchForFacetValues( + String indexName, + String facetName + ) throws ApiException { + return this.searchForFacetValues(indexName, facetName, null); + } + /** * (asynchronously) Search for values of a given facet, optionally restricting the returned values * to those contained in objects matching other search criteria. @@ -5423,8 +5405,6 @@ public Call searchForFacetValuesAsync( /** * Build call for searchRules * - * @param indexName The index in which to perform the request. (required) - * @param searchRulesParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5535,13 +5515,6 @@ public Call searchRulesAsync( /** * Build call for searchSynonyms * - * @param indexName The index in which to perform the request. (required) - * @param query Search for specific synonyms matching this string. (optional, default to ) - * @param type Only search for specific types of synonyms. (optional) - * @param page Requested page (zero-based). When specified, will retrieve a specific page; the - * page size is implicitly set to 100. When null, will retrieve all indices (no pagination). - * (optional, default to 0) - * @param hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5658,6 +5631,11 @@ public SearchSynonymsResponse searchSynonyms( return res.getData(); } + public SearchSynonymsResponse searchSynonyms(String indexName) + throws ApiException { + return this.searchSynonyms(indexName, "", null, 0, 100); + } + /** * (asynchronously) Search or browse all synonyms, optionally filtering them by type. * @@ -5696,7 +5674,6 @@ public Call searchSynonymsAsync( /** * Build call for searchUserIds * - * @param searchUserIdsParams (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5794,7 +5771,6 @@ public Call searchUserIdsAsync( /** * Build call for setDictionarySettings * - * @param dictionarySettingsRequest (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5887,10 +5863,6 @@ public Call setDictionarySettingsAsync( /** * Build call for setSettings * - * @param indexName The index in which to perform the request. (required) - * @param indexSettings (required) - * @param forwardToReplicas When true, changes are also propagated to replicas of the given - * indexName. (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -5992,6 +5964,13 @@ public UpdatedAtResponse setSettings( return res.getData(); } + public UpdatedAtResponse setSettings( + String indexName, + IndexSettings indexSettings + ) throws ApiException { + return this.setSettings(indexName, indexSettings, null); + } + /** * (asynchronously) Update settings of a given indexName. Only specified settings are overridden; * unspecified settings are left unchanged. Specifying null for a setting resets it to its default @@ -6025,8 +6004,6 @@ public Call setSettingsAsync( /** * Build call for updateApiKey * - * @param key API Key string. (required) - * @param apiKey (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object diff --git a/templates/java/libraries/okhttp-gson/api.mustache b/templates/java/libraries/okhttp-gson/api.mustache index d8b4129ca05..f942ba9ce5b 100644 --- a/templates/java/libraries/okhttp-gson/api.mustache +++ b/templates/java/libraries/okhttp-gson/api.mustache @@ -35,8 +35,7 @@ public class {{classname}} extends ApiClient { {{#operation}} /** - * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{&description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * Build call for {{operationId}} * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -119,6 +118,13 @@ public class {{classname}} extends ApiClient { ApiResponse<{{{.}}}> res = this.execute(call, returnType); return res.getData();{{/returnType}}{{^returnType}}this.execute(call).getData();{{/returnType}} } + + {{#optionalParams.0}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{operationId}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) throws ApiException { + {{#returnType}}return {{/returnType}}this.{{operationId}}({{#requiredParams}}{{paramName}}{{^-last}},{{/-last}}{{/requiredParams}}{{#requiredParams.0}},{{/requiredParams.0}}{{#optionalParams}}{{#defaultValue}}{{#isString}}"{{.}}"{{/isString}}{{^isString}}{{.}}{{/isString}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{^-last}},{{/-last}}{{/optionalParams}}); + } + {{/optionalParams.0}} + /** * (asynchronously) * {{notes}}{{#allParams}} From 2e55cd2be5cfdcd92c09012d87adf5a1691d81c5 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 21 Jan 2022 17:27:56 +0100 Subject: [PATCH 2/2] gen --- .../com/algolia/search/SearchApi.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java index 01618dfc1d1..ba9e2efd103 100644 --- a/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java +++ b/clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/search/SearchApi.java @@ -4045,11 +4045,11 @@ public Call operationIndexAsync( private Call partialUpdateObjectCall( String indexName, String objectID, - List> builtInOperation, + List> oneOfstringbuiltInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { - Object bodyObj = builtInOperation; + Object bodyObj = oneOfstringbuiltInOperation; // create path and map variables String path = @@ -4087,7 +4087,7 @@ private Call partialUpdateObjectCall( private Call partialUpdateObjectValidateBeforeCall( String indexName, String objectID, - List> builtInOperation, + List> oneOfstringbuiltInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { @@ -4105,10 +4105,10 @@ private Call partialUpdateObjectValidateBeforeCall( ); } - // verify the required parameter 'builtInOperation' is set - if (builtInOperation == null) { + // verify the required parameter 'oneOfstringbuiltInOperation' is set + if (oneOfstringbuiltInOperation == null) { throw new ApiException( - "Missing the required parameter 'builtInOperation' when calling" + + "Missing the required parameter 'oneOfstringbuiltInOperation' when calling" + " partialUpdateObject(Async)" ); } @@ -4116,7 +4116,7 @@ private Call partialUpdateObjectValidateBeforeCall( return partialUpdateObjectCall( indexName, objectID, - builtInOperation, + oneOfstringbuiltInOperation, createIfNotExists, _callback ); @@ -4130,7 +4130,7 @@ private Call partialUpdateObjectValidateBeforeCall( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param builtInOperation List of attributes to update. (required) + * @param oneOfstringbuiltInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @return UpdatedAtWithObjectIdResponse @@ -4140,13 +4140,13 @@ private Call partialUpdateObjectValidateBeforeCall( public UpdatedAtWithObjectIdResponse partialUpdateObject( String indexName, String objectID, - List> builtInOperation, + List> oneOfstringbuiltInOperation, Boolean createIfNotExists ) throws ApiException { Call req = partialUpdateObjectValidateBeforeCall( indexName, objectID, - builtInOperation, + oneOfstringbuiltInOperation, createIfNotExists, null ); @@ -4164,12 +4164,12 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( public UpdatedAtWithObjectIdResponse partialUpdateObject( String indexName, String objectID, - List> builtInOperation + List> oneOfstringbuiltInOperation ) throws ApiException { return this.partialUpdateObject( indexName, objectID, - builtInOperation, + oneOfstringbuiltInOperation, true ); } @@ -4182,7 +4182,7 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( * * @param indexName The index in which to perform the request. (required) * @param objectID Unique identifier of an object. (required) - * @param builtInOperation List of attributes to update. (required) + * @param oneOfstringbuiltInOperation List of attributes to update. (required) * @param createIfNotExists Creates the record if it does not exist yet. (optional, default to * true) * @param _callback The callback to be executed when the API call finishes @@ -4192,14 +4192,14 @@ public UpdatedAtWithObjectIdResponse partialUpdateObject( public Call partialUpdateObjectAsync( String indexName, String objectID, - List> builtInOperation, + List> oneOfstringbuiltInOperation, Boolean createIfNotExists, final ApiCallback _callback ) throws ApiException { Call call = partialUpdateObjectValidateBeforeCall( indexName, objectID, - builtInOperation, + oneOfstringbuiltInOperation, createIfNotExists, _callback );