DocumentsResource

Lists, uploads and links to the project's documents.

  • Stable unknown
  • Release candidate since 0.1.0-rc.4
  • Development since 0.1.0-dev.24+fa54770
public final class DocumentsResource

Lists, uploads and links to the project's documents. Get it from Ovok.documents().

Methods

list

public JsonNode list() throws IOException, InterruptedException

Lists documents (GET /document).

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode list(Map<String, ?> parameters) throws IOException, InterruptedException

Lists documents (GET /document?...).

Parameters:

  • parameters: query parameters added to the URL

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode list(
        Map<String, ?> parameters,
        RequestOptions options) throws IOException, InterruptedException

Lists documents (GET /document?...).

Parameters:

  • parameters: query parameters added to the URL
  • options: per-request options, such as the timeout

Returns: the response body

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

createUpload

public JsonNode createUpload(Object body) throws IOException, InterruptedException

Creates a document and its upload (POST /document).

Parameters:

  • body: the document metadata, serialized as JSON

Returns: the created document with its upload details

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode createUpload(
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Creates a document and its upload (POST /document).

Parameters:

  • body: the document metadata, serialized as JSON
  • options: per-request options, such as the timeout

Returns: the created document with its upload details

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

replaceUpload

public JsonNode replaceUpload(
        String documentId,
        Object body) throws IOException, InterruptedException

Starts a new upload that replaces a document's file (POST /document/{documentId}).

Parameters:

  • documentId: the document id
  • body: the upload metadata, serialized as JSON

Returns: the document with its upload details

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode replaceUpload(
        String documentId,
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Starts a new upload that replaces a document's file (POST /document/{documentId}).

Parameters:

  • documentId: the document id
  • body: the upload metadata, serialized as JSON
  • options: per-request options, such as the timeout

Returns: the document with its upload details

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

updateMetadata

public JsonNode updateMetadata(
        String documentId,
        Object body) throws IOException, InterruptedException

Updates a document's metadata (PATCH /document/{documentId}).

Parameters:

  • documentId: the document id
  • body: the fields to change, serialized as JSON

Returns: the updated document

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode updateMetadata(
        String documentId,
        Object body,
        RequestOptions options) throws IOException, InterruptedException

Updates a document's metadata (PATCH /document/{documentId}).

Parameters:

  • documentId: the document id
  • body: the fields to change, serialized as JSON
  • options: per-request options, such as the timeout

Returns: the updated document

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

delete

public JsonNode delete(String documentId) throws IOException, InterruptedException

Deletes a document (DELETE /document/{documentId}).

Parameters:

  • documentId: the document id

Returns: the response body, or null when it is empty

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response
public JsonNode delete(
        String documentId,
        RequestOptions options) throws IOException, InterruptedException

Deletes a document (DELETE /document/{documentId}).

Parameters:

  • documentId: the document id
  • options: per-request options, such as the timeout

Returns: the response body, or null when it is empty

Throws:

  • IOException: if the request cannot be sent or the response cannot be read
  • InterruptedException: if the thread is interrupted while waiting for the response

downloadUrl

public String downloadUrl(String documentId)

Builds the download URL of a document (GET /document/{documentId}); no request is sent.

Parameters:

  • documentId: the document id

Returns: the absolute URL

public String downloadUrl(String documentId, Map<String, ?> parameters)

Builds the download URL of a document (GET /document/{documentId}?...); no request is sent.

Parameters:

  • documentId: the document id
  • parameters: query parameters added to the URL

Returns: the absolute URL

publicDownloadUrl

public String publicDownloadUrl(String publicToken)

Builds the public download URL for a share token (GET /document/public/{publicToken}); no request is sent.

Parameters:

  • publicToken: the document's public share token

Returns: the absolute URL

public String publicDownloadUrl(String publicToken, Map<String, ?> parameters)

Builds the public download URL for a share token (GET /document/public/{publicToken}?...); no request is sent.

Parameters:

  • publicToken: the document's public share token
  • parameters: query parameters added to the URL

Returns: the absolute URL

Last updated on

On this page