Package com.io7m.cardant.client.api

# Interface CAClientSynchronousType

All Superinterfaces:
  `AutoCloseable`, `com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>`, `com.io7m.hibiscus.api.HBClientStatusType<CAICommandType<?>,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>`, `com.io7m.hibiscus.api.HBClientSynchronousOperationsType<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientCredentials>`, `com.io7m.hibiscus.api.HBClientSynchronousType<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>`, `com.io7m.repetoir.core.RPServiceType`

All Known Implementing Classes:
  `CAClientSynchronous`

public interface CAClientSynchronousType extends com.io7m.hibiscus.api.HBClientSynchronousType<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>, com.io7m.repetoir.core.RPServiceType
The type of client instances.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default String`
  `description()`
  `default <R extends CAIResponseType>
  R`
  `executeOrElseThrow(CAICommandType<R> command)`
  Execute the given command synchronously, or throw an exception based on the failure response.
  `com.io7m.hibiscus.api.HBResultType<Path,CAIResponseError>`
  `fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics)`
  Download the data associated with the given file.
  `default Path`
  `fileDownloadOrThrow(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics)`
  Download the data associated with the given file.
  `com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError>`
  `fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics)`
  Upload the data associated with the given file.
  `default CAFileID`
  `fileUploadOrThrow(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics)`
  Upload the data associated with the given file.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `garbage()`
  Send random garbage to the server.
  `default void`
  `garbageOrElseThrow()`
  Send random garbage to the server.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `invalid()`
  Send random garbage to the server.
  `default void`
  `invalidOrElseThrow()`
  Send random garbage to the server.
  `default CAIResponseType`
  `loginOrElseThrow(CAClientCredentials credentials)`
  Log in synchronously, or throw an exception based on the failure response.
  `Optional<CAUserID>`
  `userId()`

  ### Methods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType

  `close, isClosed`

  ### Methods inherited from interface com.io7m.hibiscus.api.HBClientStatusType

  `events, isConnected, state, stateNow`

  ### Methods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousOperationsType

  `disconnect, execute, login, pollEvents`

  ### Methods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousType

  `executeOrElseThrow, loginOrElseThrow`

- ## Method Details

  - ### description

    default String description()
    Specified by:
      `description` in interface `com.io7m.repetoir.core.RPServiceType`

  - ### userId

    Optional<CAUserID> userId()
    Returns:
      The current logged-in user

  - ### fileDownload

    com.io7m.hibiscus.api.HBResultType<Path,CAIResponseError> fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException
    Download the data associated with the given file. The file will be downloaded to a temporary file and then, if everything succeeds and the hash value matches, the temporary file will atomically replace the output file.
    Parameters:
      `fileID` - The file ID
      `file` - The output file
      `fileTmp` - The temporary output file
      `size` - The expected size
      `hashAlgorithm` - The hash algorithm
      `hashValue` - The expected hash value
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### fileDownloadOrThrow

    default Path fileDownloadOrThrow(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException
    Download the data associated with the given file. The file will be downloaded to a temporary file and then, if everything succeeds and the hash value matches, the temporary file will atomically replace the output file.
    Parameters:
      `fileID` - The file ID
      `file` - The output file
      `fileTmp` - The temporary output file
      `size` - The expected size
      `hashAlgorithm` - The hash algorithm
      `hashValue` - The expected hash value
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `CAClientException` - On errors
      `InterruptedException` - On interruption

  - ### fileUpload

    com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError> fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException
    Upload the data associated with the given file.
    Parameters:
      `fileID` - The file ID
      `file` - The input file
      `contentType` - The content type
      `description` - The file description
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### fileUploadOrThrow

    default CAFileID fileUploadOrThrow(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException, CAClientException
    Upload the data associated with the given file.
    Parameters:
      `fileID` - The file ID
      `file` - The input file
      `contentType` - The content type
      `description` - The file description
      `statistics` - A receiver of transfer statistics
    Returns:
      The result
    Throws:
      `CAClientException` - On errors
      `InterruptedException` - On interruption

  - ### garbage

    com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> garbage() throws InterruptedException
    Send random garbage to the server.
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### garbageOrElseThrow

    default void garbageOrElseThrow() throws CAClientException, InterruptedException
    Send random garbage to the server.
    Throws:
      `CAClientException` - On errors
      `InterruptedException` - On interruption

  - ### invalid

    com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> invalid() throws InterruptedException
    Send random garbage to the server.
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### invalidOrElseThrow

    default void invalidOrElseThrow() throws CAClientException, InterruptedException
    Send random garbage to the server.
    Throws:
      `CAClientException` - On errors
      `InterruptedException` - On interruption

  - ### loginOrElseThrow

    default CAIResponseType loginOrElseThrow(CAClientCredentials credentials) throws CAClientException, InterruptedException
    Log in synchronously, or throw an exception based on the failure response.
    Parameters:
      `credentials` - The credentials
    Returns:
      The result
    Throws:
      `CAClientException` - On errors
      `InterruptedException` - On interruption

  - ### executeOrElseThrow

    default <R extends CAIResponseType> R executeOrElseThrow(CAICommandType<R> command) throws CAClientException, InterruptedException
    Execute the given command synchronously, or throw an exception based on the failure response.
    Type Parameters:
      `R` - The precise type of returned value
    Parameters:
      `command` - The command
    Returns:
      The result
    Throws:
      `CAClientException` - If command execution fails
      `InterruptedException` - On interruption