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

com.withabound.resources.Documents Maven / Gradle / Ivy

Go to download

The Abound Java SDK provides convenient access to the Abound API from applications written in Java.

The newest version!
package com.withabound.resources;

import com.withabound.AboundConfig;
import com.withabound.models.documents.Document;
import com.withabound.models.documents.DocumentParams;
import com.withabound.models.documents.IDocumentRequest;
import com.withabound.resources.base.AboundBulkResponse;
import com.withabound.resources.base.AboundResponse;
import com.withabound.resources.base.AboundUserScopedResource;
import com.withabound.resources.base.EmptyJsonObject;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import okhttp3.OkHttpClient;

/** See https://docs.withabound.com/reference/documents */
public class Documents extends AboundUserScopedResource {
  public Documents(final AboundConfig aboundConfig, final OkHttpClient httpClient) {
    super(aboundConfig, httpClient, Document.class);
  }

  @Override
  protected String getPath() {
    return "/documents";
  }

  public AboundBulkResponse create(
      final String userId, final List toCreate) throws IOException {
    final Map> requestBody =
        Collections.singletonMap("documents", toCreate);

    return super.bulkCreateForUser(userId, requestBody);
  }

  @Override
  public AboundBulkResponse list(final String userId) throws IOException {
    return super.listForUser(userId);
  }

  public AboundBulkResponse list(final String userId, final DocumentParams params)
      throws IOException {
    return super.listForUser(userId, params);
  }

  public AboundResponse retrieve(final String userId, final String documentId)
      throws IOException {
    return super.retrieveForUser(userId, documentId);
  }

  public AboundResponse delete(final String userId, final String documentId)
      throws IOException {
    return super.deleteForUser(userId, documentId);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy