Skip to content
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

Upgraded the SDK to v1.0.8 #10

Open
wants to merge 2 commits into
base: master
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
19 changes: 19 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: validate-pr
on: pull_request

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: "Checkout Project"
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: "Docker run test"
env: # Or as an environment variable
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
PHONE_NO: ${{ secrets.PHONE_NO }}
FROM_ALIAS: ${{ secrets.FROM_ALIAS }}
run: docker-compose up --build --exit-code-from telstradev
23 changes: 23 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

return PhpCsFixer\Config::create()
->setUsingCache(true)
->setRules([
'@PSR2' => true,
'ordered_imports' => true,
'phpdoc_order' => true,
'array_syntax' => [ 'syntax' => 'short' ],
'strict_comparison' => true,
'strict_param' => true,
'no_trailing_whitespace' => false,
'no_trailing_whitespace_in_comment' => false,
'braces' => false,
'single_blank_line_at_eof' => false,
'blank_line_after_namespace' => false,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude('test')
->exclude('tests')
->in(__DIR__)
);
47 changes: 47 additions & 0 deletions BackwardCompatTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// 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()
);
$client_id = getenv('CLIENT_ID'); // string |
$client_secret = getenv('CLIENT_SECRET'); // string |
$grant_type = 'client_credentials'; // string |
$scope = 'NSMS'; // string | NSMS

try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type, $scope);

$config = Telstra_Messaging\Configuration::getDefaultConfiguration()->setAccessToken($result["access_token"]);

$apiInstance = new Telstra_Messaging\Api\ProvisioningApi(
new GuzzleHttp\Client(),
$config
);
$body = new \Telstra_Messaging\Model\ProvisionNumberRequest(array("active_days" => 30));

$result = $apiInstance->createSubscription($body);

$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
);

$message = array(
"to" => getenv('PHONE_NO'),
"body" => "Testing PHP SDK backward compatibility tests",
"from" => getenv('FROM_ALIAS'),
);
$payload = new \Telstra_Messaging\Model\SendSMSRequest($message);

$result = $apiInstance->sendSMS($payload);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->authToken: ', $e->getMessage(), PHP_EOL;
}

?>
11 changes: 11 additions & 0 deletions DockerFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM composer

WORKDIR /app

COPY . .

RUN composer install

RUN composer test

CMD ["php", "BackwardCompatTest.php"]
49 changes: 33 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
# Messaging SDK
# OpenAPIClient-php

The Telstra Messaging API specification

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 2.2.9
- Package version: 1.0.6
- Package version: 1.0.8
- Build package: org.openapitools.codegen.languages.PhpClientCodegen

## Requirements

PHP 5.5 and later

## Installation & Usage

### Composer

To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`:

```
```json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/Telstra/MessagingAPI-SDK-php.git"
"type": "vcs",
"url": "https://github.com/telstra/messagingapi-sdk-php.git"
}
],
"require": {
"Telstra/MessagingAPI-SDK-php": "*@master"
"telstra/messagingapi-sdk-php": "*@dev"
}
}
```
Expand All @@ -34,14 +39,14 @@ Then run `composer install`
Download the files and include `autoload.php`:

```php
require_once('/path/to/vendor/autoload.php');
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');
```

## Tests

To run the unit tests:

