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 TypeMethodDescriptiondefault Stringdefault <R extends CAIResponseType>
RexecuteOrElseThrow(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 PathfileDownloadOrThrow(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 CAFileIDfileUploadOrThrow(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 voidSend random garbage to the server.com.io7m.hibiscus.api.HBResultType<CAClientUnit, CAIResponseError> invalid()Send random garbage to the server.default voidSend random garbage to the server.default CAIResponseTypeloginOrElseThrow(CAClientCredentials credentials) Log in synchronously, or throw an exception based on the failure response.userId()Methods inherited from interface com.io7m.hibiscus.api.HBClientCloseableType
close, isClosedMethods inherited from interface com.io7m.hibiscus.api.HBClientStatusType
events, isConnected, state, stateNowMethods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousOperationsType
disconnect, execute, login, pollEventsMethods inherited from interface com.io7m.hibiscus.api.HBClientSynchronousType
executeOrElseThrow, loginOrElseThrow
-
Method Details
-
description
- Specified by:
descriptionin interfacecom.io7m.repetoir.core.RPServiceType
-
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 IDfile- The output filefileTmp- The temporary output filesize- The expected sizehashAlgorithm- The hash algorithmhashValue- The expected hash valuestatistics- 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 IDfile- The output filefileTmp- The temporary output filesize- The expected sizehashAlgorithm- The hash algorithmhashValue- The expected hash valuestatistics- A receiver of transfer statistics- Returns:
- The result
- Throws:
CAClientException- On errorsInterruptedException- 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 IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- 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 IDfile- The input filecontentType- The content typedescription- The file descriptionstatistics- A receiver of transfer statistics- Returns:
- The result
- Throws:
CAClientException- On errorsInterruptedException- On interruption
-
garbage
com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> garbage() throws InterruptedExceptionSend random garbage to the server.- Returns:
- The result
- Throws:
InterruptedException- On interruption
-
garbageOrElseThrow
Send random garbage to the server.- Throws:
CAClientException- On errorsInterruptedException- On interruption
-
invalid
com.io7m.hibiscus.api.HBResultType<CAClientUnit,CAIResponseError> invalid() throws InterruptedExceptionSend random garbage to the server.- Returns:
- The result
- Throws:
InterruptedException- On interruption
-
invalidOrElseThrow
Send random garbage to the server.- Throws:
CAClientException- On errorsInterruptedException- 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 errorsInterruptedException- 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 failsInterruptedException- On interruption
-