v14 -> v15
HTTP Basic Authentication Removed
HTTP Basic authentication is no longer supported. OAuth2 client credentials are now the only supported authentication method for every API class.
Configuration::setUsername(), getUsername(), setPassword() and getPassword() have been removed. Calling any of them now fails with an error:
Error: Call to undefined method Bandwidth\Configuration::setUsername()
Replace your username and password with an OAuth2 client ID and secret. See Credentials Management for how to obtain them.
- v14
- v15
$config = (new Configuration())
->setUsername('YOUR_USERNAME')
->setPassword('YOUR_PASSWORD');
$config = (new Configuration())
->setClientId('YOUR_CLIENT_ID')
->setClientSecret('YOUR_CLIENT_SECRET');
Postback Data Length Limit Enforced
postback_data is no longer described as Base64. It is now an opaque string with a maximum length of 2048 characters, and the SDK now enforces that limit. This affects the following models:
RbmActionBaseRbmActionDialRbmActionOpenUrlRbmActionViewLocationMultiChannelActionCalendarEventRbmSuggestionResponse
Calling setPostbackData() with a value longer than 2048 characters now throws an InvalidArgumentException. Values passed through the constructor array do not throw, but valid() returns false and listInvalidProperties() reports the length. In v14 these values were accepted by the SDK and rejected by the API.
// Throws InvalidArgumentException in v15
$action = (new RbmActionDial())->setPostbackData(str_repeat('a', 3000));
Boolean Query Parameters Use the API Instance's Configuration
Boolean query parameters are now formatted using the Configuration passed to the API class, instead of the global default configuration. This affects the bwQueued, carrierQueued and limitTotalCount parameters of MessagesApi::listMessages() and its WithHttpInfo and Async variants.
You are only affected if you set the boolean format on the default configuration and pass a different Configuration to MessagesApi. In that case, the query string changes from true/false to 1/0. To keep the previous behavior, call setBooleanFormatForQueryString() on the Configuration you pass to the API class.
- v14
- v15
Configuration::setDefaultConfiguration(
(new Configuration())
->setBooleanFormatForQueryString(Configuration::BOOLEAN_FORMAT_STRING)
);
$config = (new Configuration())
->setClientId('YOUR_CLIENT_ID')
->setClientSecret('YOUR_CLIENT_SECRET');
$api = new MessagesApi(null, $config);
$config = (new Configuration())
->setClientId('YOUR_CLIENT_ID')
->setClientSecret('YOUR_CLIENT_SECRET')
->setBooleanFormatForQueryString(Configuration::BOOLEAN_FORMAT_STRING);
$api = new MessagesApi(null, $config);
API Key Setters Accept Null
Configuration::setApiKey() and setApiKeyPrefix() now accept null, which removes the key or prefix for that identifier. Code that calls these methods is unaffected.
If you subclass Configuration and override either method, update the parameter type to ?string. Otherwise, PHP will raise a fatal error because an override cannot narrow a parameter type.
- v14
- v15
public function setApiKey(string $apiKeyIdentifier, string $key): static
public function setApiKey(string $apiKeyIdentifier, ?string $key): static