Skip to content

Commit 009455f

Browse files
authored
feat(spec): add customRequest methods (#178)
1 parent 2408451 commit 009455f

File tree

129 files changed

+5986
-803
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+5986
-803
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.algolia.model;
2+
3+
import com.google.gson.annotations.SerializedName;
4+
import java.util.Objects;
5+
6+
/** BatchOperation */
7+
public class BatchOperation {
8+
9+
@SerializedName("action")
10+
private Action action;
11+
12+
@SerializedName("body")
13+
private Object body;
14+
15+
public BatchOperation action(Action action) {
16+
this.action = action;
17+
return this;
18+
}
19+
20+
/**
21+
* Get action
22+
*
23+
* @return action
24+
*/
25+
@javax.annotation.Nullable
26+
public Action getAction() {
27+
return action;
28+
}
29+
30+
public void setAction(Action action) {
31+
this.action = action;
32+
}
33+
34+
public BatchOperation body(Object body) {
35+
this.body = body;
36+
return this;
37+
}
38+
39+
/**
40+
* arguments to the operation (depends on the type of the operation).
41+
*
42+
* @return body
43+
*/
44+
@javax.annotation.Nullable
45+
public Object getBody() {
46+
return body;
47+
}
48+
49+
public void setBody(Object body) {
50+
this.body = body;
51+
}
52+
53+
@Override
54+
public boolean equals(Object o) {
55+
if (this == o) {
56+
return true;
57+
}
58+
if (o == null || getClass() != o.getClass()) {
59+
return false;
60+
}
61+
BatchOperation batchOperation = (BatchOperation) o;
62+
return (
63+
Objects.equals(this.action, batchOperation.action) &&
64+
Objects.equals(this.body, batchOperation.body)
65+
);
66+
}
67+
68+
@Override
69+
public int hashCode() {
70+
return Objects.hash(action, body);
71+
}
72+
73+
@Override
74+
public String toString() {
75+
StringBuilder sb = new StringBuilder();
76+
sb.append("class BatchOperation {\n");
77+
sb.append(" action: ").append(toIndentedString(action)).append("\n");
78+
sb.append(" body: ").append(toIndentedString(body)).append("\n");
79+
sb.append("}");
80+
return sb.toString();
81+
}
82+
83+
/**
84+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
85+
*/
86+
private String toIndentedString(Object o) {
87+
if (o == null) {
88+
return "null";
89+
}
90+
return o.toString().replace("\n", "\n ");
91+
}
92+
}

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchParams.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
public class BatchParams {
1010

1111
@SerializedName("requests")
12-
private List<Operation> requests = null;
12+
private List<MultipleBatchOperation> requests = null;
1313

14-
public BatchParams requests(List<Operation> requests) {
14+
public BatchParams requests(List<MultipleBatchOperation> requests) {
1515
this.requests = requests;
1616
return this;
1717
}
1818

19-
public BatchParams addRequestsItem(Operation requestsItem) {
19+
public BatchParams addRequestsItem(MultipleBatchOperation requestsItem) {
2020
if (this.requests == null) {
2121
this.requests = new ArrayList<>();
2222
}
@@ -30,11 +30,11 @@ public BatchParams addRequestsItem(Operation requestsItem) {
3030
* @return requests
3131
*/
3232
@javax.annotation.Nullable
33-
public List<Operation> getRequests() {
33+
public List<MultipleBatchOperation> getRequests() {
3434
return requests;
3535
}
3636

37-
public void setRequests(List<Operation> requests) {
37+
public void setRequests(List<MultipleBatchOperation> requests) {
3838
this.requests = requests;
3939
}
4040

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/BatchWriteParams.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
public class BatchWriteParams {
1010

1111
@SerializedName("requests")
12-
private List<Operation> requests = null;
12+
private List<BatchOperation> requests = null;
1313

14-
public BatchWriteParams requests(List<Operation> requests) {
14+
public BatchWriteParams requests(List<BatchOperation> requests) {
1515
this.requests = requests;
1616
return this;
1717
}
1818

19-
public BatchWriteParams addRequestsItem(Operation requestsItem) {
19+
public BatchWriteParams addRequestsItem(BatchOperation requestsItem) {
2020
if (this.requests == null) {
2121
this.requests = new ArrayList<>();
2222
}
@@ -30,11 +30,11 @@ public BatchWriteParams addRequestsItem(Operation requestsItem) {
3030
* @return requests
3131
*/
3232
@javax.annotation.Nullable
33-
public List<Operation> getRequests() {
33+
public List<BatchOperation> getRequests() {
3434
return requests;
3535
}
3636

37-
public void setRequests(List<Operation> requests) {
37+
public void setRequests(List<BatchOperation> requests) {
3838
this.requests = requests;
3939
}
4040

clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/Operation.java renamed to clients/algoliasearch-client-java-2/algoliasearch-core/com/algolia/model/MultipleBatchOperation.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import com.google.gson.annotations.SerializedName;
44
import java.util.Objects;
55

6-
/** Operation */
7-
public class Operation {
6+
/** MultipleBatchOperation */
7+
public class MultipleBatchOperation {
88

99
@SerializedName("action")
1010
private Action action;
@@ -15,7 +15,7 @@ public class Operation {
1515
@SerializedName("indexName")
1616
private String indexName;
1717

18-
public Operation action(Action action) {
18+
public MultipleBatchOperation action(Action action) {
1919
this.action = action;
2020
return this;
2121
}
@@ -34,7 +34,7 @@ public void setAction(Action action) {
3434
this.action = action;
3535
}
3636

37-
public Operation body(Object body) {
37+
public MultipleBatchOperation body(Object body) {
3838
this.body = body;
3939
return this;
4040
}
@@ -53,7 +53,7 @@ public void setBody(Object body) {
5353
this.body = body;
5454
}
5555

56-
public Operation indexName(String indexName) {
56+
public MultipleBatchOperation indexName(String indexName) {
5757
this.indexName = indexName;
5858
return this;
5959
}
@@ -80,11 +80,11 @@ public boolean equals(Object o) {
8080
if (o == null || getClass() != o.getClass()) {
8181
return false;
8282
}
83-
Operation operation = (Operation) o;
83+
MultipleBatchOperation multipleBatchOperation = (MultipleBatchOperation) o;
8484
return (
85-
Objects.equals(this.action, operation.action) &&
86-
Objects.equals(this.body, operation.body) &&
87-
Objects.equals(this.indexName, operation.indexName)
85+
Objects.equals(this.action, multipleBatchOperation.action) &&
86+
Objects.equals(this.body, multipleBatchOperation.body) &&
87+
Objects.equals(this.indexName, multipleBatchOperation.indexName)
8888
);
8989
}
9090

@@ -96,7 +96,7 @@ public int hashCode() {
9696
@Override
9797
public String toString() {
9898
StringBuilder sb = new StringBuilder();
99-
sb.append("class Operation {\n");
99+
sb.append("class MultipleBatchOperation {\n");
100100
sb.append(" action: ").append(toIndentedString(action)).append("\n");
101101
sb.append(" body: ").append(toIndentedString(body)).append("\n");
102102
sb

0 commit comments

Comments
 (0)