Package ai.philterd.philter
Class PhilterClient
java.lang.Object
ai.philterd.philter.AbstractClient
ai.philterd.philter.PhilterClient
Client class for Philter's API. Philter finds and manipulates sensitive information in text.
For more information on Philter see https://www.philterd.ai.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class ai.philterd.philter.AbstractClient
SERVICE_UNAVAILABLE, UNAUTHORIZED -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteAlert(String alertId) Delete an alert.voiddeletePolicy(String policyName) Deletes a policy.Send text to Philter to be filtered and get an explanation.Send a PDF document to Philter to be filtered.Send text to Philter to be filtered.Get alerts.Gets a list of policy names.Gets the content of a policy.voidsavePolicy(String json) Saves (or overwrites) the policy.status()Gets the status of Philter.
-
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
Gets the status of Philter.- Returns:
- A string containing the status of Philter.
- Throws:
IOException- Thrown if the request can not be completed.
-
getPolicies
Gets a list of policy names.- Returns:
- A list of policy names.
- Throws:
IOException- Thrown if the call not be executed.
-
Policy
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
Saves (or overwrites) the policy.- Parameters:
json- The body of the policy.- Throws:
IOException- Thrown if the call not be executed.
-
deletePolicy
Deletes a policy.- Parameters:
policyName- The name of the policy to delete.- Throws:
IOException- Thrown if the call not be executed.
-
getAlerts
Get alerts.- Returns:
- A list of
alerts. - Throws:
IOException- Thrown if the call not be executed.
-
deleteAlert
Delete an alert.- Parameters:
alertId- The ID of the alert to delete.- Throws:
IOException- Thrown if the call not be executed.
-