Skip to content

Commit 8dd0bb9

Browse files
committed
Update Readme
1 parent ce79c84 commit 8dd0bb9

File tree

1 file changed

+80
-31
lines changed

1 file changed

+80
-31
lines changed

README.md

Lines changed: 80 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,35 @@ mvn clean deploy
2929
Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
3030

3131
### Maven users
32+
Please refer to https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry
33+
34+
Please update settings.xml as described above:
35+
<profiles>
36+
<profile>
37+
<id>github</id>
38+
<repositories>
39+
<repository>
40+
<id>central</id>
41+
<url>https://repo1.maven.org/maven2</url>
42+
</repository>
43+
<repository>
44+
<id>github</id>
45+
<url>https://maven.pkg.github.com/telstra/MessagingAPI-SDK-Java</url>
46+
<snapshots>
47+
<enabled>true</enabled>
48+
</snapshots>
49+
</repository>
50+
</repositories>
51+
</profile>
52+
</profiles>
53+
54+
<servers>
55+
<server>
56+
<id>github</id>
57+
<username>USERNAME</username>
58+
<password>TOKEN</password>
59+
</server>
60+
</servers>
3261

3362
Add this dependency to your project's POM:
3463

@@ -65,37 +94,6 @@ Then manually install the following JARs:
6594

