Skip to content

Commit

Permalink
Merge pull request #7 from telstra/dev
Browse files Browse the repository at this point in the history
Minor update to documentation and migration to openapi-generate
  • Loading branch information
developersteve authored Jun 20, 2018
2 parents 7ecc585 + 7381dd6 commit 242fe34
Show file tree
Hide file tree
Showing 48 changed files with 1,048 additions and 756 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


- API version: 2.2.6
- Package version: 1.0.4
- Package version: 1.0.4.1

## Requirements

Expand All @@ -22,7 +22,7 @@ To install the bindings via [Composer](http://getcomposer.org/), add the followi
}
],
"require": {
"Telstra/MessagingAPI-SDK-php": "*"
"Telstra/MessagingAPI-SDK-php": "*@master"
}
}
```
Expand Down Expand Up @@ -59,9 +59,9 @@ $apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$client_id = "client_id_example"; // string |
$client_secret = "client_secret_example"; // string |
$grant_type = "client_credentials"; // string |
$client_id = 'client_id_example'; // string |
$client_secret = 'client_secret_example'; // string |
$grant_type = 'client_credentials'; // string |

try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type);
Expand All @@ -82,6 +82,7 @@ Class | Method | HTTP request | Description
*AuthenticationApi* | [**authToken**](docs/Api/AuthenticationApi.md#authtoken) | **POST** /oauth/token | Generate OAuth2 token
*MessagingApi* | [**getMMSStatus**](docs/Api/MessagingApi.md#getmmsstatus) | **GET** /messages/mms/{messageid}/status | Get MMS Status
*MessagingApi* | [**getSMSStatus**](docs/Api/MessagingApi.md#getsmsstatus) | **GET** /messages/sms/{messageId}/status | Get SMS Status
*MessagingApi* | [**retrieveMMSResponses**](docs/Api/MessagingApi.md#retrievemmsresponses) | **GET** /messages/mms | Retrieve MMS Responses
*MessagingApi* | [**retrieveSMSResponses**](docs/Api/MessagingApi.md#retrievesmsresponses) | **GET** /messages/sms | Retrieve SMS Responses
*MessagingApi* | [**sendMMS**](docs/Api/MessagingApi.md#sendmms) | **POST** /messages/mms | Send MMS
*MessagingApi* | [**sendSMS**](docs/Api/MessagingApi.md#sendsms) | **POST** /messages/sms | Send SMS
Expand Down Expand Up @@ -119,4 +120,8 @@ Class | Method | HTTP request | Description
- **NSMS**: NSMS


## Author




10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "telstra/messagingapi-sdk-php",
"version": "1.0.4",
"description": "Telstra Messaging SDK - PHP Library",
"name": "Telstra/MessagingAPI-SDK-php",
"version": "1.0.4.1",
"description": "",
"keywords": [
"swagger",
"openapitools",
"openapi-generator",
"php",
"sdk",
"api",
"rest",
"telstradev"
],
"homepage": "https://dev.telstra.com",
Expand Down
10 changes: 5 additions & 5 deletions docs/Api/AuthenticationApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Method | HTTP request | Description
Generate OAuth2 token

To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the &quot;API Free Trial&quot; Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour. <pre><code class=\"language-sh\"> #!/bin/bash # Obtain these keys from the Telstra Developer Portal CLIENT_KEY=\"your client key\" CLIENT_SECRET=\"your client secret\" curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' \\ -d 'grant_type=client_credentials&amp;client_id=$CLIENT_KEY&amp;client_secret=CLIENT_SECRET&amp;scope=NSMS' \\ 'https://tapi.telstra.com/v2/oauth/token' </code></pre>
To generate an OAuth2 Authentication token, pass through your `Client key` and `Client secret` that you received when you registered for the **API Free Trial** Product. The grant_type should be left as `client_credentials` and the scope as `NSMS`. The token will expire in one hour.

### Example
```php
Expand All @@ -24,9 +24,9 @@ $apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client()
);
$client_id = "client_id_example"; // string |
$client_secret = "client_secret_example"; // string |
$grant_type = "client_credentials"; // string |
$client_id = 'client_id_example'; // string |
$client_secret = 'client_secret_example'; // string |
$grant_type = 'client_credentials'; // string |

