Skip to content

Commit

Permalink
DX-2049 tn lookup api (#29)
Browse files Browse the repository at this point in the history
* DX-2049 tn lookup api

* fixed syntax

* updated to new spec
  • Loading branch information
jmulford-bw authored Jun 22, 2021
1 parent f87a0db commit fcfa931
Show file tree
Hide file tree
Showing 12 changed files with 2,253 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/BandwidthClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public function __construct($config)

private $messaging;
private $twoFactorAuth;
private $phoneNumberLookup;
private $voice;
private $webRtc;

Expand Down Expand Up @@ -49,6 +50,18 @@ public function getTwoFactorAuth()
return $this->twoFactorAuth;
}

/**
* Provides access to PhoneNumberLookup client
* @return PhoneNumberLookup\PhoneNumberLookupClient
*/
public function getPhoneNumberLookup()
{
if ($this->phoneNumberLookup == null) {
$this->phoneNumberLookup = new PhoneNumberLookup\PhoneNumberLookupClient($this->config);
}
return $this->phoneNumberLookup;
}

/**
* Provides access to Voice client
* @return Voice\VoiceClient
Expand Down
38 changes: 38 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ class Configuration
*/
private $twoFactorAuthBasicAuthPassword = 'TODO: Replace';

/**
* The username to use with basic authentication
* @var string
*/
private $phoneNumberLookupBasicAuthUserName = 'TODO: Replace';

/**
* The password to use with basic authentication
* @var string
*/
private $phoneNumberLookupBasicAuthPassword = 'TODO: Replace';

/**
* The username to use with basic authentication
* @var string
Expand Down Expand Up @@ -96,6 +108,12 @@ public function __construct($configOptions = null)
if (isset($configOptions['twoFactorAuthBasicAuthPassword'])) {
$this->twoFactorAuthBasicAuthPassword = $configOptions['twoFactorAuthBasicAuthPassword'];
}
if (isset($configOptions['phoneNumberLookupBasicAuthUserName'])) {
$this->phoneNumberLookupBasicAuthUserName = $configOptions['phoneNumberLookupBasicAuthUserName'];
}
if (isset($configOptions['phoneNumberLookupBasicAuthPassword'])) {
$this->phoneNumberLookupBasicAuthPassword = $configOptions['phoneNumberLookupBasicAuthPassword'];
}
if (isset($configOptions['voiceBasicAuthUserName'])) {
$this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName'];
}
Expand Down Expand Up @@ -135,6 +153,12 @@ public function getConfigurationMap()
if (isset($this->twoFactorAuthBasicAuthPassword)) {
$configMap['twoFactorAuthBasicAuthPassword'] = $this->twoFactorAuthBasicAuthPassword;
}
if (isset($this->phoneNumberLookupBasicAuthUserName)) {
$configMap['phoneNumberLookupBasicAuthUserName'] = $this->phoneNumberLookupBasicAuthUserName;
}
if (isset($this->phoneNumberLookupBasicAuthPassword)) {
$configMap['phoneNumberLookupBasicAuthPassword'] = $this->phoneNumberLookupBasicAuthPassword;
}
if (isset($this->voiceBasicAuthUserName)) {
$configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName;
}
Expand Down Expand Up @@ -187,6 +211,18 @@ public function getTwoFactorAuthBasicAuthPassword()
return $this->twoFactorAuthBasicAuthPassword;
}

// Getter for phoneNumberLookupBasicAuthUserName
public function getPhoneNumberLookupBasicAuthUserName()
{
return $this->phoneNumberLookupBasicAuthUserName;
}

// Getter for phoneNumberLookupBasicAuthPassword
public function getPhoneNumberLookupBasicAuthPassword()
{
return $this->phoneNumberLookupBasicAuthPassword;
}

// Getter for voiceBasicAuthUserName
public function getVoiceBasicAuthUserName()
{
Expand Down Expand Up @@ -248,13 +284,15 @@ public function getBaseUri($server = Servers::DEFAULT_)
Servers::DEFAULT_ => 'api.bandwidth.com',
Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
Servers::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
Servers::PHONENUMBERLOOKUPDEFAULT => 'https://numbers.bandwidth.com/api/v1',
Servers::VOICEDEFAULT => 'https://voice.bandwidth.com',
Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1',
),
Environments::CUSTOM => array(
Servers::DEFAULT_ => '{base_url}',
Servers::MESSAGINGDEFAULT => '{base_url}',
Servers::TWOFACTORAUTHDEFAULT => '{base_url}',
Servers::PHONENUMBERLOOKUPDEFAULT => '{base_url}',
Servers::VOICEDEFAULT => '{base_url}',
Servers::WEBRTCDEFAULT => '{base_url}',
),
Expand Down
Loading

0 comments on commit fcfa931

Please sign in to comment.