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

io.github.sashirestela.openai.common.Page Maven / Gradle / Ivy

There is a newer version: 3.9.2
Show newest version
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);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy