Package com.io7m.cardant.client.basic.internal

# Class CAClientSynchronous

java.lang.Object
com.io7m.hibiscus.basic.HBClientSynchronousAbstract<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials>
com.io7m.cardant.client.basic.internal.CAClientSynchronous

All Implemented Interfaces:
  `CAClientSynchronousType`, `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`, `AutoCloseable`

public final class CAClientSynchronous extends com.io7m.hibiscus.basic.HBClientSynchronousAbstract<CAClientException,CAICommandType<?>,CAIResponseType,CAIResponseType,CAIResponseError,CAClientEventType,CAClientCredentials> implements CAClientSynchronousType
The synchronous client.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CAClientSynchronous(CAClientConfiguration inConfiguration, CAStrings inStrings, HttpClient inHttpClient)`
  The synchronous client.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `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.
  `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.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `garbage()`
  Send random garbage to the server.
  `com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError>`
  `invalid()`
  Send random garbage to the server.
  `String`
  `toString()`
  `Optional<CAUserID>`
  `userId()`

  ### Methods inherited from class com.io7m.hibiscus.basic.HBClientSynchronousAbstract

  `checkNotClosingOrClosed, close, currentHandler, disconnect, eventPublisher, events, execute, isClosed, isConnected, login, pollEvents, state, stateNow, statePublisher`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.io7m.cardant.client.api.CAClientSynchronousType

  `description, executeOrElseThrow, fileDownloadOrThrow, fileUploadOrThrow, garbageOrElseThrow, invalidOrElseThrow, loginOrElseThrow`

  ### 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`

- ## Constructor Details

  - ### CAClientSynchronous

    public CAClientSynchronous(CAClientConfiguration inConfiguration, CAStrings inStrings, HttpClient inHttpClient)
    The synchronous client.
    Parameters:
      `inConfiguration` - The configuration
      `inStrings` - The string resources
      `inHttpClient` - The HTTP client

- ## Method Details

  - ### userId

    public Optional<CAUserID> userId()
    Specified by:
      `userId` in interface `CAClientSynchronousType`
    Returns:
      The current logged-in user

  - ### fileDownload

    public 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
    Description copied from interface: `CAClientSynchronousType`
    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.
    Specified by:
      `fileDownload` in interface `CAClientSynchronousType`
    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

  - ### fileUpload

    public com.io7m.hibiscus.api.HBResultType<CAFileID,CAIResponseError> fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws InterruptedException
    Description copied from interface: `CAClientSynchronousType`
    Upload the data associated with the given file.
    Specified by:
      `fileUpload` in interface `CAClientSynchronousType`
    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

  - ### garbage

    public com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> garbage() throws InterruptedException
    Description copied from interface: `CAClientSynchronousType`
    Send random garbage to the server.
    Specified by:
      `garbage` in interface `CAClientSynchronousType`
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### invalid

    public com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> invalid() throws InterruptedException
    Description copied from interface: `CAClientSynchronousType`
    Send random garbage to the server.
    Specified by:
      `invalid` in interface `CAClientSynchronousType`
    Returns:
      The result
    Throws:
      `InterruptedException` - On interruption

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`