```
```bash
composer install
./vendor/bin/phpunit
```
Expand All @@ -54,6 +59,8 @@ Please follow the [installation procedure](#installation--usage) and then run th
<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
Expand All @@ -62,9 +69,10 @@ $apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
$client_id = 'client_id_example'; // string |
$client_secret = 'client_secret_example'; // string |
$grant_type = 'client_credentials'; // string |
$scope = 'scope_example'; // string | NSMS

try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type);
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type, $scope);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->authToken: ', $e->getMessage(), PHP_EOL;
Expand All @@ -82,8 +90,11 @@ 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* | [**mMSHealthCheck**](docs/Api/MessagingApi.md#mmshealthcheck) | **GET** /messages/mms/healthcheck | MMS Health Check
*MessagingApi* | [**retrieveMMSReplies**](docs/Api/MessagingApi.md#retrievemmsreplies) | **GET** /messages/mms | Retrieve MMS Replies
*MessagingApi* | [**retrieveSMSReplies**](docs/Api/MessagingApi.md#retrievesmsreplies) | **GET** /messages/sms | Retrieve SMS Replies
*MessagingApi* | [**sMSHealthCheck**](docs/Api/MessagingApi.md#smshealthcheck) | **GET** /messages/sms/healthcheck | SMS Health Check
*MessagingApi* | [**sMSMulti**](docs/Api/MessagingApi.md#smsmulti) | **POST** /messages/sms/multi | Send Multiple SMS
*MessagingApi* | [**sendMMS**](docs/Api/MessagingApi.md#sendmms) | **POST** /messages/mms | Send MMS
*MessagingApi* | [**sendSMS**](docs/Api/MessagingApi.md#sendsms) | **POST** /messages/sms | Send SMS
*ProvisioningApi* | [**createSubscription**](docs/Api/ProvisioningApi.md#createsubscription) | **POST** /messages/provisioning/subscriptions | Create Subscription
Expand All @@ -94,34 +105,40 @@ Class | Method | HTTP request | Description
## Documentation For Models

- [DeleteNumberRequest](docs/Model/DeleteNumberRequest.md)
- [GetMmsResponse](docs/Model/GetMmsResponse.md)
- [GetSubscriptionResponse](docs/Model/GetSubscriptionResponse.md)
- [HealthCheckResponse](docs/Model/HealthCheckResponse.md)
- [InboundPollResponse](docs/Model/InboundPollResponse.md)
- [MMSContent](docs/Model/MMSContent.md)
- [Message](docs/Model/Message.md)
- [MessageSentResponse](docs/Model/MessageSentResponse.md)
- [MessageMulti](docs/Model/MessageMulti.md)
- [MessageSentResponseMms](docs/Model/MessageSentResponseMms.md)
- [MessageSentResponseSms](docs/Model/MessageSentResponseSms.md)
- [OAuthResponse](docs/Model/OAuthResponse.md)
- [OutboundPollResponse](docs/Model/OutboundPollResponse.md)
- [ProvisionNumberRequest](docs/Model/ProvisionNumberRequest.md)
- [ProvisionNumberResponse](docs/Model/ProvisionNumberResponse.md)
- [SendMmsRequest](docs/Model/SendMmsRequest.md)
- [SendSMSRequest](docs/Model/SendSMSRequest.md)
- [SendSmsMultiRequest](docs/Model/SendSmsMultiRequest.md)
- [Status](docs/Model/Status.md)


## Documentation For Authorisation
## Documentation For Authorization



## auth


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


## Author




27 changes: 15 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,43 @@
{
"name": "Telstra/MessagingAPI-SDK-php",
"version": "1.0.6",
"description": "",
"name": "telstra/messagingapi-sdk-php",
"version": "1.0.8",
"description": "The Telstra Messaging API specification",
"keywords": [
"openapitools",
"openapi-generator",
"openapi",
"php",
"sdk",
"api",
"rest",
"telstradev"
"api"
],
"homepage": "https://dev.telstra.com",
"license": "Apache-2.0",
"homepage": "https://openapi-generator.tech",
"license": "unlicense",
"authors": [
{
"name": "developersteve",
"homepage": "https://github.com/developersteve"
"name": "OpenAPI-Generator contributors",
"homepage": "https://openapi-generator.tech"
}
],
"require": {
"php": ">=5.5",
"php": ">=7.1",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^4.8",
"phpunit/phpunit": "^7.4",
"squizlabs/php_codesniffer": "~2.6",
"friendsofphp/php-cs-fixer": "~1.12"
"friendsofphp/php-cs-fixer": "~2.12"
},
"autoload": {
"psr-4": { "Telstra_Messaging\\" : "lib/" }
},
"autoload-dev": {
"psr-4": { "Telstra_Messaging\\" : "test/" }
},
"scripts": {
"test": "phpunit"
}
}
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
23 changes: 16 additions & 7 deletions docs/Api/AuthenticationApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ Method | HTTP request | Description
[**authToken**](AuthenticationApi.md#authToken) | **POST** /oauth/token | Generate OAuth2 token


# **authToken**
> \Telstra_Messaging\Model\OAuthResponse authToken($client_id, $client_secret, $grant_type)

## authToken

> \Telstra_Messaging\Model\OAuthResponse authToken($client_id, $client_secret, $grant_type, $scope)

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 **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.
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
<?php
require_once(__DIR__ . '/vendor/autoload.php');


$apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
Expand All @@ -27,9 +31,10 @@ $apiInstance = new Telstra_Messaging\Api\AuthenticationApi(
$client_id = 'client_id_example'; // string |
$client_secret = 'client_secret_example'; // string |
$grant_type = 'client_credentials'; // string |
$scope = 'scope_example'; // string | NSMS

try {
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type);
$result = $apiInstance->authToken($client_id, $client_secret, $grant_type, $scope);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AuthenticationApi->authToken: ', $e->getMessage(), PHP_EOL;
Expand All @@ -39,11 +44,13 @@ try {

### Parameters


Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**client_id** | **string**| |
**client_secret** | **string**| |
**grant_type** | **string**| | [default to &#39;client_credentials&#39;]
**scope** | **string**| NSMS | [optional]

### Return type

Expand All @@ -55,8 +62,10 @@ No authorization required

### HTTP request headers

- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/json
- **Content-Type**: application/x-www-form-urlencoded
- **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)
[[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)

Loading