Skip to content

Commit ca818ab

Browse files
author
pipldev
committed
Merge remote-tracking branch 'origin/dev'
2 parents 3806c40 + 4218bc9 commit ca818ab

6 files changed

Lines changed: 119 additions & 39 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.settings
33
.classpath
44
.project
5+
/bin/

LICENSE

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
Licensed under the Apache License, Version 2.0 (the "License");
2-
you may not use this file except in compliance with the License.
3-
You may obtain a copy of the License at
4-
5-
http://www.apache.org/licenses/LICENSE-2.0
6-
7-
Unless required by applicable law or agreed to in writing, software
8-
distributed under the License is distributed on an "AS IS" BASIS,
9-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10-
See the License for the specific language governing permissions and
1+
Licensed under the Apache License, Version 2.0 (the "License");
2+
you may not use this file except in compliance with the License.
3+
You may obtain a copy of the License at
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
1111
limitations under the License.

README.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
piplapis Java Library
2-
===========================
3-
4-
This is a Java client library for easily integrating Pipl's APIs into your application.
5-
6-
* Full details about Pipl's APIs - [http://pipl.com/dev](http://pipl.com/dev)
7-
* This library is available in other languages - [http://pipl.com/dev/guide/code_libraries](http://pipl.com/dev/guide/code_libraries)
8-
9-
Library Requirements
10-
--------------------
11-
12-
* Google Gson, you can find it inside this project under `lib/google/` or download from [here](http://code.google.com/p/google-gson/downloads/list).
13-
* The library was tested on Java 7 but will probably work on earlier versions as well.
14-
15-
Installation
16-
------------
17-
18-
* Import the piplapis jar file (can be found under `lib/`) or compile the source code (can be found under `src/`)
19-
20-
Getting Started & Code Snippets
21-
-------------------------------
22-
23-
**Pipl's Search API**
24-
* Code snippets - [http://pipl.com/dev/guide/code_snippets](http://pipl.com/dev/guide/code_snippets)
25-
* Full reference - [http://pipl.com/dev/reference](http://pipl.com/dev/reference)
1+
piplapis Java Library
2+
===========================
3+
4+
This is a Java client library for easily integrating Pipl's APIs into your application.
5+
6+
* Full details about Pipl's APIs - [http://pipl.com/dev](http://pipl.com/dev)
7+
* This library is available in other languages - [http://pipl.com/dev/guide/code_libraries](http://pipl.com/dev/guide/code_libraries)
8+
9+
Library Requirements
10+
--------------------
11+
12+
* Google Gson, you can find it inside this project under `lib/google/` or download from [here](http://code.google.com/p/google-gson/downloads/list).
13+
* The library was tested on Java 7 but will probably work on earlier versions as well.
14+
15+
Installation
16+
------------
17+
18+
* Import the piplapis jar file (can be found under `lib/`) or compile the source code (can be found under `src/`)
19+
20+
Getting Started & Code Snippets
21+
-------------------------------
22+
23+
**Pipl's Search API**
24+
* Code snippets - [http://pipl.com/dev/guide/code_snippets](http://pipl.com/dev/guide/code_snippets)
25+
* Full reference - [http://pipl.com/dev/reference](http://pipl.com/dev/reference)

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.pipl.api</groupId>
66
<artifactId>piplapis</artifactId>
7-
<version>5.0.1</version>
7+
<version>5.0.2</version>
88
<packaging>jar</packaging>
99

1010
<name>${project.groupId}:${project.artifactId}</name>

src/main/java/com/pipl/api/search/SearchAPIResponse.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ public class SearchAPIResponse implements Serializable {
106106
@Expose
107107
@SerializedName("@match_requirements")
108108
public String matchRequirements;
109+
@SerializedName("@source_category_requirements")
110+
public String sourceCategoryRequirements;
109111

110112
/**
111113
* @return Sources that match the person from the query.

src/main/java/com/pipl/api/search/SearchConfiguration.java

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)