6695
Please follow the [installation](#installation) instruction and execute the following Java code:
6796

68-
```java
69-
import com.telstra.*;
70-
import org.junit.Before;
71-
import org.junit.Test;
72-
import static org.junit.Assert.assertNotNull;
73-
74-
public class AuthenticationApiExample {
75-
76-
public static void main(String[] args) {
77-
ApiClient defaultClient = new ApiClient();
78-
String clientId = "YOUR CLIENT ID";
79-
String clientSecret = "YOUR CLIENT SECRET";
80-
String grantType = "client_credentials";
81-
String scope = "free-trial-numbers:read free-trial-numbers:write messages:read messages:write virtual-numbers:read virtual-numbers:write reports:read reports:write";
82-
83-
defaultClient.setAccessSecret(clientId, clientSecret, grantType, scope);
84-
AuthenticationApi authenticationApi = new AuthenticationApi(defaultClient);
85-
try {
86-
OAuth oAuthResponse = authenticationApi.authToken(defaultClient.getClientId(), defaultClient.getClientSecret(), defaultClient.getGrantType(), defaultClient.getScope());
87-
System.out.println("getAuthToken: " + oAuthResponse.getAccessToken());
88-
assertNotNull(oAuthResponse.getAccessToken());
89-
} catch (ApiException e) {
90-
System.err.println("Exception when calling AuthenticationApi#authToken");
91-
System.err.println("Status code: " + e.getCode());
92-
System.err.println("Reason: " + e.getResponseBody());
93-
System.err.println("Response headers: " + e.getResponseHeaders());
94-
e.printStackTrace();
95-
}
96-
}
97-
}
98-
```
9997

10098
## Documentation for API Endpoints
10199

@@ -144,6 +142,39 @@ Authentication schemes defined for the API:
144142
- virtual-numbers:write: write information for virtual numbers
145143

146144

145+
```java
146+
import com.telstra.*;
147+
import com.telstra.messaging.AuthenticationApi;
148+
import org.junit.Before;
149+
import org.junit.Test;
150+
import static org.junit.Assert.assertNotNull;
151+
152+
public class AuthenticationApiExample {
153+
154+
public static void main(String[] args) {
155+
ApiClient defaultClient = new ApiClient();
156+
String clientId = "YOUR CLIENT ID";
157+
String clientSecret = "YOUR CLIENT SECRET";
158+
String grantType = "client_credentials";
159+
String scope = "free-trial-numbers:read free-trial-numbers:write messages:read messages:write virtual-numbers:read virtual-numbers:write reports:read reports:write";
160+
161+
defaultClient.setAccessSecret(clientId, clientSecret, grantType, scope);
162+
AuthenticationApi authenticationApi = new AuthenticationApi(defaultClient);
163+
try {
164+
OAuth oAuthResponse = authenticationApi.authToken(defaultClient.getClientId(), defaultClient.getClientSecret(), defaultClient.getGrantType(), defaultClient.getScope());
165+
System.out.println("getAuthToken: " + oAuthResponse.getAccessToken());
166+
assertNotNull(oAuthResponse.getAccessToken());
167+
} catch (ApiException e) {
168+
System.err.println("Exception when calling AuthenticationApi#authToken");
169+
System.err.println("Status code: " + e.getCode());
170+
System.err.println("Reason: " + e.getResponseBody());
171+
System.err.println("Response headers: " + e.getResponseHeaders());
172+
e.printStackTrace();
173+
}
174+
}
175+
}
176+
```
177+
147178
## Recommendation
148179

149180
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
@@ -178,6 +209,7 @@ For example:
178209

179210
```java
180211
import com.telstra.*;
212+
import com.telstra.messaging.FreeTrialNumbersApi;
181213
import org.junit.Before;
182214
import org.junit.Test;
183215
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -223,6 +255,7 @@ For example:
223255

224256
```java
225257
import com.telstra.*;
258+
import com.telstra.messaging.FreeTrialNumbersApi;
226259
import org.junit.Before;
227260
import org.junit.Test;
228261
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -280,6 +313,7 @@ For example:
280313

281314
```java
282315
import com.telstra.*;
316+
import com.telstra.messaging.VirtualNumbersApi;
283317
import org.junit.Before;
284318
import org.junit.Test;
285319
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -339,6 +373,7 @@ For example:
339373

340374
```java
341375
import com.telstra.*;
376+
import com.telstra.messaging.VirtualNumbersApi;
342377
import org.junit.Before;
343378
import org.junit.Test;
344379
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -384,6 +419,7 @@ For example:
384419

385420
```java
386421
import com.telstra.*;
422+
import com.telstra.messaging.VirtualNumbersApi;
387423
import org.junit.Before;
388424
import org.junit.Test;
389425
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -435,6 +471,7 @@ For example:
435471

436472
```java
437473
import com.telstra.*;
474+
import com.telstra.messaging.VirtualNumbersApi;
438475
import org.junit.Before;
439476
import org.junit.Test;
440477
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -482,6 +519,7 @@ For example:
482519

483520
```java
484521
import com.telstra.*;
522+
import com.telstra.messaging.VirtualNumbersApi;
485523
import org.junit.Before;
486524
import org.junit.Test;
487525
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -532,6 +570,7 @@ For example:
532570

533571
```java
534572
import com.telstra.*;
573+
import com.telstra.messaging.VirtualNumbersApi;
535574
import org.junit.Before;
536575
import org.junit.Test;
537576
import static com.telstra.messaging.AuthenticationApi.getAuthToken;
@@ -609,6 +648,7 @@ For example:
609648

610649
```java
611650
import com.telstra.*;
651+
import com.telstra.messaging.MessagesApi;
612652
import java.util.UUID;
613653
import org.junit.Before;
614654
import org.junit.Test;
@@ -712,6 +752,7 @@ For example:
712752

713753
```java
714754
import com.telstra.*;
755+
import com.telstra.messaging.MessagesApi;
715756
import java.util.UUID;
716757
import org.junit.Before;
717758
import org.junit.Test;
@@ -764,6 +805,7 @@ For example:
764805

765806
```java
766807
import com.telstra.*;
808+
import com.telstra.messaging.MessagesApi;
767809
import java.util.UUID;
768810
import org.junit.Before;
769811
import org.junit.Test;
@@ -851,6 +893,7 @@ For example:
851893

852894
```java
853895
import com.telstra.*;
896+
import com.telstra.messaging.MessagesApi;
854897
import java.util.UUID;
855898
import org.junit.Before;
856899
import org.junit.Test;
@@ -939,6 +982,7 @@ For example:
939982

940983
```java
941984
import com.telstra.*;
985+
import com.telstra.messaging.MessagesApi;
942986
import java.util.UUID;
943987
import org.junit.Before;
944988
import org.junit.Test;
@@ -987,6 +1031,7 @@ For example:
9871031

9881032
```java
9891033
import com.telstra.*;
1034+
import com.telstra.messaging.MessagesApi;
9901035
import java.util.UUID;
9911036
import org.junit.Before;
9921037
import org.junit.Test;
@@ -1054,6 +1099,7 @@ For example:
10541099

10551100
```java
10561101
import com.telstra.*;
1102+
import com.telstra.messaging.ReportsApi;
10571103
import java.util.UUID;
10581104
import org.junit.Before;
10591105
import org.junit.Test;
@@ -1104,6 +1150,7 @@ For example:
11041150

11051151
```java
11061152
import com.telstra.*;
1153+
import com.telstra.messaging.ReportsApi;
11071154
import java.util.UUID;
11081155
import org.junit.Before;
11091156
import org.junit.Test;
@@ -1152,6 +1199,7 @@ For example:
11521199

11531200
```java
11541201
import com.telstra.*;
1202+
import com.telstra.messaging.ReportsApi;
11551203
import java.util.UUID;
11561204
import org.junit.Before;
11571205
import org.junit.Test;
@@ -1195,6 +1243,7 @@ For example:
11951243

11961244
```java
11971245
import com.telstra.*;
1246+
import com.telstra.messaging.HealthCheckApi;
11981247
import org.junit.Before;
11991248
import org.junit.Test;
12001249
import static com.telstra.messaging.AuthenticationApi.getAuthToken;

0 commit comments

Comments
 (0)