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

io.weaviate.client.v1.schema.api.ClassUpdater Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
package io.weaviate.client.v1.schema.api;

import io.weaviate.client.Config;
import io.weaviate.client.base.BaseClient;
import io.weaviate.client.base.ClientResult;
import io.weaviate.client.base.Response;
import io.weaviate.client.base.Result;
import io.weaviate.client.base.http.HttpClient;
import io.weaviate.client.base.util.UrlEncoder;
import io.weaviate.client.v1.schema.model.WeaviateClass;

public class ClassUpdater extends BaseClient implements ClientResult {

  private WeaviateClass clazz;

  public ClassUpdater(HttpClient httpClient, Config config) {
    super(httpClient, config);
  }

  public ClassUpdater withClass(WeaviateClass clazz) {
    this.clazz = clazz;
    return this;
  }

  @Override
  public Result run() {
    String path = String.format("/schema/%s", UrlEncoder.encodePathParam(clazz.getClassName()));
    Response resp = sendPutRequest(path, clazz, WeaviateClass.class);
    return new Result<>(resp.getStatusCode(), resp.getStatusCode() == 200, resp.getErrors());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy