Skip to content

Updated the SDK to v1.0.8 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# exclude jar for gradle wrapper
!gradle/wrapper/*.jar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# build files
**/target
target
.gradle
build
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#
# Generated by: https://openapi-generator.tech
# Generated by OpenAPI Generator: https://openapi-generator.tech
#
# Ref: https://docs.travis-ci.com/user/languages/java/
#
language: java
jdk:
- oraclejdk8
- oraclejdk7
- openjdk12
- openjdk11
- openjdk10
- openjdk9
- openjdk8
before_install:
# ensure gradlew has proper permission
- chmod a+x ./gradlew
script:
# test using maven
- mvn test
# uncomment below to test using gradle
# - gradle test
# uncomment below to test using sbt
#- mvn test
# test using gradle
- gradle test
# test using sbt
# - sbt test
7 changes: 7 additions & 0 deletions DockerFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM maven:3.6.3-jdk-11

WORKDIR /app

COPY . .

RUN mvn test
71 changes: 22 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Telstra Messaging API
- API version: 2.2.9

The Telstra Messaging API specification


*Automatically generated by the [OpenAPI Generator](https://openapi-generator.tech)*


Expand Down Expand Up @@ -36,7 +39,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>Telstra</groupId>
<artifactId>TelstraMessaging</artifactId>
<version>1.0.0</version>
<version>1.0.8</version>
<scope>compile</scope>
</dependency>
```
Expand All @@ -46,7 +49,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "Telstra:TelstraMessaging:1.0.0"
compile "Telstra:TelstraMessaging:1.0.8"
```

### Others
Expand All @@ -59,7 +62,7 @@ mvn clean package

Then manually install the following JARs:

* `target/TelstraMessaging-1.0.0.jar`
* `target/TelstraMessaging-1.0.8.jar`
* `target/lib/*.jar`

## Getting Started
Expand All @@ -72,57 +75,24 @@ Please follow the [installation](#installation) instruction and execute the foll
import com.telstra.ApiClient;
import com.telstra.ApiException;
import com.telstra.Configuration;
import com.telstra.auth.*;
import com.telstra.messaging.*;
import com.telstra.models.*;
import com.telstra.messaging.AuthenticationApi;

public class Example {
public static void main(String[] args) {
// Configure API base path
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://tapi.telstra.com/v2");

// Configure OAuth2 access token for authorization
OAuth auth = (OAuth) defaultClient.getAuthentication("auth");
AuthenticationApi authenticationApi = new AuthenticationApi(defaultClient);
String clientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
String clientSecret = "xxxxxxxxxxxxxxxx";
String grantType = "client_credentials";
String scope = "NSMS";
try {
OAuthResponse oAuthResponse = authenticationApi.authToken(clientId, clientSecret, grantType, scope);
auth.setAccessToken(oAuthResponse.getAccessToken());
} catch (ApiException e) {
System.err.println("Exception when calling AuthenticationApi#authToken");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

// Configure phone number subscription
ProvisioningApi provisioningApiInstance = new ProvisioningApi(defaultClient);
try {
ProvisionNumberRequest provisionNumberRequest = new ProvisionNumberRequest();
ProvisionNumberResponse result = provisioningApiInstance.createSubscription(provisionNumberRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ProvisioningApi#createSubscription");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

// Send SMS
MessagingApi msgingApiInstance = new MessagingApi(defaultClient);
AuthenticationApi apiInstance = new AuthenticationApi(defaultClient);
String clientId = "clientId_example"; // String |
String clientSecret = "clientSecret_example"; // String |
String grantType = "\"client_credentials\""; // String |
String scope = "scope_example"; // String | NSMS
try {
SendSMSRequest sendSmsRequest = new SendSMSRequest();
sendSmsRequest.to("+61xxxxxxxxx");
sendSmsRequest.body("Hello from Java!");
MessageSentResponseSms result = msgingApiInstance.sendSMS(sendSmsRequest);
OAuthResponse result = apiInstance.authToken(clientId, clientSecret, grantType, scope);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessagingApi#sendSMS");
System.err.println("Exception when calling AuthenticationApi#authToken");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
Expand All @@ -142,10 +112,10 @@ Class | Method | HTTP request | Description
*AuthenticationApi* | [**authToken**](docs/AuthenticationApi.md#authToken) | **POST** /oauth/token | Generate OAuth2 token
*MessagingApi* | [**getMMSStatus**](docs/MessagingApi.md#getMMSStatus) | **GET** /messages/mms/{messageid}/status | Get MMS Status
*MessagingApi* | [**getSMSStatus**](docs/MessagingApi.md#getSMSStatus) | **GET** /messages/sms/{messageId}/status | Get SMS Status
*MessagingApi* | [**mMSHealthCheck**](docs/MessagingApi.md#mMSHealthCheck) | **GET** /messages/mms/heathcheck | MMS Health Check
*MessagingApi* | [**mMSHealthCheck**](docs/MessagingApi.md#mMSHealthCheck) | **GET** /messages/mms/healthcheck | MMS Health Check
*MessagingApi* | [**retrieveMMSReplies**](docs/MessagingApi.md#retrieveMMSReplies) | **GET** /messages/mms | Retrieve MMS Replies
*MessagingApi* | [**retrieveSMSReplies**](docs/MessagingApi.md#retrieveSMSReplies) | **GET** /messages/sms | Retrieve SMS Replies
*MessagingApi* | [**sMSHealthCheck**](docs/MessagingApi.md#sMSHealthCheck) | **GET** /messages/sms/heathcheck | SMS Health Check
*MessagingApi* | [**sMSHealthCheck**](docs/MessagingApi.md#sMSHealthCheck) | **GET** /messages/sms/healthcheck | SMS Health Check
*MessagingApi* | [**sMSMulti**](docs/MessagingApi.md#sMSMulti) | **POST** /messages/sms/multi | Send Multiple SMS
*MessagingApi* | [**sendMMS**](docs/MessagingApi.md#sendMMS) | **POST** /messages/mms | Send MMS
*MessagingApi* | [**sendSMS**](docs/MessagingApi.md#sendSMS) | **POST** /messages/sms | Send SMS
Expand Down Expand Up @@ -183,8 +153,8 @@ Authentication schemes defined for the API:

- **Type**: OAuth
- **Flow**: application
- **Authorization URL**:
- **Scopes**:
- **Authorization URL**:
- **Scopes**:
- NSMS: NSMS


Expand All @@ -193,3 +163,6 @@ Authentication schemes defined for the API:
It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## Author



6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'eclipse'
apply plugin: 'java'

group = 'Telstra'
version = '1.0.0'
version = '1.0.8'

buildscript {
repositories {
Expand Down Expand Up @@ -104,8 +104,10 @@ dependencies {
compile 'com.squareup.okhttp3:logging-interceptor:3.14.2'
compile 'com.google.code.gson:gson:2.8.5'
compile 'io.gsonfire:gson-fire:1.8.3'
compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
compile 'org.threeten:threetenbp:1.4.0'
testCompile 'junit:junit:4.12'
testCompile 'junit:junit:4.13'
}

javadoc {
Expand Down
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
settings(
organization := "Telstra",
name := "TelstraMessaging",
version := "1.0.0",
version := "1.0.8",
scalaVersion := "2.11.4",
scalacOptions ++= Seq("-feature"),
javacOptions in compile ++= Seq("-Xlint:deprecation"),
Expand All @@ -13,10 +13,12 @@ lazy val root = (project in file(".")).
"com.squareup.okhttp3" % "okhttp" % "3.14.2",
"com.squareup.okhttp3" % "logging-interceptor" % "3.14.2",
"com.google.code.gson" % "gson" % "2.8.5",
"org.apache.commons" % "commons-lang3" % "3.9",
"org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1",
"org.threeten" % "threetenbp" % "1.4.0" % "compile",
"io.gsonfire" % "gson-fire" % "1.8.3" % "compile",
"javax.annotation" % "jsr250-api" % "1.0" % "compile",
"junit" % "junit" % "4.12" % "test",
"junit" % "junit" % "4.13" % "test",
"com.novocode" % "junit-interface" % "0.10" % "test"
)
)
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'
services:
telstradev:
environment:
- CLIENT_ID
- CLIENT_SECRET
- PHONE_NO
- FROM_ALIAS
build:
context: .
dockerfile: DockerFile
13 changes: 9 additions & 4 deletions docs/MessagingApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Method | HTTP request | Description
------------- | ------------- | -------------
[**getMMSStatus**](MessagingApi.md#getMMSStatus) | **GET** /messages/mms/{messageid}/status | Get MMS Status
[**getSMSStatus**](MessagingApi.md#getSMSStatus) | **GET** /messages/sms/{messageId}/status | Get SMS Status
[**mMSHealthCheck**](MessagingApi.md#mMSHealthCheck) | **GET** /messages/mms/heathcheck | MMS Health Check
[**mMSHealthCheck**](MessagingApi.md#mMSHealthCheck) | **GET** /messages/mms/healthcheck | MMS Health Check
[**retrieveMMSReplies**](MessagingApi.md#retrieveMMSReplies) | **GET** /messages/mms | Retrieve MMS Replies
[**retrieveSMSReplies**](MessagingApi.md#retrieveSMSReplies) | **GET** /messages/sms | Retrieve SMS Replies
[**sMSHealthCheck**](MessagingApi.md#sMSHealthCheck) | **GET** /messages/sms/heathcheck | SMS Health Check
[**sMSHealthCheck**](MessagingApi.md#sMSHealthCheck) | **GET** /messages/sms/healthcheck | SMS Health Check
[**sMSMulti**](MessagingApi.md#sMSMulti) | **POST** /messages/sms/multi | Send Multiple SMS
[**sendMMS**](MessagingApi.md#sendMMS) | **POST** /messages/mms | Send MMS
[**sendSMS**](MessagingApi.md#sendSMS) | **POST** /messages/sms | Send SMS
Expand Down Expand Up @@ -457,13 +457,18 @@ Send multiple SMS in one API call.
import com.telstra.ApiClient;
import com.telstra.ApiException;
import com.telstra.Configuration;
import com.telstra.auth.*;
import com.telstra.models.*;
import com.telstra.messaging.MessagingApi;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://tapi.telstra.com/v2");

// Configure OAuth2 access token for authorization: auth
OAuth auth = (OAuth) defaultClient.getAuthentication("auth");
auth.setAccessToken("YOUR ACCESS TOKEN");

MessagingApi apiInstance = new MessagingApi(defaultClient);
SendSmsMultiRequest payload = new SendSmsMultiRequest(); // SendSmsMultiRequest | A JSON payload containing the recipient's phone number and text message. This number can be in international format if preceeded by a '+' or in national format ('04xxxxxxxx') where x is a digit.
Expand Down Expand Up @@ -493,7 +498,7 @@ Name | Type | Description | Notes

### Authorization

No authorization required
[auth](../README.md#auth)

### HTTP request headers

Expand All @@ -504,7 +509,7 @@ No authorization required
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Success | - |
**400** | Invalid or missing request parameters * DR-NOTIFY-URL-MISSING : when receiptOff is missing or receiptOff&#x3D;false but notifyURL is missing | - |
**400** | Invalid or missing request parameters * DR-NOTIFY-URL-MISSING : when &#x60;\&quot;receiptOff\&quot;&#x60; is missing or &#x60;\&quot;receiptOff\&quot;:\&quot;false\&quot;&#x60; but notifyURL is missing | - |
**500** | Technical error : Unable to route the message to a Target Endpoint : An error has occurred while processing your request, please refer to API Docs for summary on the issue | - |
**501** | The HTTP method being used has not yet been implemented for the requested resource | - |
**503** | The service requested is currently unavailable | - |
Expand Down
2 changes: 1 addition & 1 deletion docs/SendSmsMultiRequest.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**smsMulti** | [**List&lt;MessageMulti&gt;**](MessageMulti.md) | Multiple SMS. Up to 10 messages can be sent in one API call. | [optional]
**notiyURL** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). | [optional]
**notifyURL** | **String** | Contains a URL that will be called once your message has been processed. The status may be delivered, expired, deleted, etc. Please refer to the Delivery Status section for more information. If you are using a domain URL you must include the forward slash at the end of the URL (e.g. http://www.example.com/). This is required when &#x60;\&quot;receiptOff\&quot;&#x60; is missing or &#x60;\&quot;receiptOff\&quot;:\&quot;false\&quot;&#x60;. | [optional]



3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Uncomment to build for Android
#target = android
# # Uncomment to build for Android
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading