Class TaskClient
java.lang.Object
fr.tiogars.chat.client.TaskClient
-
Constructor Summary
ConstructorsConstructorDescriptionTaskClient(URI baseUri) Creates a client backed by the default Java HTTP client. -
Method Summary
Modifier and TypeMethodDescriptioncreate(CreateTaskRequest request) Creates a Task.voiddelete(long id) Deletes a Task.Exports all Tasks as CSV.Exports all Tasks as JSON-compatible objects.findAll()Lists all Tasks.findById(long id) Finds a Task by identifier.Imports Tasks from a CSV document.importJson(List<CreateTaskRequest> requests) Imports Tasks from JSON-compatible requests.seed(List<CreateTaskRequest> requests) Seeds Tasks from structured requests.update(long id, UpdateTaskRequest request) Updates a Task.
-
Constructor Details
-
TaskClient
Creates a client backed by the default Java HTTP client.- Parameters:
baseUri- base URI of the server
-
-
Method Details
-
create
Creates a Task.- Parameters:
request- template data to create- Returns:
- template created by the server
- Throws:
IOException- if request serialization or response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
findAll
Lists all Tasks.- Returns:
- templates returned by the server
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
findById
Finds a Task by identifier.- Parameters:
id- persistent template identifier- Returns:
- matching template
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
update
Updates a Task.- Parameters:
id- persistent template identifierrequest- replacement label and description- Returns:
- template updated by the server
- Throws:
IOException- if request serialization or response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
delete
Deletes a Task.- Parameters:
id- persistent template identifier- Throws:
IOException- if the request failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
seed
Seeds Tasks from structured requests.- Parameters:
requests- templates to seed- Returns:
- templates stored by the server
- Throws:
IOException- if request serialization or response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
importJson
public List<Task> importJson(List<CreateTaskRequest> requests) throws IOException, InterruptedException Imports Tasks from JSON-compatible requests.- Parameters:
requests- templates to import- Returns:
- templates imported by the server
- Throws:
IOException- if request serialization or response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
importCsv
Imports Tasks from a CSV document.- Parameters:
csv- CSV document to import- Returns:
- templates imported by the server
- Throws:
IOException- if the request or response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
exportJson
Exports all Tasks as JSON-compatible objects.- Returns:
- templates exported by the server
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-
exportCsv
Exports all Tasks as CSV.- Returns:
- CSV document returned by the server
- Throws:
IOException- if the request failsInterruptedException- if the thread is interrupted while awaiting the responseTaskException- if the server returns an unexpected HTTP status
-