Interface IHalClient

  • All Implemented Interfaces:

    
    public interface IHalClient
    
                        

    Interface to a HAL Client

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • 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 links
        link - 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 over
        closure - 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 to
        body - 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 to
        body - JSON contents for the body
        handler - Response handler
      • 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(JsonValue.Object docAttributes)

        Sets the starting context from a previous broker interaction (Pact document)

      • getJson

         abstract Result<JsonValue, Exception> getJson(String path, Boolean encodePath)

        Get JSON from the provided path

        Parameters:
        path - Path to fetch the JSON document from
        encodePath - If the path should be encoded
      • getAuth

         abstract Auth getAuth()

        Return the authentication used to access the Pact broker