Class DomainTemplateClient
java.lang.Object
fr.tiogars.template.client.DomainTemplateClient
Provides HTTP access to the DomainTemplate API.
- Since:
- 0.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionDomainTemplateClient(URI baseUri) Creates a client backed by the default Java HTTP client. -
Method Summary
Modifier and TypeMethodDescriptioncreate(CreateDomainTemplateRequest request) Creates a DomainTemplate.voiddelete(long id) Deletes a DomainTemplate.Exports all DomainTemplates as CSV.Exports all DomainTemplates as JSON-compatible objects.findAll()Lists all DomainTemplates.findById(long id) Finds a DomainTemplate by identifier.Imports DomainTemplates from a CSV document.importJson(List<CreateDomainTemplateRequest> requests) Imports DomainTemplates from JSON-compatible requests.seed(List<CreateDomainTemplateRequest> requests) Seeds DomainTemplates from structured requests.update(long id, UpdateDomainTemplateRequest request) Updates a DomainTemplate.
-
Constructor Details
-
DomainTemplateClient
Creates a client backed by the default Java HTTP client.- Parameters:
baseUri- base URI of the server
-
-
Method Details
-
create
public DomainTemplate create(CreateDomainTemplateRequest request) throws IOException, InterruptedException Creates a DomainTemplate.- 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 responseDomainTemplateException- if the server returns an unexpected HTTP status
-
findAll
Lists all DomainTemplates.- Returns:
- templates returned by the server
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseDomainTemplateException- if the server returns an unexpected HTTP status
-
findById
Finds a DomainTemplate by identifier.- Parameters:
id- persistent template identifier- Returns:
- matching template
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseDomainTemplateException- if the server returns an unexpected HTTP status
-
update
public DomainTemplate update(long id, UpdateDomainTemplateRequest request) throws IOException, InterruptedException Updates a DomainTemplate.- 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 responseDomainTemplateException- if the server returns an unexpected HTTP status
-
delete
Deletes a DomainTemplate.- Parameters:
id- persistent template identifier- Throws:
IOException- if the request failsInterruptedException- if the thread is interrupted while awaiting the responseDomainTemplateException- if the server returns an unexpected HTTP status
-
seed
public List<DomainTemplate> seed(List<CreateDomainTemplateRequest> requests) throws IOException, InterruptedException Seeds DomainTemplates 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 responseDomainTemplateException- if the server returns an unexpected HTTP status
-
importJson
public List<DomainTemplate> importJson(List<CreateDomainTemplateRequest> requests) throws IOException, InterruptedException Imports DomainTemplates 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 responseDomainTemplateException- if the server returns an unexpected HTTP status
-
importCsv
Imports DomainTemplates 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 responseDomainTemplateException- if the server returns an unexpected HTTP status
-
exportJson
Exports all DomainTemplates as JSON-compatible objects.- Returns:
- templates exported by the server
- Throws:
IOException- if response deserialization failsInterruptedException- if the thread is interrupted while awaiting the responseDomainTemplateException- if the server returns an unexpected HTTP status
-
exportCsv
Exports all DomainTemplates as CSV.- Returns:
- CSV document returned by the server
- Throws:
IOException- if the request failsInterruptedException- if the thread is interrupted while awaiting the responseDomainTemplateException- if the server returns an unexpected HTTP status
-