<commit_before><?php

ini_set('display_errors', 'On');
error_reporting(E_ALL);

require_once('vendor/autoload.php');
foreach (glob('src/*.php') as $filename){require_once $filename;}
foreach (glob('src/Controllers/*.php') as $filename){require_once $filename;}
foreach (glob('src/Models/*.php') as $filename){require_once $filename;}

use FlowrouteNumbersLib\Controllers\InboundRoutesController;
use FlowrouteNumbersLib\Controllers\PurchasablePhoneNumbersController;
use FlowrouteNumbersLib\Controllers\TelephoneNumbersController;
use FlowrouteNumbersLib\APIException;
use FlowrouteNumbersLib\Models\BillingMethod;

print "Number Control Demo." . PHP_EOL;

//--- Purchasable Phone Numbers
// Create our controller
$pnc = new PurchasablePhoneNumbersController();

// Retrieve Available NPAs
print("--Retrieve Available NPAs\n");
$response = $pnc->listAvailableNPAs(10);
print_r($response);

// Retrieve Available NPA NXXs
print("--Retrieve Available NPA NXXs\n");
$response = $pnc->listAreaAndExchange();
print_r($response);

// Search for purchasable Numbers
print("--Search for numbers in Seattle Washington\n");
$response = $pnc->search(10,206,641,null,'seattle','wa',null);
print_r($response);


//--- Telephone Numbers
// Create our controller
$tnc = new TelephoneNumbersController();

// Purchase a Phone Number
print("--Purchase a Phone Number\n");
$billing = new BillingMethod('METERED');

$number = '12066417661';

try {
    $response = $tnc->purchase($billing, $number);
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

// List Account Phone Numbers
print("--List Account Phone Numbers\n");
try {
    $response = $tnc->listAccountTelephoneNumbers();
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

// Retrieve Phone Number Details
print("--Retrieve Number Details\n");
try {
    $response = $tnc->telephoneNumberDetails($number);
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}


//--- Inbound Routes
// Create our controller
$inbound = new InboundRoutesController();

// Retrieve Routes
print("--Retrieve Inbound Routes\n");
$response = $inbound->mlist();
print_r($response);

<commit_msg>Add create inbound route and update routes functions to demo.php<commit_after><?php

ini_set('display_errors', 'On');
error_reporting(E_ALL);

require_once('vendor/autoload.php');
foreach (glob('src/*.php') as $filename){require_once $filename;}
foreach (glob('src/Controllers/*.php') as $filename){require_once $filename;}
foreach (glob('src/Models/*.php') as $filename){require_once $filename;}

use FlowrouteNumbersLib\Controllers\InboundRoutesController;
use FlowrouteNumbersLib\Controllers\PurchasablePhoneNumbersController;
use FlowrouteNumbersLib\Controllers\TelephoneNumbersController;
use FlowrouteNumbersLib\APIException;
use FlowrouteNumbersLib\Models\BillingMethod;

print "Number Control Demo." . PHP_EOL;

//--- Purchasable Phone Numbers
// Create our controller
$pnc = new PurchasablePhoneNumbersController();

// Retrieve Available NPAs
print("--Retrieve Available NPAs\n");
$response = $pnc->listAvailableNPAs(10);
print_r($response);

// Retrieve Available NPA NXXs
print("--Retrieve Available NPA NXXs\n");
$response = $pnc->listAreaAndExchange();
print_r($response);

// Search for purchasable Numbers
print("--Search for numbers in Seattle Washington\n");
$response = $pnc->search(10,206,641,null,'seattle','wa',null);
print_r($response);


//--- Telephone Numbers
// Create our controller
$tnc = new TelephoneNumbersController();

// Purchase a Phone Number
print("--Purchase a Phone Number\n");
$billing = new BillingMethod('METERED');

$number = '12066417661';

try {
    $response = $tnc->purchase($billing, $number);
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

// List Account Phone Numbers
print("--List Account Phone Numbers\n");
try {
    $response = $tnc->listAccountTelephoneNumbers();
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

// Retrieve Phone Number Details
print("--Retrieve Number Details\n");
try {
    $response = $tnc->telephoneNumberDetails($number);
    print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}


//--- Inbound Routes
// Create our controller
$inbound = new InboundRoutesController();

// Retrieve Routes
print("--Retrieve Inbound Routes\n");
try {
	$response = $inbound->mlist();
	print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

// Create Route
print("--Create New Inbound Route\n");
try {
	$routename = 'PSTNroute1';
	$routetype = 'PSTN';
	$routevalue = '12065551212';
	$response = $inbound->createNewRoute($routename, $routetype, $routevalue);
	print_r("New Inbound Route Successfully Created\n");
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}

//update routes
print("--Update TN's Primary and Failover Route\n");
try {
	$rtes = '{"routes": [{"name": "PSTNroute1"}, {"name": "PSTNroute1"}]}';
	$tn = "19515551212"; 
	$response = $tnc->update($tn, $rtes);
	print_r($response);
} catch(APIException $e) {
    print("Error - " . strval($e->getResponseCode()) . ' ' . $e->getMessage() . PHP_EOL);
}





{'fraction_non_alphanumeric': 0.17319515194098015, 'fraction_numerical': 0.011768838924995608, 'mean_word_length': 5.031779661016949, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '429126', 'n_tokens_mistral': 1944, 'n_tokens_neox': 1867, 'n_words': 391}