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

com.cohere.api.resources.models.requests.ModelsListRequest Maven / Gradle / Ivy

There is a newer version: 1.4.1
Show newest version
/**
 * This file was auto-generated by Fern from our API Definition.
 */
package com.cohere.api.resources.models.requests;

import com.cohere.api.core.ObjectMappers;
import com.cohere.api.types.CompatibleEndpoint;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = ModelsListRequest.Builder.class)
public final class ModelsListRequest {
    private final Optional pageSize;

    private final Optional pageToken;

    private final Optional endpoint;

    private final Optional defaultOnly;

    private final Map additionalProperties;

    private ModelsListRequest(
            Optional pageSize,
            Optional pageToken,
            Optional endpoint,
            Optional defaultOnly,
            Map additionalProperties) {
        this.pageSize = pageSize;
        this.pageToken = pageToken;
        this.endpoint = endpoint;
        this.defaultOnly = defaultOnly;
        this.additionalProperties = additionalProperties;
    }

    /**
     * @return Maximum number of models to include in a page
     * Defaults to 20, min value of 1, max value of 1000.
     */
    @JsonProperty("page_size")
    public Optional getPageSize() {
        return pageSize;
    }

    /**
     * @return Page token provided in the next_page_token field of a previous response.
     */
    @JsonProperty("page_token")
    public Optional getPageToken() {
        return pageToken;
    }

    /**
     * @return When provided, filters the list of models to only those that are compatible with the specified endpoint.
     */
    @JsonProperty("endpoint")
    public Optional getEndpoint() {
        return endpoint;
    }

    /**
     * @return When provided, filters the list of models to only the default model to the endpoint. This parameter is only valid when endpoint is provided.
     */
    @JsonProperty("default_only")
    public Optional getDefaultOnly() {
        return defaultOnly;
    }

    @java.lang.Override
    public boolean equals(Object other) {
        if (this == other) return true;
        return other instanceof ModelsListRequest && equalTo((ModelsListRequest) other);
    }

    @JsonAnyGetter
    public Map getAdditionalProperties() {
        return this.additionalProperties;
    }

    private boolean equalTo(ModelsListRequest other) {
        return pageSize.equals(other.pageSize)
                && pageToken.equals(other.pageToken)
                && endpoint.equals(other.endpoint)
                && defaultOnly.equals(other.defaultOnly);
    }

    @java.lang.Override
    public int hashCode() {
        return Objects.hash(this.pageSize, this.pageToken, this.endpoint, this.defaultOnly);
    }

    @java.lang.Override
    public String toString() {
        return ObjectMappers.stringify(this);
    }

    public static Builder builder() {
        return new Builder();
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static final class Builder {
        private Optional pageSize = Optional.empty();

        private Optional pageToken = Optional.empty();

        private Optional endpoint = Optional.empty();

        private Optional defaultOnly = Optional.empty();

        @JsonAnySetter
        private Map additionalProperties = new HashMap<>();

        private Builder() {}

        public Builder from(ModelsListRequest other) {
            pageSize(other.getPageSize());
            pageToken(other.getPageToken());
            endpoint(other.getEndpoint());
            defaultOnly(other.getDefaultOnly());
            return this;
        }

        @JsonSetter(value = "page_size", nulls = Nulls.SKIP)
        public Builder pageSize(Optional pageSize) {
            this.pageSize = pageSize;
            return this;
        }

        public Builder pageSize(Double pageSize) {
            this.pageSize = Optional.of(pageSize);
            return this;
        }

        @JsonSetter(value = "page_token", nulls = Nulls.SKIP)
        public Builder pageToken(Optional pageToken) {
            this.pageToken = pageToken;
            return this;
        }

        public Builder pageToken(String pageToken) {
            this.pageToken = Optional.of(pageToken);
            return this;
        }

        @JsonSetter(value = "endpoint", nulls = Nulls.SKIP)
        public Builder endpoint(Optional endpoint) {
            this.endpoint = endpoint;
            return this;
        }

        public Builder endpoint(CompatibleEndpoint endpoint) {
            this.endpoint = Optional.of(endpoint);
            return this;
        }

        @JsonSetter(value = "default_only", nulls = Nulls.SKIP)
        public Builder defaultOnly(Optional defaultOnly) {
            this.defaultOnly = defaultOnly;
            return this;
        }

        public Builder defaultOnly(Boolean defaultOnly) {
            this.defaultOnly = Optional.of(defaultOnly);
            return this;
        }

        public ModelsListRequest build() {
            return new ModelsListRequest(pageSize, pageToken, endpoint, defaultOnly, additionalProperties);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy