Skip to content

Commit 4f5ef4d

Browse files
committed
Update contructors methods Update RELEASE file Update version of SDK Self-Service
1 parent 7b870fb commit 4f5ef4d

11 files changed

Lines changed: 120 additions & 89 deletions

File tree

RELEASE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2.4.0
2+
- Added tracking to requests.
3+
14
2.3.1
25
- Removed Push Verify method in VerifyClient class.
36

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group 'com.telesign.enterprise'
2-
version '2.3.1'
2+
version '2.4.0'
33

44
apply plugin: 'java'
55
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -11,7 +11,8 @@ repositories {
1111
}
1212

1313
dependencies {
14-
implementation('com.telesign:telesign:2.3.1')
14+
implementation('com.telesign:telesign:2.4.0')
15+
//implementation(project(":com.telesign"))
1516
implementation 'com.google.code.gson:gson:[2.7,3.0)'
1617
testImplementation( group: 'junit', name: 'junit', version: '[4.1,)')
1718
testImplementation( group: 'com.squareup.okhttp3', name: 'mockwebserver', version: '[4.7.0,)')
@@ -21,6 +22,12 @@ apply plugin: 'idea'
2122
apply plugin: 'maven-publish'
2223
apply plugin: 'signing'
2324

25+
jar {
26+
manifest {
27+
attributes 'Implementation-Version': project.version
28+
}
29+
}
30+
2431
tasks.register('javadocJar', Jar) {
2532
from tasks.javadoc
2633
archiveClassifier.set('javadoc')

src/main/java/com/telesign/enterprise/AppVerifyClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
public class AppVerifyClient extends com.telesign.AppVerifyClient {
66

7+
private static final String sdkVersion = AppVerifyClient.class.getPackage().getImplementationVersion();
8+
private static final String sdkSource = "java_telesign_enterprise";
9+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
10+
711
public AppVerifyClient(String customerId, String apiKey) {
812

9-
super(customerId, apiKey, "https://rest-ww.telesign.com");
13+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
1014
}
1115

1216
public AppVerifyClient(String customerId, String apiKey, String restEndpoint) {
13-
super(customerId, apiKey, restEndpoint);
17+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
1418
}
1519

1620
public AppVerifyClient(String customerId,
@@ -22,6 +26,6 @@ public AppVerifyClient(String customerId,
2226
Proxy proxy,
2327
final String proxyUsername,
2428
final String proxyPassword) {
25-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
29+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
2630
}
2731
}

src/main/java/com/telesign/enterprise/MessagingClient.java

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
import java.util.HashMap;
77
import java.util.Map;
88

9-
public class MessagingClient extends com.telesign.RestClient {
9+
public class MessagingClient extends com.telesign.MessagingClient {
1010

11-
private static final String MESSAGING_RESOURCE = "/v1/messaging";
12-
private static final String MESSAGING_STATUS_RESOURCE = "/v1/messaging/%s";
1311
private static final String OMNI_MESSAGING_RESOURCE = "/v1/omnichannel";
12+
private static final String sdkVersion = MessagingClient.class.getPackage().getImplementationVersion();
13+
private static final String sdkSource = "java_telesign_enterprise";
14+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
1415

1516
public MessagingClient(String customerId, String apiKey) {
1617

17-
super(customerId, apiKey, "https://rest-ww.telesign.com");
18+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
1819
}
1920

2021
public MessagingClient(String customerId, String apiKey, String restEndpoint) {
21-
super(customerId, apiKey, restEndpoint);
22+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
2223
}
2324

2425
public MessagingClient(String customerId,
@@ -30,30 +31,7 @@ public MessagingClient(String customerId,
3031
Proxy proxy,
3132
final String proxyUsername,
3233
final String proxyPassword) {
33-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
34-
}
35-
36-
/**
37-
* Send a message to the target phone_number.
38-
* @param phoneNumber The end user's phone number with country code included.
39-
* @param message Text of the message to be sent to the end user.
40-
* @param messageType This parameter specifies the traffic type being sent in the message.
41-
* @param params Additional and optional params
42-
* <p>
43-
* See https://developer.telesign.com/enterprise/reference/sendsms for detailed API documentation.
44-
* </p>
45-
*/
46-
public TelesignResponse message(String phoneNumber, String message, String messageType, Map<String, String> params) throws IOException, GeneralSecurityException {
47-
48-
if (params == null) {
49-
params = new HashMap<>();
50-
}
51-
52-
params.put("phone_number", phoneNumber);
53-
params.put("message", message);
54-
params.put("message_type", messageType);
55-
56-
return this.post(MESSAGING_RESOURCE, params);
34+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
5735
}
5836

5937
/**
@@ -66,14 +44,4 @@ public TelesignResponse message(String phoneNumber, String message, String messa
6644
public TelesignResponse omniMessage(Map<String, Object> params) throws IOException, GeneralSecurityException {
6745
return this.post(OMNI_MESSAGING_RESOURCE, params, JSON_CONTENT_TYPE);
6846
}
69-
70-
/**
71-
* Retrieves the status of requests initiated via the "message" method in this class
72-
* <p>
73-
* See https://developer.telesign.com/enterprise/reference/getsmsstatus for detailed API documentation.
74-
*/
75-
public TelesignResponse status(String referenceId, Map<String, String> params) throws IOException, GeneralSecurityException {
76-
77-
return this.get(String.format(MESSAGING_STATUS_RESOURCE, referenceId), params);
78-
}
7947
}

src/main/java/com/telesign/enterprise/PhoneIdClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,18 @@ public class PhoneIdClient extends com.telesign.PhoneIdClient {
2121
private static final String PHONEID_CONTACT_RESOURCE = "/v1/phoneid/contact/%s";
2222
private static final String PHONEID_LIVE_RESOURCE = "/v1/phoneid/live/%s";
2323
private static final String PHONEID_NUMBER_DEACTIVATION_RESOURCE = "/v1/phoneid/number_deactivation/%s";
24+
private static final String sdkVersion = PhoneIdClient.class.getPackage().getImplementationVersion();
25+
private static final String sdkSource = "java_telesign_enterprise";
26+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
27+
2428

2529
public PhoneIdClient(String customerId, String apiKey) {
2630

27-
super(customerId, apiKey, "https://rest-ww.telesign.com");
31+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
2832
}
2933

3034
public PhoneIdClient(String customerId, String apiKey, String restEndpoint) {
31-
super(customerId, apiKey, restEndpoint);
35+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
3236
}
3337

3438
public PhoneIdClient(String customerId,
@@ -40,7 +44,7 @@ public PhoneIdClient(String customerId,
4044
Proxy proxy,
4145
final String proxyUsername,
4246
final String proxyPassword) {
43-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
47+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
4448
}
4549

4650
/**

src/main/java/com/telesign/enterprise/ScoreClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
public class ScoreClient extends com.telesign.ScoreClient {
66

7+
private static final String sdkVersion = ScoreClient.class.getPackage().getImplementationVersion();
8+
private static final String sdkSource = "java_telesign_enterprise";
9+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
10+
711
public ScoreClient(String customerId, String apiKey) {
812

9-
super(customerId, apiKey, "https://rest-ww.telesign.com");
13+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
1014
}
1115

1216
public ScoreClient(String customerId, String apiKey, String restEndpoint) {
13-
super(customerId, apiKey, restEndpoint);
17+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
1418
}
1519

1620
public ScoreClient(String customerId,
@@ -22,7 +26,7 @@ public ScoreClient(String customerId,
2226
Proxy proxy,
2327
final String proxyUsername,
2428
final String proxyPassword) {
25-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
29+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
2630
}
2731

2832
}

src/main/java/com/telesign/enterprise/TelebureauClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,18 @@ public class TelebureauClient extends RestClient {
1818
private static final String TELEBUREAU_CREATE_RESOURCE = "/v1/telebureau/event";
1919
private static final String TELEBUREAU_RETRIEVE_RESOURCE = "/v1/telebureau/event/%s";
2020
private static final String TELEBUREAU_DELETE_RESOURCE = "/v1/telebureau/event/%s";
21+
private static final String sdkVersion = TelebureauClient.class.getPackage().getImplementationVersion();
22+
private static final String sdkSource = "java_telesign_enterprise";
23+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
24+
2125

2226
public TelebureauClient(String customerId, String apiKey) {
2327

24-
super(customerId, apiKey, "https://rest-ww.telesign.com");
28+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
2529
}
2630

2731
public TelebureauClient(String customerId, String apiKey, String restEndpoint) {
28-
super(customerId, apiKey, restEndpoint);
32+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
2933
}
3034

3135
public TelebureauClient(String customerId,
@@ -37,7 +41,7 @@ public TelebureauClient(String customerId,
3741
Proxy proxy,
3842
final String proxyUsername,
3943
final String proxyPassword) {
40-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
44+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
4145
}
4246

4347
/**

src/main/java/com/telesign/enterprise/VerifyClient.java

Lines changed: 58 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ public class VerifyClient extends RestClient {
2121
private static final String VERIFY_SMART_RESOURCE = "/v1/verify/smart";
2222
private static final String VERIFY_STATUS_RESOURCE = "/v1/verify/%s";
2323
private static final String VERIFY_COMPLETION_RESOURCE = "/v1/verify/completion/%s";
24+
private static final String sdkVersion = VerifyClient.class.getPackage().getImplementationVersion();
25+
private static final String sdkSource = "java_telesign_enterprise";
26+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
2427

25-
private static final String BASE_URL_VERIFICATION_PROCESS = "https://verify.telesign.com";
26-
private static final String DEFAULT_FS_BASE_URL = "https://rest-ww.telesign.com";
27-
private static final String PATH_VERIFICATION = "/verification";
2828

2929
public VerifyClient(String customerId, String apiKey) {
30-
super(customerId, apiKey, DEFAULT_FS_BASE_URL);
30+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
3131
}
3232

3333
public VerifyClient(String customerId, String apiKey, String restEndpoint) {
34-
super(customerId, apiKey, restEndpoint);
34+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
3535
}
3636

3737
public VerifyClient(String customerId,
@@ -43,7 +43,7 @@ public VerifyClient(String customerId,
4343
Proxy proxy,
4444
final String proxyUsername,
4545
final String proxyPassword) {
46-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
46+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
4747
}
4848

4949
/**
@@ -59,7 +59,6 @@ public TelesignResponse sms(String phoneNumber, Map<String, String> params) thro
5959
}
6060

6161
params.put("phone_number", phoneNumber);
62-
this.setRestEndpoint(DEFAULT_FS_BASE_URL);
6362
return this.post(VERIFY_SMS_RESOURCE, params);
6463
}
6564

@@ -70,24 +69,8 @@ public TelesignResponse sms(String phoneNumber, Map<String, String> params) thro
7069
*/
7170
public TelesignResponse createVerificationProcess(String phoneNumber, HashMap<String, Object> params) throws IOException, GeneralSecurityException {
7271

73-
if (params == null) {
74-
params = new HashMap<String, Object>();
75-
}
76-
77-
HashMap<String, String> infoRecipient = new HashMap<>();
78-
infoRecipient.put("phone_number", phoneNumber);
79-
params.put("recipient", infoRecipient);
80-
81-
if (!params.containsKey("verification_policy")) {
82-
List<Object> infoVerificationPolicy = new ArrayList<>();
83-
HashMap<String, String> infoMethod = new HashMap<>();
84-
infoMethod.put("method", "sms");
85-
infoVerificationPolicy.add(infoMethod);
86-
params.put("verification_policy", infoVerificationPolicy);
87-
}
88-
89-
this.setRestEndpoint(BASE_URL_VERIFICATION_PROCESS);
90-
return this.post(PATH_VERIFICATION, params, "application/json", "Basic");
72+
OmniVerifyClient omniVerifyClient = new OmniVerifyClient(this.customerId, this.apiKey);
73+
return omniVerifyClient.createVerificationProcess(phoneNumber, params);
9174
}
9275

9376
/**
@@ -145,4 +128,54 @@ public TelesignResponse status(String referenceId, Map<String, String> params) t
145128
public TelesignResponse completion(String referenceId, Map<String, String> params) throws IOException, GeneralSecurityException {
146129
return this.put(String.format(VERIFY_COMPLETION_RESOURCE, referenceId), params);
147130
}
131+
132+
static class OmniVerifyClient extends RestClient
133+
{
134+
private static final String PATH_VERIFICATION = "/verification";
135+
136+
public OmniVerifyClient(String customerId, String apiKey) {
137+
super(customerId, apiKey, "https://verify.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
138+
}
139+
140+
public OmniVerifyClient(String customerId, String apiKey, String restEndpoint) {
141+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
142+
}
143+
144+
public OmniVerifyClient(String customerId,
145+
String apiKey,
146+
String restEndpoint,
147+
Integer connectTimeout,
148+
Integer readTimeout,
149+
Integer writeTimeout,
150+
Proxy proxy,
151+
final String proxyUsername,
152+
final String proxyPassword) {
153+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
154+
}
155+
156+
/**
157+
* Use this action to create a verification process for the specified phone number.
158+
* <p>
159+
* See https://developer.telesign.com/enterprise/reference/createverificationprocess for detailed API documentation.
160+
*/
161+
public TelesignResponse createVerificationProcess(String phoneNumber, HashMap<String, Object> params) throws IOException, GeneralSecurityException {
162+
163+
if (params == null) {
164+
params = new HashMap<String, Object>();
165+
}
166+
167+
HashMap<String, String> infoRecipient = new HashMap<>();
168+
infoRecipient.put("phone_number", phoneNumber);
169+
params.put("recipient", infoRecipient);
170+
171+
if (!params.containsKey("verification_policy")) {
172+
List<Object> infoVerificationPolicy = new ArrayList<>();
173+
HashMap<String, String> infoMethod = new HashMap<>();
174+
infoMethod.put("method", "sms");
175+
infoVerificationPolicy.add(infoMethod);
176+
params.put("verification_policy", infoVerificationPolicy);
177+
}
178+
return this.post(PATH_VERIFICATION, params, "application/json", "Basic");
179+
}
180+
}
148181
}

src/main/java/com/telesign/enterprise/VoiceClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@
44

55
public class VoiceClient extends com.telesign.VoiceClient {
66

7+
private static final String sdkVersion = VoiceClient.class.getPackage().getImplementationVersion();
8+
private static final String sdkSource = "java_telesign_enterprise";
9+
private static final String sdkVersionDependency = com.telesign.RestClient.class.getPackage().getImplementationVersion();
10+
711
public VoiceClient(String customerId, String apiKey) {
812

9-
super(customerId, apiKey, "https://rest-ww.telesign.com");
13+
super(customerId, apiKey, "https://rest-ww.telesign.com", sdkSource, sdkVersion, sdkVersionDependency);
1014
}
1115

1216
public VoiceClient(String customerId, String apiKey, String restEndpoint) {
13-
super(customerId, apiKey, restEndpoint);
17+
super(customerId, apiKey, restEndpoint, sdkSource, sdkVersion, sdkVersionDependency);
1418
}
1519

1620
public VoiceClient(String customerId,
@@ -22,6 +26,6 @@ public VoiceClient(String customerId,
2226
Proxy proxy,
2327
final String proxyUsername,
2428
final String proxyPassword) {
25-
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
29+
super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword, sdkSource, sdkVersion, sdkVersionDependency);
2630
}
2731
}

0 commit comments

Comments
 (0)