Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ public boolean verify() throws ConstructorException {
* @param items the items you want to add or replace.
* @param section the section of the index that you're adding the items to.
* @param force whether or not the system should process the request even if it will invalidate
* a large number of existing variations.
* a large number of existing items.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if working
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean createOrReplaceItems(
public String createOrReplaceItems(
ConstructorItem[] items, String section, Boolean force, String notificationEmail)
throws ConstructorException {
try {
Expand Down Expand Up @@ -267,23 +267,22 @@ public boolean createOrReplaceItems(
Request request = this.makeAuthorizedRequestBuilder().url(url).put(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
}

public boolean createOrReplaceItems(ConstructorItem[] items) throws ConstructorException {
public String createOrReplaceItems(ConstructorItem[] items) throws ConstructorException {
return createOrReplaceItems(items, "Products", false, null);
}

public boolean createOrReplaceItems(ConstructorItem[] items, String section)
public String createOrReplaceItems(ConstructorItem[] items, String section)
throws ConstructorException {
return createOrReplaceItems(items, section, false, null);
}

public boolean createOrReplaceItems(ConstructorItem[] items, String section, Boolean force)
public String createOrReplaceItems(ConstructorItem[] items, String section, Boolean force)
throws ConstructorException {
return createOrReplaceItems(items, section, force, null);
}
Expand All @@ -294,13 +293,13 @@ public boolean createOrReplaceItems(ConstructorItem[] items, String section, Boo
* @param items the items that you are deleting
* @param section the section of the index that you're removing the items from.
* @param force whether or not the system should process the request even if it will invalidate
* a large number of existing variations.
* a large number of existing items.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if successfully removed
* @return a string of JSON
* @throws ConstructorException if the request is invalid
*/
public boolean deleteItems(
public String deleteItems(
ConstructorItem[] items, String section, Boolean force, String notificationEmail)
throws ConstructorException {
try {
Expand Down Expand Up @@ -334,23 +333,21 @@ public boolean deleteItems(
Request request = this.makeAuthorizedRequestBuilder().url(url).delete(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
}

public boolean deleteItems(ConstructorItem[] items) throws ConstructorException {
public String deleteItems(ConstructorItem[] items) throws ConstructorException {
return deleteItems(items, "Products", false, null);
}

public boolean deleteItems(ConstructorItem[] items, String section)
throws ConstructorException {
public String deleteItems(ConstructorItem[] items, String section) throws ConstructorException {
return deleteItems(items, section, false, null);
}

public boolean deleteItems(ConstructorItem[] items, String section, Boolean force)
public String deleteItems(ConstructorItem[] items, String section, Boolean force)
throws ConstructorException {
return deleteItems(items, section, force, null);
}
Expand Down Expand Up @@ -430,10 +427,10 @@ public String retrieveItemsAsJson(ItemsRequest req) throws ConstructorException
* a large number of existing variations.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if successfully removed
* @return a string of JSON
* @throws ConstructorException if the request is invalid
*/
public boolean deleteVariations(
public String deleteVariations(
ConstructorVariation[] variations,
String section,
Boolean force,
Expand Down Expand Up @@ -469,24 +466,22 @@ public boolean deleteVariations(
Request request = this.makeAuthorizedRequestBuilder().url(url).delete(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
}

public boolean deleteVariations(ConstructorVariation[] variations) throws ConstructorException {
public String deleteVariations(ConstructorVariation[] variations) throws ConstructorException {
return deleteVariations(variations, "Products", false, null);
}

public boolean deleteVariations(ConstructorVariation[] variations, String section)
public String deleteVariations(ConstructorVariation[] variations, String section)
throws ConstructorException {
return deleteVariations(variations, section, false, null);
}

public boolean deleteVariations(
ConstructorVariation[] variations, String section, Boolean force)
public String deleteVariations(ConstructorVariation[] variations, String section, Boolean force)
throws ConstructorException {
return deleteVariations(variations, section, force, null);
}
Expand All @@ -497,17 +492,17 @@ public boolean deleteVariations(
* @param items the items that you're updating
* @param section the section of the autocomplete that you're modifying the item for.
* @param force whether or not the system should process the request even if it will invalidate
* a large number of existing variations.
* a large number of existing items.
* @param onMissing Either "FAIL", "IGNORE", "CREATE", indicating how the system will handle
* updating items that don't exist. "FAIL" fails the ingestion if there are items that don't
* exist. "IGNORE" ignores items that don't exist. "CREATE" creates items that don't exist.
* Defaults to "FAIL".
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if successfully modified
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean updateItems(
public String updateItems(
ConstructorItem[] items,
String section,
Boolean force,
Expand Down Expand Up @@ -545,8 +540,7 @@ public boolean updateItems(
Request request = this.makeAuthorizedRequestBuilder().url(url).patch(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
Expand All @@ -558,28 +552,27 @@ public boolean updateItems(
* @param items the items that you're updating
* @param section the section of the autocomplete that you're modifying the item for.
* @param force whether or not the system should process the request even if it will invalidate
* a large number of existing variations.
* a large number of existing items.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if successfully modified
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean updateItems(
public String updateItems(
ConstructorItem[] items, String section, Boolean force, String notificationEmail)
throws ConstructorException {
return updateItems(items, section, force, notificationEmail, null);
}

public boolean updateItems(ConstructorItem[] items) throws ConstructorException {
public String updateItems(ConstructorItem[] items) throws ConstructorException {
return updateItems(items, "Products", false, null, null);
}

public boolean updateItems(ConstructorItem[] items, String section)
throws ConstructorException {
public String updateItems(ConstructorItem[] items, String section) throws ConstructorException {
return updateItems(items, section, false, null, null);
}

public boolean updateItems(ConstructorItem[] items, String section, Boolean force)
public String updateItems(ConstructorItem[] items, String section, Boolean force)
throws ConstructorException {
return updateItems(items, section, force, null, null);
}
Expand All @@ -597,10 +590,10 @@ public boolean updateItems(ConstructorItem[] items, String section, Boolean forc
* updating variations that don't exist. "FAIL" fails the ingestion if there are items that
* don't exist. "IGNORE" ignores variations that don't exist. "CREATE" creates items that
* don't exist. Defaults to "FAIL".
* @return true if successfully modified
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean updateVariations(
public String updateVariations(
ConstructorVariation[] variations,
String section,
Boolean force,
Expand Down Expand Up @@ -637,8 +630,7 @@ public boolean updateVariations(
Request request = this.makeAuthorizedRequestBuilder().url(url).patch(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
Expand All @@ -653,10 +645,10 @@ public boolean updateVariations(
* a large number of existing variations.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if successfully modified
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean updateVariations(
public String updateVariations(
ConstructorVariation[] variations,
String section,
Boolean force,
Expand All @@ -669,17 +661,16 @@ public boolean updateVariations(
}
}

public boolean updateVariations(ConstructorVariation[] variations) throws ConstructorException {
public String updateVariations(ConstructorVariation[] variations) throws ConstructorException {
return updateVariations(variations, "Products", false, null, null);
}

public boolean updateVariations(ConstructorVariation[] variations, String section)
public String updateVariations(ConstructorVariation[] variations, String section)
throws ConstructorException {
return updateVariations(variations, section, false, null, null);
}

public boolean updateVariations(
ConstructorVariation[] variations, String section, Boolean force)
public String updateVariations(ConstructorVariation[] variations, String section, Boolean force)
throws ConstructorException {
return updateVariations(variations, section, force, null, null);
}
Expand All @@ -693,10 +684,10 @@ public boolean updateVariations(
* a large number of existing variations.
* @param notificationEmail An email address where you'd like to receive an email notification
* in case the task fails.
* @return true if working
* @return a string of JSON
* @throws ConstructorException if the request is invalid.
*/
public boolean createOrReplaceVariations(
public String createOrReplaceVariations(
ConstructorVariation[] variations,
String section,
Boolean force,
Expand Down Expand Up @@ -729,24 +720,23 @@ public boolean createOrReplaceVariations(
Request request = this.makeAuthorizedRequestBuilder().url(url).put(body).build();

Response response = client.newCall(request).execute();
getResponseBody(response);
return true;
return getResponseBody(response);
} catch (Exception exception) {
throw new ConstructorException(exception);
}
}

public boolean createOrReplaceVariations(ConstructorVariation[] variations)
public String createOrReplaceVariations(ConstructorVariation[] variations)
throws ConstructorException {
return createOrReplaceVariations(variations, "Products", false, null);
}

public boolean createOrReplaceVariations(ConstructorVariation[] variations, String section)
public String createOrReplaceVariations(ConstructorVariation[] variations, String section)
throws ConstructorException {
return createOrReplaceVariations(variations, section, false, null);
}

public boolean createOrReplaceVariations(
public String createOrReplaceVariations(
ConstructorVariation[] variations, String section, Boolean force)
throws ConstructorException {
return createOrReplaceVariations(variations, section, force, null);
Expand Down
Loading