Interface IHalClient
-
- All Implemented Interfaces:
public interface IHalClientInterface to a HAL Client
-
-
Method Summary
Modifier and Type Method Description abstract IHalClientnavigate()Navigates to the Root abstract IHalClientnavigate(Map<String, Object> options, String link)Navigates the URL associated with the given link using the current HAL document abstract IHalClientnavigate(String link)Navigates the URL associated with the given link using the current HAL document abstract StringlinkUrl(String name)Returns the HREF of the named link from the current HAL document abstract JsonValue.ObjectcurrentDoc()Returns the current HAL document abstract UnitforAll(String linkName, Consumer<Map<String, Object>> closure)Calls the closure with a Map of attributes for all links associated with the link name abstract Result<Boolean, Exception>postJson(String url, String body)Upload the JSON document to the provided URL, using a POST request abstract Result<Boolean, Exception>postJson(String url, String body, Function2<Integer, ClassicHttpResponse, Boolean> handler)Upload the JSON document to the provided URL, using a POST request abstract Result<JsonValue.Object, Exception>postJson(String link, Map<String, Object> options, String json)Upload a JSON document to the current path link, using a POST request abstract Result<JsonValue.Object, Exception>fetch(String path, Boolean encodePath)Fetches the HAL document from the provided path abstract Result<JsonValue.Object, Exception>fetch(String path)Fetches the HAL document from the provided path abstract IHalClientwithDocContext(Map<String, Object> docAttributes)Sets the starting context from a previous broker interaction (Pact document) abstract IHalClientwithDocContext(JsonValue.Object docAttributes)Sets the starting context from a previous broker interaction (Pact document) abstract Result<String, Exception>putJson(String link, Map<String, Object> options, String json)Upload a JSON document to the current path link, using a PUT request abstract Result<String, Exception>putJson(URI url, String json)Upload a JSON document to the given URL, using a PUT request abstract Result<JsonValue, Exception>getJson(String path)Get JSON from the provided path abstract Result<JsonValue, Exception>getJson(String path, Boolean encodePath)Get JSON from the provided path abstract AuthgetAuth()Return the authentication used to access the Pact broker abstract UnitlogContext()Logs the current HAL context -
-
Method Detail
-
navigate
abstract IHalClient navigate()
Navigates to the Root
-
navigate
abstract IHalClient navigate(Map<String, Object> options, String link)
Navigates the URL associated with the given link using the current HAL document
- Parameters:
options- Map of key-value pairs to use for parsing templated linkslink- Link name to navigate
-
navigate
abstract IHalClient navigate(String link)
Navigates the URL associated with the given link using the current HAL document
- Parameters:
link- Link name to navigate
-
linkUrl
abstract String linkUrl(String name)
Returns the HREF of the named link from the current HAL document
-
currentDoc
abstract JsonValue.Object currentDoc()
Returns the current HAL document
-
forAll
abstract Unit forAll(String linkName, Consumer<Map<String, Object>> closure)
Calls the closure with a Map of attributes for all links associated with the link name
- Parameters:
linkName- Name of the link to loop overclosure- Closure to invoke with the link attributes
-
postJson
abstract Result<Boolean, Exception> postJson(String url, String body)
Upload the JSON document to the provided URL, using a POST request
- Parameters:
url- Url to upload the document tobody- JSON contents for the body
-
postJson
abstract Result<Boolean, Exception> postJson(String url, String body, Function2<Integer, ClassicHttpResponse, Boolean> handler)
Upload the JSON document to the provided URL, using a POST request
- Parameters:
url- Url to upload the document tobody- JSON contents for the bodyhandler- Response handler
-
postJson
abstract Result<JsonValue.Object, Exception> postJson(String link, Map<String, Object> options, String json)
Upload a JSON document to the current path link, using a POST request
-
fetch
abstract Result<JsonValue.Object, Exception> fetch(String path, Boolean encodePath)
Fetches the HAL document from the provided path
- Parameters:
path- The path to the HAL document.encodePath- If the path should be encoded to make a valid URL
-
fetch
abstract Result<JsonValue.Object, Exception> fetch(String path)
Fetches the HAL document from the provided path
- Parameters:
path- The path to the HAL document.
-
withDocContext
abstract IHalClient withDocContext(Map<String, Object> docAttributes)
Sets the starting context from a previous broker interaction (Pact document)
-
withDocContext
abstract IHalClient withDocContext(JsonValue.Object docAttributes)
Sets the starting context from a previous broker interaction (Pact document)
-
putJson
abstract Result<String, Exception> putJson(String link, Map<String, Object> options, String json)
Upload a JSON document to the current path link, using a PUT request
-
putJson
abstract Result<String, Exception> putJson(URI url, String json)
Upload a JSON document to the given URL, using a PUT request
-
getJson
abstract Result<JsonValue, Exception> getJson(String path, Boolean encodePath)
Get JSON from the provided path
- Parameters:
path- Path to fetch the JSON document fromencodePath- If the path should be encoded
-
getAuth
abstract Auth getAuth()
Return the authentication used to access the Pact broker
-
logContext
abstract Unit logContext()
Logs the current HAL context
-
-
-
-