Skip to content

Commit

Permalink
feat!: Merge branch '7.0.0-rc' to main (#771)
Browse files Browse the repository at this point in the history
* chore: release candidate and pre-release setup

* chore: create BaseClient in Base folder (#751)

* fix: Add Cluster test (#755)

* chore: add cluster test

* fix: add test files to Rest folder for testing cluster test

* fix: remove yoyodyne generated code from Rest folder

* docs: updated the year in the license

* chore: add rc installation instructions

* fix: add handcrafted domain files with deprecated message for shortcuts (#756)

* fix: base file name (#757)

* chore: removing Integration test suite

* chore: sync up with main branch (#758)

* Delete tests/Twilio/Unit/TwiML/Voice directory

* chore: delete voiceResponseTest.php

* [Librarian] Regenerated @ 82775d167bff9b55d1399fe288c2934a02411e8c

* Release 7.0.0-rc.1

* fix: support array parameters for Guzzle GETs (#759)

* fix: type hint for $capabilities to PhoneNumberCapabilities (#760)

* fix: capabilities dataType to PhoneNumberCapabilities

* fix: __toString() output bool values

* chore: add Deserialization tests for
PhoneNumberCapabilities

* fix: failing test case

* fix: minor change

* chore: remove code smells (#762)

* chore: remove code smells

* fix: ClusterTest

* chore: remove code smells

* chore: remove code smells

* chore: remove code smells

* [Librarian] Regenerated @ a72b955e51d75514f3c944c81b9db17278cfad69

* [Librarian] Regenerated @ b8981cc124150c7112387152deb5f97fb9a25d66

* chore: add examples for calling common apis (#763)

* chore: add examples for calling common apis

* chore: add Voice tests

* fix: correct className

* fix: correct version (#765)

* test: add clientTest

* version fix

* fix: drop removed APIs (#766)

* fix: drop removed APIs

* fix: revert to assertRegExp()

* fix: correct default values for different data types (#768)

* fix: correct indentation and camelCase version (#767)

Co-authored-by: Twilio <team_interfaces+github@twilio.com>

* fix: test failures for PhpUnit >=10 (#769)

* [Librarian] Regenerated @ 6112a581d3189fe96d26eb29eb9adfdbd1c2ada5

* Release 7.0.0-rc.3

* [Librarian] Regenerated @ 17e62aff1baa8b949ed63e888ff63c1da8945fe5

* Release 7.0.0-rc.4

* chore: update upgrade guilde and contribution summary (#764)

Co-authored-by: chsingh <chsingh@twilio.com>

* chore: remove RC changes from Changes.md and Readme.md

* chore: update changes file

* chore: remove newly added integration tests

* chore: remove .open-generator folders/files

---------

Co-authored-by: Isha Bansal <ishabansal2467@gmail.com>
Co-authored-by: Rohith Prakash <rohithprakashklm@gmail.com>
Co-authored-by: Sam Harrison <sharrison@twilio.com>
Co-authored-by: Isha Bansal <55244783+isha689@users.noreply.github.com>
Co-authored-by: Twilio <team_interfaces+github@twilio.com>
  • Loading branch information
6 people authored Mar 7, 2023
1 parent 08aad5f commit 39c0ec3
Show file tree
Hide file tree
Showing 2,718 changed files with 140,177 additions and 174,133 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ jobs:
if [ -f "coverage.xml" ]; then
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
fi
- name: Run Cluster Test
if: (!github.event.pull_request.head.repo.fork)
env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}}
TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }}
TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }}
TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }}
run: make cluster-test

- name: Install SonarCloud scanner and run analysis
uses: SonarSource/sonarcloud-github-action@master
Expand Down Expand Up @@ -110,4 +119,4 @@ jobs:
SLACK_MSG_AUTHOR: twilio-dx
SLACK_FOOTER: Posted automatically using GitHub Actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: true
MSG_MINIMAL: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ nbproject

# This is used by the documentation generator
venv
**/.openapi-generator*
**/.openapi-generator-ignore*
16 changes: 14 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,20 @@ This code was generated by
"""
```
then it is a generated file and the change will need to be made by us, but
submitting an issue will help us track it and keep you up-to-date. If the file
isn't generated, you can help us out even more by submitting a Pull Request with
submitting an issue will help us track it and keep you up-to-date.

If the file has this header:
```
* This code was generated by
* ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
* | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
* | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
*
```
then this is a generated file,
you can help us out by submitting a Pull Request to the [twilio-oai-generator](https://github.com/twilio/twilio-oai-generator).

If the file isn't generated, you can help us out even more by submitting a Pull Request with
a fix.

**Please see the [Submission Guidelines](#submit) below.**
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ docker-dev-clean:

docker-dev-test:
docker exec -t twilio_php${VERSION} /bin/bash -c 'make all'

cluster-test:
@PATH=vendor/bin:$(PATH) phpunit --filter ClusterTest tests/Twilio/ClusterTest.php
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

_MAJOR version bumps will have upgrade notes posted here._

[2023-03-08] 6.x.x to 7.x.x
---------------------------
Twilio Php Helper Library’s major version 7.0.1 is now available. We ensured that you can upgrade to Php helper Library 7.0.1 version without any breaking changes.
Behind the scenes Php Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages.

To learn more about the Php Helper Library, check out [our docs](https://www.twilio.com/docs/libraries/php).

[2020-04-15] 6.2.x to 6.3.x
---------------------------
### CHANGED - Optional header parameters added to `Authy` endpoints
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@
},
"autoload-dev": {
"psr-4": {
"": "src/Twilio/",
"Twilio\\Tests\\": "tests/Twilio/"
}
},
"config": {
"lock": false
}
}
}
34 changes: 34 additions & 0 deletions example/call.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// The phone number, SIP address, Client identifier or SIM SID that received this call.
// Phone numbers are in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212).
// SIP addresses are formatted as name@company.com.
// Client identifiers are formatted client:name.
// SIM SIDs are formatted as sim:sid
$to = "+XXXXXXXXXX";

// The phone number or client identifier to use as the caller id.
// If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account.
// If the "to" parameter is a phone number, "from" must also be a phone number.
$from = "+XXXXXXXXXX";

// Make a phone call
$call = $client->calls->create(
$to,
$from,
["url" => "https://twilio.com"]
);
print("Call made successfully with sid: ".$call->sid."\n\n");

// Get some calls
$callsList = $client->calls->read([],null,2);
foreach ($callsList as $call) {
print("Call {$call->sid}: {$call->duration} seconds\n");
}
29 changes: 29 additions & 0 deletions example/incomingPhoneNumber.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

function buyNumber(): ?Twilio\Rest\Api\V2010\Account\IncomingPhoneNumberInstance{
// Look up some phone numbers
global $client;

// Specify the [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the country
// from which to read phone numbers, eg: "US"
$numbers = $client->availablePhoneNumbers("XX")->local->read();

// Buy the first phone number
if(!empty($numbers)){
$local = $numbers[0];
return $client->incomingPhoneNumbers->create(["phoneNumber" => $local->phoneNumber]);
}

return null;
}

// Get a number
$number = buyNumber();
print("Twilio purchased phoneNumber: ".$number->phoneNumber."\n");
31 changes: 31 additions & 0 deletions example/message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Specify the phone numbers in [E.164 format](https://www.twilio.com/docs/glossary/what-e164) (e.g., +16175551212)
// This parameter determines the destination phone number for your SMS message. Format this number with a '+' and a country code
$phoneNumber = "+XXXXXXXXXX";

// This must be a Twilio phone number that you own, formatted with a '+' and country code
$twilioPurchasedNumber = "+XXXXXXXXXX";

// Send a text message
$message = $client->messages->create(
$phoneNumber,
[
'from' => $twilioPurchasedNumber,
'body' => "Hey Jenny! Good luck on the bar exam!"
]
);
print("Message sent successfully with sid = " . $message->sid ."\n\n");

// Print the last 10 messages
$messageList = $client->messages->read([],10);
foreach ($messageList as $msg) {
print("ID:: ". $msg->sid . " | " . "From:: " . $msg->from . " | " . "TO:: " . $msg->to . " | " . " Status:: " . $msg->status . " | " . " Body:: ". $msg->body ."\n");
}
14 changes: 14 additions & 0 deletions example/record.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Get last 10 records
$recordList = $client->usage->records->read([], 10);
foreach ($recordList as $record) {
print_r("Record(accountSid=" . $record->accountSid . ", apiVersion=" . $record->apiVersion . ", asOf=" . $record->asOf . ", category=" . $record->category . ", count=" . $record->count . ", countUnit=" . $record->countUnit . ", description=" . $record->description . ", endDate=" . $record->endDate->format("Y-m-d H:i:s") . ", price=" . $record->price . ", priceUnit=" . $record->priceUnit . ", startDate=" . $record->startDate->format("Y-m-d H:i:s") . ", uri=" . $record->uri . ", usage=" . $record->usage . ", usageUnit=" . $record->usageUnit . "\n");
}
27 changes: 27 additions & 0 deletions example/signingKey.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');
require(__DIR__.'/../vendor/autoload.php');
use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Create new Signing Key
$signingKey = $client->api->v2010->newSigningKeys->create();

// Switch to guzzle client as the default client
$guzzleClient = new Client($signingKey->sid, $signingKey->secret, $sid, null, new \Twilio\Http\GuzzleClient(new \GuzzleHttp\Client));

// The phone number you are querying in E.164 or national format.
// If the phone number is provided in national format, please also specify the country in the optional parameter CountryCode.
// Otherwise, CountryCode will default to US.
$number = "+XXXXXXXXXX";

// Make REST API requests
$phone_number = $guzzleClient->lookups->v1->phoneNumbers($number)
->fetch([
"type" => ["carrier"]
]);

print_r($phone_number->carrier);
17 changes: 17 additions & 0 deletions example/trunk.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
require(__DIR__.'/../src/Twilio/autoload.php');

use Twilio\Rest\Client;

$sid = getenv('TWILIO_ACCOUNT_SID');
$token = getenv('TWILIO_AUTH_TOKEN');
$client = new Client($sid, $token);

// Create Trunk
$trunk = $client->trunking->v1->trunks->create(
[
"friendlyName" => "shiny trunk",
"secure" => false
]
);
print("\n".$trunk."\n");
43 changes: 43 additions & 0 deletions example/twiML.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
require(__DIR__ . '/../vendor/autoload.php');

use Twilio\TwiML\VoiceResponse;

// TwiML Say and Play
$say = new \Twilio\TwiML\Voice\Say('Hello World!', [
'voice' => 'woman'
]);

$play = new \Twilio\TwiML\Voice\Play("https://api.twilio.com/cowbell.mp3", [
'loop' => 5
]);

$twiml = new VoiceResponse();
$twiml->append($say);
$twiml->append($play);

print("TwiML Say and Play: \n{$twiml->asXML()}\n");


// Gather, Redirect
$twimlResponse = new VoiceResponse();
$gather = $twimlResponse->gather();
$gather->setNumDigits(10);
$gather->say("Press 1");
$twimlResponse->redirect("https://example.com");
print("TwiML Gather and Redirect: \n{$twimlResponse->asXML()}\n");


// Dial
$twimlResponse = new VoiceResponse();

// A valid phone number formatted with a '+' and a country code (e.g., +16175551212)
$callerID = '+XXXXXXXX';
$dial = $twimlResponse->dial('', [
'callerId' => $callerID,
'action' => 'https:///example.com',
'hangupOnStar' => true,
]);

$dial->conference("My Room", ["beep" => "true"]);
print("TwiML Dial: \n{$twimlResponse->asXML()}\n");
Loading

0 comments on commit 39c0ec3

Please sign in to comment.