All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.algolia.search.models.indexing.BatchRequest Maven / Gradle / Ivy

The newest version!
package com.algolia.search.models.indexing;

import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_NULL)
@SuppressWarnings("unused")
public class BatchRequest implements Serializable {

  private List> requests;

  public BatchRequest(List> requests) {
    this.requests = requests;
  }

  public BatchRequest(String actionType, Iterable data) {
    Objects.requireNonNull(actionType, "Action type is required.");
    Objects.requireNonNull(data, "Data are required.");

    this.requests = new ArrayList<>();

    for (T item : data) {
      this.requests.add(new BatchOperation<>(actionType, item));
    }
  }

  public List> getRequests() {
    return requests;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy