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

com.cohere.api.resources.connectors.requests.UpdateConnectorRequest 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.connectors.requests;

import com.cohere.api.core.ObjectMappers;
import com.cohere.api.types.CreateConnectorOAuth;
import com.cohere.api.types.CreateConnectorServiceAuth;
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.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;

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

    private final Optional url;

    private final Optional> excludes;

    private final Optional oauth;

    private final Optional active;

    private final Optional continueOnFailure;

    private final Optional serviceAuth;

    private final Map additionalProperties;

    private UpdateConnectorRequest(
            Optional name,
            Optional url,
            Optional> excludes,
            Optional oauth,
            Optional active,
            Optional continueOnFailure,
            Optional serviceAuth,
            Map additionalProperties) {
        this.name = name;
        this.url = url;
        this.excludes = excludes;
        this.oauth = oauth;
        this.active = active;
        this.continueOnFailure = continueOnFailure;
        this.serviceAuth = serviceAuth;
        this.additionalProperties = additionalProperties;
    }

    /**
     * @return A human-readable name for the connector.
     */
    @JsonProperty("name")
    public Optional getName() {
        return name;
    }

    /**
     * @return The URL of the connector that will be used to search for documents.
     */
    @JsonProperty("url")
    public Optional getUrl() {
        return url;
    }

    /**
     * @return A list of fields to exclude from the prompt (fields remain in the document).
     */
    @JsonProperty("excludes")
    public Optional> getExcludes() {
        return excludes;
    }

    /**
     * @return The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.
     */
    @JsonProperty("oauth")
    public Optional getOauth() {
        return oauth;
    }

    @JsonProperty("active")
    public Optional getActive() {
        return active;
    }

    @JsonProperty("continue_on_failure")
    public Optional getContinueOnFailure() {
        return continueOnFailure;
    }

    /**
     * @return The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.
     */
    @JsonProperty("service_auth")
    public Optional getServiceAuth() {
        return serviceAuth;
    }

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

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

    private boolean equalTo(UpdateConnectorRequest other) {
        return name.equals(other.name)
                && url.equals(other.url)
                && excludes.equals(other.excludes)
                && oauth.equals(other.oauth)
                && active.equals(other.active)
                && continueOnFailure.equals(other.continueOnFailure)
                && serviceAuth.equals(other.serviceAuth);
    }

    @java.lang.Override
    public int hashCode() {
        return Objects.hash(
                this.name, this.url, this.excludes, this.oauth, this.active, this.continueOnFailure, this.serviceAuth);
    }

    @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 name = Optional.empty();

        private Optional url = Optional.empty();

        private Optional> excludes = Optional.empty();

        private Optional oauth = Optional.empty();

        private Optional active = Optional.empty();

        private Optional continueOnFailure = Optional.empty();

        private Optional serviceAuth = Optional.empty();

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

        private Builder() {}

        public Builder from(UpdateConnectorRequest other) {
            name(other.getName());
            url(other.getUrl());
            excludes(other.getExcludes());
            oauth(other.getOauth());
            active(other.getActive());
            continueOnFailure(other.getContinueOnFailure());
            serviceAuth(other.getServiceAuth());
            return this;
        }

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

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

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

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

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

        public Builder excludes(List excludes) {
            this.excludes = Optional.of(excludes);
            return this;
        }

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

        public Builder oauth(CreateConnectorOAuth oauth) {
            this.oauth = Optional.of(oauth);
            return this;
        }

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

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

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

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

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

        public Builder serviceAuth(CreateConnectorServiceAuth serviceAuth) {
            this.serviceAuth = Optional.of(serviceAuth);
            return this;
        }

        public UpdateConnectorRequest build() {
            return new UpdateConnectorRequest(
                    name, url, excludes, oauth, active, continueOnFailure, serviceAuth, additionalProperties);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy