Skip to content

Commit fcfa931

Browse files
authored
DX-2049 tn lookup api (#29)
* DX-2049 tn lookup api * fixed syntax * updated to new spec
1 parent f87a0db commit fcfa931

File tree

12 files changed

+2253
-3
lines changed

12 files changed

+2253
-3
lines changed

src/BandwidthClient.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public function __construct($config)
2222

2323
private $messaging;
2424
private $twoFactorAuth;
25+
private $phoneNumberLookup;
2526
private $voice;
2627
private $webRtc;
2728

@@ -49,6 +50,18 @@ public function getTwoFactorAuth()
4950
return $this->twoFactorAuth;
5051
}
5152

53+
/**
54+
* Provides access to PhoneNumberLookup client
55+
* @return PhoneNumberLookup\PhoneNumberLookupClient
56+
*/
57+
public function getPhoneNumberLookup()
58+
{
59+
if ($this->phoneNumberLookup == null) {
60+
$this->phoneNumberLookup = new PhoneNumberLookup\PhoneNumberLookupClient($this->config);
61+
}
62+
return $this->phoneNumberLookup;
63+
}
64+
5265
/**
5366
* Provides access to Voice client
5467
* @return Voice\VoiceClient

src/Configuration.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ class Configuration
4343
*/
4444
private $twoFactorAuthBasicAuthPassword = 'TODO: Replace';
4545

46+
/**
47+
* The username to use with basic authentication
48+
* @var string
49+
*/
50+
private $phoneNumberLookupBasicAuthUserName = 'TODO: Replace';
51+
52+
/**
53+
* The password to use with basic authentication
54+
* @var string
55+
*/
56+
private $phoneNumberLookupBasicAuthPassword = 'TODO: Replace';
57+
4658
/**
4759
* The username to use with basic authentication
4860
* @var string
@@ -96,6 +108,12 @@ public function __construct($configOptions = null)
96108
if (isset($configOptions['twoFactorAuthBasicAuthPassword'])) {
97109
$this->twoFactorAuthBasicAuthPassword = $configOptions['twoFactorAuthBasicAuthPassword'];
98110
}
111+
if (isset($configOptions['phoneNumberLookupBasicAuthUserName'])) {
112+
$this->phoneNumberLookupBasicAuthUserName = $configOptions['phoneNumberLookupBasicAuthUserName'];
113+
}
114+
if (isset($configOptions['phoneNumberLookupBasicAuthPassword'])) {
115+
$this->phoneNumberLookupBasicAuthPassword = $configOptions['phoneNumberLookupBasicAuthPassword'];
116+
}
99117
if (isset($configOptions['voiceBasicAuthUserName'])) {
100118
$this->voiceBasicAuthUserName = $configOptions['voiceBasicAuthUserName'];
101119
}
@@ -135,6 +153,12 @@ public function getConfigurationMap()
135153
if (isset($this->twoFactorAuthBasicAuthPassword)) {
136154
$configMap['twoFactorAuthBasicAuthPassword'] = $this->twoFactorAuthBasicAuthPassword;
137155
}
156+
if (isset($this->phoneNumberLookupBasicAuthUserName)) {
157+
$configMap['phoneNumberLookupBasicAuthUserName'] = $this->phoneNumberLookupBasicAuthUserName;
158+
}
159+
if (isset($this->phoneNumberLookupBasicAuthPassword)) {
160+
$configMap['phoneNumberLookupBasicAuthPassword'] = $this->phoneNumberLookupBasicAuthPassword;
161+
}
138162
if (isset($this->voiceBasicAuthUserName)) {
139163
$configMap['voiceBasicAuthUserName'] = $this->voiceBasicAuthUserName;
140164
}
@@ -187,6 +211,18 @@ public function getTwoFactorAuthBasicAuthPassword()
187211
return $this->twoFactorAuthBasicAuthPassword;
188212
}
189213

214+
// Getter for phoneNumberLookupBasicAuthUserName
215+
public function getPhoneNumberLookupBasicAuthUserName()
216+
{
217+
return $this->phoneNumberLookupBasicAuthUserName;
218+
}
219+
220+
// Getter for phoneNumberLookupBasicAuthPassword
221+
public function getPhoneNumberLookupBasicAuthPassword()
222+
{
223+
return $this->phoneNumberLookupBasicAuthPassword;
224+
}
225+
190226
// Getter for voiceBasicAuthUserName
191227
public function getVoiceBasicAuthUserName()
192228
{
@@ -248,13 +284,15 @@ public function getBaseUri($server = Servers::DEFAULT_)
248284
Servers::DEFAULT_ => 'api.bandwidth.com',
249285
Servers::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
250286
Servers::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1',
287+
Servers::PHONENUMBERLOOKUPDEFAULT => 'https://numbers.bandwidth.com/api/v1',
251288
Servers::VOICEDEFAULT => 'https://voice.bandwidth.com',
252289
Servers::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1',
253290
),
254291
Environments::CUSTOM => array(
255292
Servers::DEFAULT_ => '{base_url}',
256293
Servers::MESSAGINGDEFAULT => '{base_url}',
257294
Servers::TWOFACTORAUTHDEFAULT => '{base_url}',
295+
Servers::PHONENUMBERLOOKUPDEFAULT => '{base_url}',
258296
Servers::VOICEDEFAULT => '{base_url}',
259297
Servers::WEBRTCDEFAULT => '{base_url}',
260298
),

0 commit comments

Comments
 (0)