try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type);
Expand All @@ -43,7 +43,7 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client_id** | **string**| |
**client_secret** | **string**| |
**grant_type** | **string**| | [default to client_credentials]
**grant_type** | **string**| | [default to &#39;client_credentials&#39;]

### Return type

Expand Down
90 changes: 74 additions & 16 deletions docs/Api/MessagingApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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
[**retrieveMMSResponses**](MessagingApi.md#retrieveMMSResponses) | **GET** /messages/mms | Retrieve MMS Responses
[**retrieveSMSResponses**](MessagingApi.md#retrieveSMSResponses) | **GET** /messages/sms | Retrieve SMS Responses
[**sendMMS**](MessagingApi.md#sendMMS) | **POST** /messages/mms | Send MMS
[**sendSMS**](MessagingApi.md#sendSMS) | **POST** /messages/sms | Send SMS
Expand All @@ -32,7 +33,7 @@ $apiInstance = new Telstra_Messaging\Api\MessagingApi(
new GuzzleHttp\Client(),
$config
);
$messageid = "messageid_example"; // string | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms
$messageid = 'messageid_example'; // string | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/mms

try {
$result = $apiInstance->getMMSStatus($messageid);
Expand All @@ -59,7 +60,7 @@ Name | Type | Description | Notes

### HTTP request headers

- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
Expand All @@ -69,7 +70,7 @@ Name | Type | Description | Notes
Get SMS Status

If no notification URL has been specified, it is possible to poll for the message status. <pre><code class=\"language-sh\"> #!/bin/bash #!/bin/bash # Example of how to poll for a message status AccessToken=\"Consumer Access Token\" MessageId=\"Previous supplied Message Id, URL encoded\" curl -X get -H \"Authorization: Bearer $AccessToken\" \\ -H \"Content-Type: application/json\" \\ \"https://tapi.telstra.com/v2/messages/sms/$MessageId\" </code></pre> Note that the `MessageId` that appears in the URL must be URL encoded, just copying the `MessageId` as it was supplied when submitting the message may not work.
If no notification URL has been specified, it is possible to poll for the message status. Note that the `MessageId` that appears in the URL must be URL encoded. Just copying the `MessageId` as it was supplied when submitting the message may not work. SMS Status with Notification URL --- When a message has reached its final state, the API will send a POST to the URL that has been previously specified. <pre><code class=\"language-sh\">{ to: '+61418123456' sentTimestamp: '2017-03-17T10:05:22+10:00' receivedTimestamp: '2017-03-17T10:05:23+10:00' messageId: /cccb284200035236000000000ee9d074019e0301/1261418123456 deliveryStatus: DELIVRD } </code></pre> The fields are: <table> <thead> <tr> <th>Field</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code>to</code></td> <td>The number the message was sent to.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> <tr> <td><code>sentTimestamp</code></td> <td>Time handling of the message ended.</td> </tr> <tr> <td><code>deliveryStatus</code></td> <td>The final state of the message.</td> </tr> <tr> <td><code>messageId</code></td> <td>The same reference that was returned when the original message was sent.</td> </tr> <tr> <td><code>receivedTimestamp</code></td> <td>Time the message was sent to the API.</td> </tr> </tbody> </table> Upon receiving this call it is expected that your servers will give a 204 (No Content) response. Anything else will cause the API to reattempt the call 5 minutes later.

### Example
```php
Expand All @@ -85,7 +86,7 @@ $apiInstance = new Telstra_Messaging\Api\MessagingApi(
new GuzzleHttp\Client(),
$config
);
$message_id = "message_id_example"; // string | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms.
$message_id = 'message_id_example'; // string | Unique identifier of a message - it is the value returned from a previous POST call to https://api.telstra.com/v2/messages/sms.

try {
$result = $apiInstance->getSMSStatus($message_id);
Expand All @@ -112,7 +113,56 @@ Name | Type | Description | Notes

### HTTP request headers

- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **retrieveMMSResponses**
> \Telstra_Messaging\Model\MMSContent[] retrieveMMSResponses()
Retrieve MMS Responses

Messages are retrieved one at a time, starting with the earliest response. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for MMS Replies <pre><code class=\"language-sh\">{ \"status\": \"RECEIVED\", \"destinationAddress\": \"+61418123456\", \"senderAddress\": \"+61421987654\", \"subject\": \"Foo\", \"sentTimestamp\": \"2018-03-23T12:15:45+10:00\", \"envelope\": \"string\", \"MMSContent\": [ { \"type\": \"text/plain\", \"filename\": \"text_1.txt\", \"payload\": \"string\" }, { \"type\": \"image/jpeg\", \"filename\": \"sample.jpeg\", \"payload\": \"string\" } ] }</code></pre> The fields are: | Field | Description | | --- | --- | | `status` | The final state of the message. | | `destinationAddress` |The number the message was sent to. | | `senderAddress` | The number the message was sent from. | | `subject` | The subject assigned to the message. | | `sentTimestamp` | Time handling of the message ended. | | `envelope` | Information about about terminal type and originating operator. | | `MMSContent` | An array of the actual content of the reply message. | | `type` | The content type of the message. | | `filename` | The filename for the message content. | | `payload` | The content of the message. |

### Example
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: auth
$config = Telstra_Messaging\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new Telstra_Messaging\Api\MessagingApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);

try {
$result = $apiInstance->retrieveMMSResponses();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling MessagingApi->retrieveMMSResponses: ', $e->getMessage(), PHP_EOL;
}
?>
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**\Telstra_Messaging\Model\MMSContent[]**](../Model/MMSContent.md)

### Authorization

[auth](../../README.md#auth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)
Expand All @@ -122,7 +172,7 @@ Name | Type | Description | Notes
Retrieve SMS Responses

Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead.
Messages are retrieved one at a time, starting with the earliest response. The API supports the encoding of the full range of emojis in the reply message. The emojis will be in their UTF-8 format. If the subscription has a `notifyURL`, response messages will be logged there instead. # Notification URL Format for SMS Response <pre><code class=\"language-sh\">{ \"to\":\"+61472880123\", \"from\":\"+61412345678\", \"body\":\"Foo4\", \"sentTimestamp\":\"2018-04-20T14:24:35\", \"messageId\":\"DMASApiA0000000146\" }</code></pre> The fields are: | Field | Description | | --- |--- | | `to` | The number the message was sent to. | | `from` | The number the message was sent from. | | `body` | The content of the SMS response. | | `sentTimestamp` | Time handling of the message ended. | | `messageId` | The ID assigned to the message. |

### Example
```php
Expand Down Expand Up @@ -161,13 +211,13 @@ This endpoint does not need any parameter.

### HTTP request headers

- **Content-Type**: application/json
- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **sendMMS**
> \Telstra_Messaging\Model\MessageSentResponse sendMMS($body)
> \Telstra_Messaging\Model\MessageSentResponse sendMMS($send_mms_request)
Send MMS

Expand All @@ -187,10 +237,12 @@ $apiInstance = new Telstra_Messaging\Api\MessagingApi(
new GuzzleHttp\Client(),
$config
);
$body = new \Telstra_Messaging\Model\SendMmsRequest(); // \Telstra_Messaging\Model\SendMmsRequest | A JSON or XML payload containing the recipient's phone number and MMS message.The recipient number should be in the format '04xxxxxxxx' where x is a digit
$send_mms_request = new \Telstra_Messaging\Model\SendMmsRequest(); // \Telstra_Messaging\Model\SendMmsRequest | A JSON or XML payload containing the recipient's phone number and MMS message.
The recipient number should be in the format '04xxxxxxxx' where x is a digit.


try {
$result = $apiInstance->sendMMS($body);
$result = $apiInstance->sendMMS($send_mms_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling MessagingApi->sendMMS: ', $e->getMessage(), PHP_EOL;
Expand All @@ -202,7 +254,9 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**\Telstra_Messaging\Model\SendMmsRequest**](../Model/SendMmsRequest.md)| A JSON or XML payload containing the recipient&#39;s phone number and MMS message.The recipient number should be in the format &#39;04xxxxxxxx&#39; where x is a digit |
**send_mms_request** | [**\Telstra_Messaging\Model\SendMmsRequest**](../Model/SendMmsRequest.md)| A JSON or XML payload containing the recipient&#39;s phone number and MMS message.
The recipient number should be in the format &#39;04xxxxxxxx&#39; where x is a digit.
|

### Return type

Expand All @@ -220,11 +274,11 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md)

# **sendSMS**
> \Telstra_Messaging\Model\MessageSentResponse sendSMS($payload)
> \Telstra_Messaging\Model\MessageSentResponse sendSMS($send_sms_request)
Send SMS

Send an SMS Message to a single or multiple mobile number/s. <h3>Send message to a single number: </h3> <pre><code class=\"language-sh\"> #!/bin/bash # Use the Messaging API-v2 to send an SMS # Note: only to: and body: are required AccessToken=\"Access Token\" Dest=\"Destination number\" curl -X POST -H \"Authorization: Bearer $AccessToken\" -H \"Content-Type: application/json\" -d \"{ \\\"to\\\":\\\"$Dest\\\", \\\"body\\\":\\\"Test Message\\\", \\\"from\\\": \\\"+61412345678\\\", \\\"validity\\\": 5, \\\"scheduledDelivery\\\": 1, \\\"notifyURL\\\": \\\"\\\", \\\"replyRequest\\\": false \\\"priority\\\": true }\" \"https://tapi.telstra.com/v2/messages/sms\" </code></pre> \\ <h3>Send message to multiple numbers: </h3> <pre><code class=\"language-sh\"> #!/bin/bash # Use the Messaging API to send an SMS AccessToken=\"Access Token\" Dest=\"Destination number\" curl -X post -H \"Authorization: Bearer $AccessToken\" \\ -H \"Content-Type: application/json\" \\ -d '{ \"to\":\"$dest1, $dest2, $dest3\", \"body\":\"Test Message\" }' \\ https://tapi.telstra.com/v2/messages/sms <pre><code class=\"language-sh\">
Send an SMS Message to a single or multiple mobile number/s.

### Example
```php
Expand All @@ -240,10 +294,12 @@ $apiInstance = new Telstra_Messaging\Api\MessagingApi(
new GuzzleHttp\Client(),
$config
);
$payload = new \Telstra_Messaging\Model\SendSMSRequest(); // \Telstra_Messaging\Model\SendSMSRequest | A JSON or XML 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.
$send_sms_request = new \Telstra_Messaging\Model\SendSMSRequest(); // \Telstra_Messaging\Model\SendSMSRequest | A JSON or XML 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.


try {
$result = $apiInstance->sendSMS($payload);
$result = $apiInstance->sendSMS($send_sms_request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling MessagingApi->sendSMS: ', $e->getMessage(), PHP_EOL;
Expand All @@ -255,7 +311,9 @@ try {

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**payload** | [**\Telstra_Messaging\Model\SendSMSRequest**](../Model/SendSMSRequest.md)| A JSON or XML payload containing the recipient&#39;s phone number and text message. This number can be in international format if preceeded by a ‘+’ or in national format (&#39;04xxxxxxxx&#39;) where x is a digit. |
**send_sms_request** | [**\Telstra_Messaging\Model\SendSMSRequest**](../Model/SendSMSRequest.md)| A JSON or XML payload containing the recipient&#39;s phone number and text message.
This number can be in international format if preceeded by a ‘+’ or in national format (&#39;04xxxxxxxx&#39;) where x is a digit.
|

### Return type

Expand Down
Loading

0 comments on commit 242fe34

Please sign in to comment.