Skip to content

Commit

Permalink
feat(specs): add runSource endpoint (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#3453

Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com>
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Aug 2, 2024
1 parent 162b4d5 commit dc9e681
Show file tree
Hide file tree
Showing 4 changed files with 378 additions and 0 deletions.
114 changes: 114 additions & 0 deletions algoliasearch/src/main/java/com/algolia/api/IngestionClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -3002,6 +3002,120 @@ public CompletableFuture<RunResponse> pushTaskAsync(@Nonnull String taskID, @Non
return this.pushTaskAsync(taskID, batchWriteParams, null);
}

/**
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per
* task.
*
* @param sourceID Unique identifier of a source. (required)
* @param runSourcePayload (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public RunSourceResponse runSource(@Nonnull String sourceID, RunSourcePayload runSourcePayload, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return LaunderThrowable.await(runSourceAsync(sourceID, runSourcePayload, requestOptions));
}

/**
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per
* task.
*
* @param sourceID Unique identifier of a source. (required)
* @param runSourcePayload (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public RunSourceResponse runSource(@Nonnull String sourceID, RunSourcePayload runSourcePayload) throws AlgoliaRuntimeException {
return this.runSource(sourceID, runSourcePayload, null);
}

/**
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per
* task.
*
* @param sourceID Unique identifier of a source. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public RunSourceResponse runSource(@Nonnull String sourceID, RequestOptions requestOptions) throws AlgoliaRuntimeException {
return this.runSource(sourceID, null, requestOptions);
}

/**
* Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per
* task.
*
* @param sourceID Unique identifier of a source. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public RunSourceResponse runSource(@Nonnull String sourceID) throws AlgoliaRuntimeException {
return this.runSource(sourceID, null, null);
}

/**
* (asynchronously) Runs all tasks linked to a source, only available for Shopify sources. It will
* create 1 run per task.
*
* @param sourceID Unique identifier of a source. (required)
* @param runSourcePayload (optional)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<RunSourceResponse> runSourceAsync(
@Nonnull String sourceID,
RunSourcePayload runSourcePayload,
RequestOptions requestOptions
) throws AlgoliaRuntimeException {
Parameters.requireNonNull(sourceID, "Parameter `sourceID` is required when calling `runSource`.");

HttpRequest request = HttpRequest.builder()
.setPath("/1/sources/{sourceID}/run", sourceID)
.setMethod("POST")
.setBody(runSourcePayload)
.build();
return executeAsync(request, requestOptions, new TypeReference<RunSourceResponse>() {});
}

/**
* (asynchronously) Runs all tasks linked to a source, only available for Shopify sources. It will
* create 1 run per task.
*
* @param sourceID Unique identifier of a source. (required)
* @param runSourcePayload (optional)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<RunSourceResponse> runSourceAsync(@Nonnull String sourceID, RunSourcePayload runSourcePayload)
throws AlgoliaRuntimeException {
return this.runSourceAsync(sourceID, runSourcePayload, null);
}

/**
* (asynchronously) Runs all tasks linked to a source, only available for Shopify sources. It will
* create 1 run per task.
*
* @param sourceID Unique identifier of a source. (required)
* @param requestOptions The requestOptions to send along with the query, they will be merged with
* the transporter requestOptions.
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<RunSourceResponse> runSourceAsync(@Nonnull String sourceID, RequestOptions requestOptions)
throws AlgoliaRuntimeException {
return this.runSourceAsync(sourceID, null, requestOptions);
}

/**
* (asynchronously) Runs all tasks linked to a source, only available for Shopify sources. It will
* create 1 run per task.
*
* @param sourceID Unique identifier of a source. (required)
* @throws AlgoliaRuntimeException If it fails to process the API call
*/
public CompletableFuture<RunSourceResponse> runSourceAsync(@Nonnull String sourceID) throws AlgoliaRuntimeException {
return this.runSourceAsync(sourceID, null, null);
}

/**
* Runs a task. You can check the status of task runs with the observability endpoints.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.ingestion;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;

/** Type of entity to update. */
public enum EntityType {
PRODUCT("product"),

COLLECTION("collection");

private final String value;

EntityType(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}

@JsonCreator
public static EntityType fromValue(String value) {
for (EntityType b : EntityType.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.ingestion;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/** RunSourcePayload */
public class RunSourcePayload {

@JsonProperty("indexToInclude")
private List<String> indexToInclude;

@JsonProperty("indexToExclude")
private List<String> indexToExclude;

@JsonProperty("entityIDs")
private List<String> entityIDs;

@JsonProperty("entityType")
private EntityType entityType;

public RunSourcePayload setIndexToInclude(List<String> indexToInclude) {
this.indexToInclude = indexToInclude;
return this;
}

public RunSourcePayload addIndexToInclude(String indexToIncludeItem) {
if (this.indexToInclude == null) {
this.indexToInclude = new ArrayList<>();
}
this.indexToInclude.add(indexToIncludeItem);
return this;
}

/** List of index names to include in reidexing/update. */
@javax.annotation.Nullable
public List<String> getIndexToInclude() {
return indexToInclude;
}

public RunSourcePayload setIndexToExclude(List<String> indexToExclude) {
this.indexToExclude = indexToExclude;
return this;
}

public RunSourcePayload addIndexToExclude(String indexToExcludeItem) {
if (this.indexToExclude == null) {
this.indexToExclude = new ArrayList<>();
}
this.indexToExclude.add(indexToExcludeItem);
return this;
}

/** List of index names to exclude in reidexing/update. */
@javax.annotation.Nullable
public List<String> getIndexToExclude() {
return indexToExclude;
}

public RunSourcePayload setEntityIDs(List<String> entityIDs) {
this.entityIDs = entityIDs;
return this;
}

public RunSourcePayload addEntityIDs(String entityIDsItem) {
if (this.entityIDs == null) {
this.entityIDs = new ArrayList<>();
}
this.entityIDs.add(entityIDsItem);
return this;
}

/** List of entityID to update. */
@javax.annotation.Nullable
public List<String> getEntityIDs() {
return entityIDs;
}

public RunSourcePayload setEntityType(EntityType entityType) {
this.entityType = entityType;
return this;
}

/** Get entityType */
@javax.annotation.Nullable
public EntityType getEntityType() {
return entityType;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RunSourcePayload runSourcePayload = (RunSourcePayload) o;
return (
Objects.equals(this.indexToInclude, runSourcePayload.indexToInclude) &&
Objects.equals(this.indexToExclude, runSourcePayload.indexToExclude) &&
Objects.equals(this.entityIDs, runSourcePayload.entityIDs) &&
Objects.equals(this.entityType, runSourcePayload.entityType)
);
}

@Override
public int hashCode() {
return Objects.hash(indexToInclude, indexToExclude, entityIDs, entityType);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RunSourcePayload {\n");
sb.append(" indexToInclude: ").append(toIndentedString(indexToInclude)).append("\n");
sb.append(" indexToExclude: ").append(toIndentedString(indexToExclude)).append("\n");
sb.append(" entityIDs: ").append(toIndentedString(entityIDs)).append("\n");
sb.append(" entityType: ").append(toIndentedString(entityType)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.

package com.algolia.model.ingestion;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/** RunSourceResponse */
public class RunSourceResponse {

@JsonProperty("taskWithRunID")
private Map<String, String> taskWithRunID = new HashMap<>();

@JsonProperty("createdAt")
private String createdAt;

public RunSourceResponse setTaskWithRunID(Map<String, String> taskWithRunID) {
this.taskWithRunID = taskWithRunID;
return this;
}

public RunSourceResponse putTaskWithRunID(String key, String taskWithRunIDItem) {
this.taskWithRunID.put(key, taskWithRunIDItem);
return this;
}

/** Map of taskID sent for reindex with the corresponding runID. */
@javax.annotation.Nonnull
public Map<String, String> getTaskWithRunID() {
return taskWithRunID;
}

public RunSourceResponse setCreatedAt(String createdAt) {
this.createdAt = createdAt;
return this;
}

/** Date of creation in RFC 3339 format. */
@javax.annotation.Nonnull
public String getCreatedAt() {
return createdAt;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RunSourceResponse runSourceResponse = (RunSourceResponse) o;
return (
Objects.equals(this.taskWithRunID, runSourceResponse.taskWithRunID) && Objects.equals(this.createdAt, runSourceResponse.createdAt)
);
}

@Override
public int hashCode() {
return Objects.hash(taskWithRunID, createdAt);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RunSourceResponse {\n");
sb.append(" taskWithRunID: ").append(toIndentedString(taskWithRunID)).append("\n");
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

0 comments on commit dc9e681

Please sign in to comment.