# Class CATransport1

java.lang.Object
com.io7m.cardant.client.basic.internal.CATransport1

All Implemented Interfaces:
  `CATransportType`, `com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>`, `com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>`, `com.io7m.hibiscus.api.HBTransportType<CAIMessageType,CAClientException>`, `AutoCloseable`

public final class CATransport1 extends Object implements CATransportType
The version 1 transport.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CATransport1(Clock inClock, CAStrings inStrings, HttpClient inHttpClient, URI baseURI)`
  The version 1 transport.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `Path`
  `fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics)`
  Download the data associated with the given file.
  `void`
  `fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics)`
  Upload the data associated with the given file.
  `boolean`
  `isClosed()`
  `com.io7m.hibiscus.api.HBReadType<CAIMessageType>`
  `receive(Duration timeout)`
  `void`
  `send(CAIMessageType message)`
  `void`
  `sendAndForget(CAIMessageType message)`
  `CAIMessageType`
  `sendAndWait(CAIMessageType message, Duration timeout)`
  `String`
  `toString()`
  `List<CAIResponseType>`
  `transaction(List<CAICommandType<?>> commands)`
  Execute all the given commands in order, in a single transaction.

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

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

- ## Constructor Details

  - ### CATransport1

    public CATransport1(Clock inClock, CAStrings inStrings, HttpClient inHttpClient, URI baseURI)
    The version 1 transport.
    Parameters:
      `inClock` - The clock
      `inStrings` - The string resources
      `inHttpClient` - The HTTP client
      `baseURI` - The base URI

- ## Method Details

  - ### isClosed

    public boolean isClosed()
    Specified by:
      `isClosed` in interface `com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>`

  - ### close

    public void close()
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `com.io7m.hibiscus.api.HBClientCloseableType<CAClientException>`

  - ### receive

    public com.io7m.hibiscus.api.HBReadType<CAIMessageType> receive(Duration timeout) throws CAClientException, InterruptedException
    Specified by:
      `receive` in interface `com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>`
    Throws:
      `CAClientException`
      `InterruptedException`

  - ### send

    public void send(CAIMessageType message) throws CAClientException, InterruptedException
    Specified by:
      `send` in interface `com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>`
    Throws:
      `CAClientException`
      `InterruptedException`

  - ### sendAndForget

    public void sendAndForget(CAIMessageType message) throws CAClientException, InterruptedException
    Specified by:
      `sendAndForget` in interface `com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>`
    Throws:
      `CAClientException`
      `InterruptedException`

  - ### sendAndWait

    public CAIMessageType sendAndWait(CAIMessageType message, Duration timeout) throws CAClientException, InterruptedException
    Specified by:
      `sendAndWait` in interface `com.io7m.hibiscus.api.HBIOOperationsType<CAIMessageType,CAClientException>`
    Throws:
      `CAClientException`
      `InterruptedException`

  - ### toString

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

  - ### fileDownload

    public Path fileDownload(CAFileID fileID, Path file, Path fileTmp, long size, String hashAlgorithm, String hashValue, Consumer<CAClientTransferStatistics> statistics) throws CAClientException
    Description copied from interface: `CATransportType`
    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 `CATransportType`
    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

  - ### fileUpload

    public void fileUpload(CAFileID fileID, Path file, String contentType, String description, Consumer<CAClientTransferStatistics> statistics) throws CAClientException
    Description copied from interface: `CATransportType`
    Upload the data associated with the given file.
    Specified by:
      `fileUpload` in interface `CATransportType`
    Parameters:
      `fileID` - The file ID
      `file` - The input file
      `contentType` - The content type
      `description` - The file description
      `statistics` - A receiver of transfer statistics
    Throws:
      `CAClientException` - On errors

  - ### transaction

    public List<CAIResponseType> transaction(List<CAICommandType<?>> commands) throws InterruptedException, CAClientException
    Description copied from interface: `CATransportType`
    Execute all the given commands in order, in a single transaction.
    Specified by:
      `transaction` in interface `CATransportType`
    Parameters:
      `commands` - The commands
    Returns:
      The responses
    Throws:
      `InterruptedException` - On interruption
      `CAClientException` - On errors