Skip to content

Commit

Permalink
fix(client): Rename client.updateKey => client.updateApiKey
Browse files Browse the repository at this point in the history
Closes #423
  • Loading branch information
ElPicador committed Jan 15, 2018
1 parent ab7583d commit 6306107
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public CreateUpdateKey addApiKey(@Nonnull ApiKey key, @Nonnull RequestOptions re
.setData(key));
}

/** Deprecated: use updateApiKey */
/** Deprecated: use {@link #updateApiKey(String, ApiKey)} */
@Deprecated
public CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
throws AlgoliaException {
Expand Down Expand Up @@ -862,7 +862,7 @@ CreateUpdateKey addKey(String indexName, ApiKey key, RequestOptions requestOptio
.setData(key));
}

CreateUpdateKey updateKey(
CreateUpdateKey updateApiKey(
String indexName, String keyName, ApiKey key, RequestOptions requestOptions)
throws AlgoliaException {
return httpClient.requestWithRetry(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public CompletableFuture<CreateUpdateKey> addApiKey(
.setData(key));
}

/** Deprecated: use updateApiKey */
/** Deprecated: use ${@link #updateApiKey(String, ApiKey)} */
@Deprecated
public CompletableFuture<CreateUpdateKey> updateKey(
@Nonnull String keyName, @Nonnull ApiKey key) {
Expand Down Expand Up @@ -838,7 +838,7 @@ CompletableFuture<CreateUpdateKey> addKey(
.setData(key));
}

CompletableFuture<CreateUpdateKey> updateKey(
CompletableFuture<CreateUpdateKey> updateApiKey(
String indexName, String keyName, ApiKey key, RequestOptions requestOptions) {
return httpClient.requestWithRetry(
new AlgoliaRequest<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ default CompletableFuture<CreateUpdateKey> addApiKey(
return getApiClient().addKey(getName(), key, requestOptions);
}

/** Deprecated: use updateApiKey */
/** Deprecated: use {@link #updateApiKey(String, ApiKey)} */
@Deprecated
default CompletableFuture<CreateUpdateKey> updateKey(
@Nonnull String keyName, @Nonnull ApiKey key) {
Expand Down Expand Up @@ -642,7 +642,7 @@ default CompletableFuture<CreateUpdateKey> updateApiKey(
*/
default CompletableFuture<CreateUpdateKey> updateApiKey(
@Nonnull String keyName, @Nonnull ApiKey key, @Nonnull RequestOptions requestOptions) {
return getApiClient().updateKey(getName(), keyName, key, requestOptions);
return getApiClient().updateApiKey(getName(), keyName, key, requestOptions);
}
}

Expand Down
23 changes: 19 additions & 4 deletions algoliasearch-common/src/main/java/com/algolia/search/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,13 @@ default CreateUpdateKey addApiKey(@Nonnull ApiKey key, @Nonnull RequestOptions r
return getApiClient().addKey(getName(), key, requestOptions);
}

/** Deprecated: use {@link #updateApiKey(String, ApiKey)} */
@Deprecated
default CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
throws AlgoliaException {
return updateApiKey(keyName, key, RequestOptions.empty);
}

/**
* Update a key by name from this index
*
Expand All @@ -684,9 +691,17 @@ default CreateUpdateKey addApiKey(@Nonnull ApiKey key, @Nonnull RequestOptions r
* @return the updated key
* @throws AlgoliaException
*/
default CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
default CreateUpdateKey updateApiKey(@Nonnull String keyName, @Nonnull ApiKey key)
throws AlgoliaException {
return updateKey(keyName, key, RequestOptions.empty);
return updateApiKey(keyName, key, RequestOptions.empty);
}

/** Deprecated: use {@link #updateApiKey(String, ApiKey, RequestOptions)} */
@Deprecated
default CreateUpdateKey updateKey(
@Nonnull String keyName, @Nonnull ApiKey key, @Nonnull RequestOptions requestOptions)
throws AlgoliaException {
return getApiClient().updateApiKey(getName(), keyName, key, requestOptions);
}

/**
Expand All @@ -698,10 +713,10 @@ default CreateUpdateKey updateKey(@Nonnull String keyName, @Nonnull ApiKey key)
* @return the updated key
* @throws AlgoliaException
*/
default CreateUpdateKey updateKey(
default CreateUpdateKey updateApiKey(
@Nonnull String keyName, @Nonnull ApiKey key, @Nonnull RequestOptions requestOptions)
throws AlgoliaException {
return getApiClient().updateKey(getName(), keyName, key, requestOptions);
return getApiClient().updateApiKey(getName(), keyName, key, requestOptions);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void manageKeysForIndex() throws AlgoliaException, InterruptedException {
waitForKeyPresent(index, apiKey.getDescription());

apiKey = apiKey.setDescription("toto2" + System.currentTimeMillis());
index.updateKey(keyName, apiKey);
index.updateApiKey(keyName, apiKey);

waitForKeyPresent(index, apiKey.getDescription());

Expand Down

0 comments on commit 6306107

Please sign in to comment.