Skip to content

Commit dc8bfc3

Browse files
authored
Added readme and minor fixes for tn option orders (#61)
* Added readme and minor fixes for tn option orders * added user agent (#62) * Added php user agent header * Updated version * Removed version increase to bundle in 1 release
1 parent ffa1a02 commit dc8bfc3

File tree

5 files changed

+71
-7
lines changed

5 files changed

+71
-7
lines changed

README.md

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ PHP Client library for Bandwidth's Phone Number Dashboard (AKA: Dashboard, Iris)
1919
| 2.2.0 | Added `csrs` endpoints |
2020
| 2.3.0 | Added `loas` endpoints for ImportTnOrders |
2121
| 2.4.0 | Added Emergency Calling Notification, Emergeny Notification Group, Emergency Notification Endpoint, and Alternate End User Identity methods |
22+
| 2.5.0 | Added `PortOutPasscode` for TnOption orders |
2223

2324
## Supported PHP Versions
2425

@@ -589,20 +590,77 @@ $billingReport->file(['stream' => true, 'sink' => $outFile]);
589590

590591
## TN Options
591592

592-
### Create New TN Options (Async request)
593+
### Get TN Option Orders
594+
```PHP
595+
$tnoptions = $account->tnoptions();
596+
$response = $tnoptions->getList();
597+
print_r($response[0]->OrderId);
598+
```
599+
600+
### GET TN Option Order
601+
```PHP
602+
$tnoptions = $account->tnoptions();
603+
$response = $tnoptions->tnoption("order_id");
604+
print_r($response->OrderCreateDate);
605+
```
606+
607+
### Get TN Option Order (error)
608+
```PHP
609+
$tnoptions = $account->tnoptions();
610+
$response = $tnoptions->tnoption("error_order_id");
611+
print_r($response->ErrorList->Error->Description); //note: Error could be an array or a single object
612+
//depending on how many errors are returned
613+
```
614+
615+
### Create Portout Passcode
616+
```PHP
617+
$tnoptions = $account->tnoptions();
618+
$data = array(
619+
"TnOptionGroups" => array(
620+
"TnOptionGroup" => array(
621+
"PortOutPasscode" => "12abd38",
622+
"TelephoneNumbers" => array(
623+
"TelephoneNumber" => "2018551020"
624+
)
625+
),
626+
)
627+
);
628+
$response = $tnoptions->create($data);
629+
print_r($response->OrderCreateDate);
630+
```
631+
632+
### Create Call Forward Number
633+
```PHP
634+
$tnoptions = $account->tnoptions();
635+
$data = array(
636+
"TnOptionGroups" => array(
637+
"TnOptionGroup" => array(
638+
"CallForward" => "2018551022",
639+
"TelephoneNumbers" => array(
640+
"TelephoneNumber" => "2018551020"
641+
)
642+
),
643+
)
644+
);
645+
$response = $tnoptions->create($data);
646+
print_r($response->OrderCreateDate);
647+
```
648+
649+
### Enable SMS
593650
```PHP
594651
$tnoptions = $account->tnoptions();
595652
$data = array(
596653
"TnOptionGroups" => array(
597654
"TnOptionGroup" => array(
598-
"CallForward" => "<FORWARD_NUMBER>",
655+
"Sms" => "on",
599656
"TelephoneNumbers" => array(
600-
"TelephoneNumber" => "<UPDATE_NUMBER>"
657+
"TelephoneNumber" => "2018551020"
601658
)
602659
),
603660
)
604661
);
605-
$tnoptions->create($data);
662+
$response = $tnoptions->create($data);
663+
print_r($response->OrderCreateDate);
606664
```
607665

608666
## Hosted Messaging Functions

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Bandwidth's Iris SDK for PHP",
55
"keywords": ["iris","sdk","php"],
66
"homepage": "http://dev.bandwidth.com",
7-
"reference": "v2.4.0",
7+
"reference": "v2.5.0",
88
"license": "MIT",
99
"authors": [
1010
],

core/Client.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ public function __construct($login, $password, $options = [])
147147
$client_options['handler'] = $options['handler'];
148148
}
149149

150+
$options['headers'] = array(
151+
'User-Agent' => 'PHP-Bandwidth-Iris'
152+
);
153+
150154
$this->client = new \GuzzleHttp\Client($options);
151155
}
152156

src/TnOptionModel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ final class TnOption extends RestEntry{
7777
"CreatedByUser" => array("type" => "string"),
7878
"ErrorList" => array("type" => "\Iris\ErrorList"),
7979
"TnOptionGroups" => array("type" => "\Iris\TnOptionGroups"),
80+
"PortOutPasscode" => array("type" => "string")
8081
);
8182

8283

src/simpleModels/TnOptionGroups.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ class TnOptionGroup {
2525
"CallingNameDisplay" => array("type" => "string"),
2626
"Protected" => array("type" => "string"),
2727
"Sms" => array("type" => "string"),
28-
"FinalDestinationURI " => array("type" => "string")
28+
"FinalDestinationURI " => array("type" => "string"),
29+
"PortOutPasscode" => array("type" => "string")
2930
);
3031
public function __construct($data) {
3132
$this->set_data($data);
3233
}
33-
}
34+
}

0 commit comments

Comments
 (0)