Skip to content

Commit

Permalink
feat(spec): add customRequest methods (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Mar 1, 2022
1 parent 2408451 commit 009455f
Show file tree
Hide file tree
Showing 129 changed files with 5,986 additions and 803 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.algolia.model;

import com.google.gson.annotations.SerializedName;
import java.util.Objects;

/** BatchOperation */
public class BatchOperation {

@SerializedName("action")
private Action action;

@SerializedName("body")
private Object body;

public BatchOperation action(Action action) {
this.action = action;
return this;
}

/**
* Get action
*
* @return action
*/
@javax.annotation.Nullable
public Action getAction() {
return action;
}

public void setAction(Action action) {
this.action = action;
}

public BatchOperation body(Object body) {
this.body = body;
return this;
}

/**
* arguments to the operation (depends on the type of the operation).
*
* @return body
*/
@javax.annotation.Nullable
public Object getBody() {
return body;
}

public void setBody(Object body) {
this.body = body;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BatchOperation batchOperation = (BatchOperation) o;
return (
Objects.equals(this.action, batchOperation.action) &&
Objects.equals(this.body, batchOperation.body)
);
}

@Override
public int hashCode() {
return Objects.hash(action, body);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BatchOperation {\n");
sb.append(" action: ").append(toIndentedString(action)).append("\n");
sb.append(" body: ").append(toIndentedString(body)).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
Expand Up @@ -9,14 +9,14 @@
public class BatchParams {

@SerializedName("requests")
private List<Operation> requests = null;
private List<MultipleBatchOperation> requests = null;

public BatchParams requests(List<Operation> requests) {
public BatchParams requests(List<MultipleBatchOperation> requests) {
this.requests = requests;
return this;
}

public BatchParams addRequestsItem(Operation requestsItem) {
public BatchParams addRequestsItem(MultipleBatchOperation requestsItem) {
if (this.requests == null) {
this.requests = new ArrayList<>();
}
Expand All @@ -30,11 +30,11 @@ public BatchParams addRequestsItem(Operation requestsItem) {
* @return requests
*/
@javax.annotation.Nullable
public List<Operation> getRequests() {
public List<MultipleBatchOperation> getRequests() {
return requests;
}

public void setRequests(List<Operation> requests) {
public void setRequests(List<MultipleBatchOperation> requests) {
this.requests = requests;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
public class BatchWriteParams {

@SerializedName("requests")
private List<Operation> requests = null;
private List<BatchOperation> requests = null;

public BatchWriteParams requests(List<Operation> requests) {
public BatchWriteParams requests(List<BatchOperation> requests) {
this.requests = requests;
return this;
}

public BatchWriteParams addRequestsItem(Operation requestsItem) {
public BatchWriteParams addRequestsItem(BatchOperation requestsItem) {
if (this.requests == null) {
this.requests = new ArrayList<>();
}
Expand All @@ -30,11 +30,11 @@ public BatchWriteParams addRequestsItem(Operation requestsItem) {
* @return requests
*/
@javax.annotation.Nullable
public List<Operation> getRequests() {
public List<BatchOperation> getRequests() {
return requests;
}

public void setRequests(List<Operation> requests) {
public void setRequests(List<BatchOperation> requests) {
this.requests = requests;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import com.google.gson.annotations.SerializedName;
import java.util.Objects;

/** Operation */
public class Operation {
/** MultipleBatchOperation */
public class MultipleBatchOperation {

@SerializedName("action")
private Action action;
Expand All @@ -15,7 +15,7 @@ public class Operation {
@SerializedName("indexName")
private String indexName;

public Operation action(Action action) {
public MultipleBatchOperation action(Action action) {
this.action = action;
return this;
}
Expand All @@ -34,7 +34,7 @@ public void setAction(Action action) {
this.action = action;
}

public Operation body(Object body) {
public MultipleBatchOperation body(Object body) {
this.body = body;
return this;
}
Expand All @@ -53,7 +53,7 @@ public void setBody(Object body) {
this.body = body;
}

public Operation indexName(String indexName) {
public MultipleBatchOperation indexName(String indexName) {
this.indexName = indexName;
return this;
}
Expand All @@ -80,11 +80,11 @@ public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
Operation operation = (Operation) o;
MultipleBatchOperation multipleBatchOperation = (MultipleBatchOperation) o;
return (
Objects.equals(this.action, operation.action) &&
Objects.equals(this.body, operation.body) &&
Objects.equals(this.indexName, operation.indexName)
Objects.equals(this.action, multipleBatchOperation.action) &&
Objects.equals(this.body, multipleBatchOperation.body) &&
Objects.equals(this.indexName, multipleBatchOperation.indexName)
);
}

Expand All @@ -96,7 +96,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Operation {\n");
sb.append("class MultipleBatchOperation {\n");
sb.append(" action: ").append(toIndentedString(action)).append("\n");
sb.append(" body: ").append(toIndentedString(body)).append("\n");
sb
Expand Down
Loading

0 comments on commit 009455f

Please sign in to comment.