forked from TeleSign/java_telesign
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScoreClient.java
More file actions
52 lines (42 loc) · 1.82 KB
/
ScoreClient.java
File metadata and controls
52 lines (42 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.telesign;
import java.io.IOException;
import java.net.Proxy;
import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.Map;
/**
* Score provides risk information about a specified phone number.
*/
public class ScoreClient extends RestClient {
private static final String SCORE_RESOURCE = "/v1/score/%s";
public ScoreClient(String customerId, String apiKey) {
super(customerId, apiKey);
}
public ScoreClient(String customerId, String apiKey, String restEndpoint) {
super(customerId, apiKey, restEndpoint);
}
public ScoreClient(String customerId,
String apiKey,
String restEndpoint,
Integer connectTimeout,
Integer readTimeout,
Integer writeTimeout,
Proxy proxy,
final String proxyUsername,
final String proxyPassword) {
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
}
/**
* Score is an API that delivers reputation scoring based on phone number intelligence, traffic patterns, machine
* learning, and a global data consortium.
* <p>
* See https://developer.telesign.com/docs/score-api for detailed API documentation.
*/
public TelesignResponse score(String phoneNumber, String accountLifecycleEvent, Map<String, String> params) throws IOException, GeneralSecurityException {
if (params == null) {
params = new HashMap<>();
}
params.put("account_lifecycle_event", accountLifecycleEvent);
return this.post(String.format(SCORE_RESOURCE, phoneNumber), params);
}
}