Class PhilterClient


  • public class PhilterClient
    extends java.lang.Object
    Client class for Philter's API. Philter finds and manipulates sensitive information in text.
    • Constructor Summary

      Constructors 
      Constructor Description
      PhilterClient​(java.lang.String endpoint)
      Create a new client.
      PhilterClient​(java.lang.String endpoint, okhttp3.OkHttpClient okHttpClient)
      Create a new client.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ExplainResponse explain​(java.lang.String context, java.lang.String documentId, java.lang.String filterProfileName, java.lang.String text)
      Send text to Philter to be filtered and get an explanation.
      FilterResponse filter​(java.lang.String context, java.lang.String documentId, java.lang.String filterProfileName, java.lang.String text)
      Send text to Philter to be filtered.
      java.util.List<FilteredSpan> replacements​(java.lang.String documentId)
      Gets the values replaced during a previous filter request.
      StatusResponse status()
      Gets the status of Philter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PhilterClient

        public PhilterClient​(java.lang.String endpoint)
        Create a new client.
        Parameters:
        endpoint - The Philter endpoint, e.g. https://127.0.0.1:8080.
      • PhilterClient

        public PhilterClient​(java.lang.String endpoint,
                             okhttp3.OkHttpClient okHttpClient)
        Create a new client.
        Parameters:
        endpoint - The Philter endpoint, e.g. https://127.0.0.1:8080.
        okHttpClient - Provide a custom OkHttpClient.
    • Method Detail

      • filter

        public FilterResponse filter​(java.lang.String context,
                                     java.lang.String documentId,
                                     java.lang.String filterProfileName,
                                     java.lang.String text)
                              throws java.io.IOException
        Send text to Philter to be filtered.
        Parameters:
        context - The context. Contexts can be used to group text based on some arbitrary property.
        documentId - The document ID. Leave empty for Philter to assign a document ID to the request.
        filterProfileName - The name of the filter profile to apply to the text.
        text - The text to be filtered.
        Returns:
        The filtered text.
        Throws:
        java.io.IOException - Thrown if the request can not be completed.
      • explain

        public ExplainResponse explain​(java.lang.String context,
                                       java.lang.String documentId,
                                       java.lang.String filterProfileName,
                                       java.lang.String text)
                                throws java.io.IOException
        Send text to Philter to be filtered and get an explanation.
        Parameters:
        context - The context. Contexts can be used to group text based on some arbitrary property.
        documentId - The document ID. Leave empty for Philter to assign a document ID to the request.
        filterProfileName - The name of the filter profile to apply to the text.
        text - The text to be filtered.
        Returns:
        The filter ExplainResponse.
        Throws:
        java.io.IOException - Thrown if the request can not be completed.
      • replacements

        public java.util.List<FilteredSpan> replacements​(java.lang.String documentId)
                                                  throws java.io.IOException
        Gets the values replaced during a previous filter request. Philter's store feature must be enabled for this call to work. Check Philter's documentation for how to enable the store.
        Parameters:
        documentId - The document ID.
        Returns:
        A list of spans.
        Throws:
        java.io.IOException - Thrown if the request can not be completed.
      • status

        public StatusResponse status()
                              throws java.io.IOException
        Gets the status of Philter.
        Returns:
        A StatusResponse object.
        Throws:
        java.io.IOException - Thrown if the request can not be completed.