@@ -28,6 +28,7 @@ public class SearchConfiguration {
2828 public Boolean hideSponsored ;
2929 public Boolean liveFeeds ;
3030 public String matchRequirements ;
31+ public String sourceCategoryRequirements ;
3132 public String extraParams ;
3233
3334 public SearchConfiguration () {
@@ -63,6 +64,24 @@ public SearchConfiguration(String protocol, String host, String path,
6364 setMatchRequirements (matchRequirements );
6465 }
6566
67+ public SearchConfiguration (String protocol , String host , String path ,
68+ String apiKey , float minimumProbability , String showSources ,
69+ boolean hideSponsored , float minimumMatch , boolean liveFeeds ,
70+ Expression matchRequirements , Expression sourceCategoryRequirements ) {
71+ this (protocol , host , path , apiKey , minimumProbability , showSources , hideSponsored , minimumMatch , liveFeeds );
72+ setMatchRequirements (matchRequirements );
73+ setSourceCategoryRequirements (sourceCategoryRequirements );
74+ }
75+
76+ public SearchConfiguration (String protocol , String host , String path ,
77+ String apiKey , float minimumProbability , String showSources ,
78+ boolean hideSponsored , float minimumMatch , boolean liveFeeds ,
79+ String matchRequirements , String sourceCategoryRequirements ) {
80+ this (protocol , host , path , apiKey , minimumProbability , showSources , hideSponsored , minimumMatch , liveFeeds );
81+ setMatchRequirements (matchRequirements );
82+ setSourceCategoryRequirements (sourceCategoryRequirements );
83+ }
84+
6685 public SearchConfiguration (Builder builder ) {
6786 setProtocol (builder .protocol );
6887 setHost (builder .host );
@@ -74,6 +93,7 @@ public SearchConfiguration(Builder builder) {
7493 setMinimumMatch (builder .minimumMatch );
7594 setLiveFeeds (builder .liveFeeds );
7695 setMatchRequirements (builder .matchRequirements );
96+ setSourceCategoryRequirements (builder .sourceCategoryRequirements );
7797 }
7898
7999 /**
@@ -254,6 +274,29 @@ public void setMatchRequirements(Expression expression) {
254274 this .matchRequirements = expression .toString ();
255275 }
256276
277+ /**
278+ * @param sourceCategoryRequirements a source category requirements criteria.
279+ * This criteria defines what source categories must be present in an
280+ * API response in order for it to be returned as a match.
281+ * For example: "email" or "email or phone", or
282+ * "media & (personal_profiles | professional_and_business)".
283+ */
284+ public void setSourceCategoryRequirements (String sourceCategoryRequirements ) {
285+ this .sourceCategoryRequirements = sourceCategoryRequirements ;
286+ }
287+
288+ /**
289+ * @param expression an Expression that describes a source category requirements
290+ * This is a helper method that allows you to build and set a
291+ * source category requirement programmatically.
292+ * See the documentation for
293+ * {@link com.pipl.api.search.SearchConfiguration.Expression}
294+ * for more details.
295+ */
296+ public void setSourceCategoryRequirements (Expression expression ) {
297+ this .sourceCategoryRequirements = expression .toString ();
298+ }
299+
257300 @ Override
258301 public String toString () {
259302 StringBuilder sb = new StringBuilder ();
@@ -277,6 +320,9 @@ public String toString() {
277320 if (matchRequirements !=null ) {
278321 sb .append ("&match_requirements=" ).append (matchRequirements );
279322 }
323+ if (sourceCategoryRequirements !=null ) {
324+ sb .append ("&source_category_requirements=" ).append (sourceCategoryRequirements );
325+ }
280326 if (extraParams !=null ) {
281327 sb .append (extraParams );
282328 }
@@ -294,6 +340,7 @@ public static class Builder {
294340 private Float minimumMatch ;
295341 private Boolean liveFeeds ;
296342 private String matchRequirements ;
343+ private String sourceCategoryRequirements ;
297344
298345 public Builder protocol (String protocol ) {
299346 this .protocol = protocol ;
@@ -350,11 +397,22 @@ public Builder matchRequirements(Expression expression) {
350397 return this ;
351398 }
352399
400+ public Builder sourceCategoryRequirements (String sourceCategoryRequirements ) {
401+ this .sourceCategoryRequirements = sourceCategoryRequirements ;
402+ return this ;
403+ }
404+
405+ public Builder sourceCategoryRequirements (Expression expression ) {
406+ this .sourceCategoryRequirements = expression .toString ();
407+ return this ;
408+ }
409+
353410 }
354411
355412 /**
356- * You can use the Expression interface and its implementation,
357- * AtomicExpression to programmatically create a matchRequirment
413+ * You can use the Expression interface and its implementations,
414+ * AtomicExpression and AtomicSourceCategoryExpression to
415+ * programmatically create a matchRequirment or a sourceCategoryRequirment
358416 * Simply start form AtomicExpressions, use the or/and methods on
359417 * them, and then use the resulting expressions to build even more
360418 * complex expressions.
@@ -388,6 +446,26 @@ public Expression and(Expression... expressions) {
388446 public Expression or (Expression ... expressions ) {
389447 return LogicalExpression .or (this , expressions );
390448 }
449+ }
450+
451+ public static enum AtomicSourceCategoryExpression implements Expression {
452+ PERSONAL_PROFILES , MEDIA , PROFESSIONAL_AND_BUSINESS , PUBLIC_RECORDS , PUBLICATIONS , SCHOOL_AND_CLASSMATES , EMAIL_ADDRESS , BACKGROUND_REPORTS , CONTACT_DETAILS , WEB_PAGES ;
453+
454+ @ Override
455+ public Type type () {
456+ return Type .ATOMIC ;
457+ }
458+
459+ @ Override
460+ public Expression and (Expression ... expressions ) {
461+ return LogicalExpression .and (this , expressions );
462+ }
463+
464+ @ Override
465+ public Expression or (Expression ... expressions ) {
466+ return LogicalExpression .or (this , expressions );
467+ }
468+ }
391469
392470 private static class LogicalExpression implements Expression {
393471 private Type type ;
@@ -447,7 +525,6 @@ public static Expression or(Expression expression, Expression... expressions) {
447525 }
448526 return new LogicalExpression (Type .OR , sb .toString ());
449527 }
450- }
451528 };
452529
453530}
0 commit comments