Skip to content

Commit

Permalink
feat(specs): add objects endpoints (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
damcou authored Jan 3, 2022
1 parent 3aeab63 commit 905e5a5
Show file tree
Hide file tree
Showing 42 changed files with 4,561 additions and 683 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.algolia.model;

import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;

/** type of operation. */
@JsonAdapter(Action.Adapter.class)
public enum Action {
ADDOBJECT("addObject"),

UPDATEOBJECT("updateObject"),

PARTIALUPDATEOBJECT("partialUpdateObject"),

PARTIALUPDATEOBJECTNOCREATE("partialUpdateObjectNoCreate"),

DELETEOBJECT("deleteObject"),

DELETE("delete"),

CLEAR("clear");

private String value;

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

public String getValue() {
return value;
}

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

public static Action fromValue(String value) {
for (Action b : Action.values()) {
if (b.value.equals(value)) {
return b;
}
}
throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

public static class Adapter extends TypeAdapter<Action> {

@Override
public void write(final JsonWriter jsonWriter, final Action enumeration)
throws IOException {
jsonWriter.value(enumeration.getValue());
}

@Override
public Action read(final JsonReader jsonReader) throws IOException {
String value = jsonReader.nextString();
return Action.fromValue(value);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package com.algolia.model;

import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModelProperty;
import java.time.OffsetDateTime;
import java.util.Objects;

/** AddOrUpdateObjectResponse */
public class AddOrUpdateObjectResponse {

public static final String SERIALIZED_NAME_UPDATED_AT = "updatedAt";

@SerializedName(SERIALIZED_NAME_UPDATED_AT)
private OffsetDateTime updatedAt;

public static final String SERIALIZED_NAME_TASK_I_D = "taskID";

@SerializedName(SERIALIZED_NAME_TASK_I_D)
private Integer taskID;

public static final String SERIALIZED_NAME_OBJECT_I_D = "objectID";

@SerializedName(SERIALIZED_NAME_OBJECT_I_D)
private String objectID;

public AddOrUpdateObjectResponse updatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
return this;
}

/**
* Date of last update (ISO-8601 format).
*
* @return updatedAt
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "Date of last update (ISO-8601 format).")
public OffsetDateTime getUpdatedAt() {
return updatedAt;
}

public void setUpdatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
}

public AddOrUpdateObjectResponse taskID(Integer taskID) {
this.taskID = taskID;
return this;
}

/**
* taskID of the indexing task to wait for.
*
* @return taskID
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "taskID of the indexing task to wait for.")
public Integer getTaskID() {
return taskID;
}

public void setTaskID(Integer taskID) {
this.taskID = taskID;
}

public AddOrUpdateObjectResponse objectID(String objectID) {
this.objectID = objectID;
return this;
}

/**
* Unique identifier of the object.
*
* @return objectID
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "Unique identifier of the object.")
public String getObjectID() {
return objectID;
}

public void setObjectID(String objectID) {
this.objectID = objectID;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
AddOrUpdateObjectResponse addOrUpdateObjectResponse = (AddOrUpdateObjectResponse) o;
return (
Objects.equals(this.updatedAt, addOrUpdateObjectResponse.updatedAt) &&
Objects.equals(this.taskID, addOrUpdateObjectResponse.taskID) &&
Objects.equals(this.objectID, addOrUpdateObjectResponse.objectID)
);
}

@Override
public int hashCode() {
return Objects.hash(updatedAt, taskID, objectID);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class AddOrUpdateObjectResponse {\n");
sb
.append(" updatedAt: ")
.append(toIndentedString(updatedAt))
.append("\n");
sb.append(" taskID: ").append(toIndentedString(taskID)).append("\n");
sb.append(" objectID: ").append(toIndentedString(objectID)).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,82 @@
package com.algolia.model;

import com.google.gson.annotations.SerializedName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/** The `batch` requests. */
@ApiModel(description = "The `batch` requests.")
public class BatchWriteObject {

public static final String SERIALIZED_NAME_REQUESTS = "requests";

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

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

public BatchWriteObject addRequestsItem(Operation requestsItem) {
if (this.requests == null) {
this.requests = new ArrayList<>();
}
this.requests.add(requestsItem);
return this;
}

/**
* Get requests
*
* @return requests
*/
@javax.annotation.Nullable
@ApiModelProperty(value = "")
public List<Operation> getRequests() {
return requests;
}

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

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
BatchWriteObject batchWriteObject = (BatchWriteObject) o;
return Objects.equals(this.requests, batchWriteObject.requests);
}

@Override
public int hashCode() {
return Objects.hash(requests);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class BatchWriteObject {\n");
sb.append(" requests: ").append(toIndentedString(requests)).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 ");
}
}
Loading

0 comments on commit 905e5a5

Please sign in to comment.