Class PhilterClient

java.lang.Object
ai.philterd.philter.AbstractClient
ai.philterd.philter.PhilterClient

public class PhilterClient extends AbstractClient
Client class for Philter's API. Philter finds and manipulates sensitive information in text. For more information on Philter see https://www.philterd.ai.
  • Field Details

    • DEFAULT_TIMEOUT_SEC

      public static final int DEFAULT_TIMEOUT_SEC
      See Also:
    • DEFAULT_MAX_IDLE_CONNECTIONS

      public static final int DEFAULT_MAX_IDLE_CONNECTIONS
      See Also:
    • DEFAULT_KEEP_ALIVE_DURATION_MS

      public static final int DEFAULT_KEEP_ALIVE_DURATION_MS
      See Also:
  • Method Details

    • filter

      public FilterResponse filter(String context, String documentId, String policyName, String text) throws 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.
      policyName - The name of the policy to apply to the text.
      text - The text to be filtered.
      Returns:
      The filtered text.
      Throws:
      IOException - Thrown if the request can not be completed.
    • filter

      public BinaryFilterResponse filter(String context, String documentId, String policyName, File file) throws IOException
      Send a PDF document 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.
      policyName - The name of the policy to apply to the text.
      file - The PDF file to be filtered.
      Returns:
      The filtered text.
      Throws:
      IOException - Thrown if the request can not be completed.
    • explain

      public ExplainResponse explain(String context, String documentId, String policyName, String text) throws 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.
      policyName - The name of the policy to apply to the text.
      text - The text to be filtered.
      Returns:
      The filter ExplainResponse.
      Throws:
      IOException - Thrown if the request can not be completed.
    • status

      public String status() throws IOException
      Gets the status of Philter.
      Returns:
      A string containing the status of Philter.
      Throws:
      IOException - Thrown if the request can not be completed.
    • getPolicies

      public List<String> getPolicies() throws IOException
      Gets a list of policy names.
      Returns:
      A list of policy names.
      Throws:
      IOException - Thrown if the call not be executed.
    • Policy

      public String Policy(String policyName) throws IOException
      Gets the content of a policy.
      Parameters:
      policyName - The name of the policy to get.
      Returns:
      The content of the policy.
      Throws:
      IOException - Thrown if the call not be executed.
    • savePolicy

      public void savePolicy(String json) throws IOException
      Saves (or overwrites) the policy.
      Parameters:
      json - The body of the policy.
      Throws:
      IOException - Thrown if the call not be executed.
    • deletePolicy

      public void deletePolicy(String policyName) throws IOException
      Deletes a policy.
      Parameters:
      policyName - The name of the policy to delete.
      Throws:
      IOException - Thrown if the call not be executed.
    • getAlerts

      public List<Alert> getAlerts() throws IOException
      Get alerts.
      Returns:
      A list of alerts.
      Throws:
      IOException - Thrown if the call not be executed.
    • deleteAlert

      public void deleteAlert(String alertId) throws IOException
      Delete an alert.
      Parameters:
      alertId - The ID of the alert to delete.
      Throws:
      IOException - Thrown if the call not be executed.