io.github.sashirestela.openai.common.Page Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of simple-openai Show documentation
Show all versions of simple-openai Show documentation
A Java library to use the OpenAI API in the simplest possible way.
package io.github.sashirestela.openai.common;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.util.AbstractList;
import java.util.List;
@NoArgsConstructor
@Getter
@ToString
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public class Page extends AbstractList {
private String object;
private List data;
private String firstId;
private String lastId;
private boolean hasMore;
@Override
public T get(int index) {
return data.get(index);
}
@Override
public int size() {
return data.size();
}
public T first() {
return get(0);
}
public T last() {
return get(size() - 1);
}
@Override
public boolean equals(Object other) {
return super.equals(other);
}
}