Skip to main content

Logging

Enable logging by setting the TELNYX_LOG environment variable to info:
Or to debug for more verbose logging:
Or configure the client manually using the logLevel method:

ProGuard and R8

Although the SDK uses reflection, it is still usable with ProGuard and R8 because telnyx-core is published with a configuration file containing keep rules. ProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.

Jackson

The SDK depends on Jackson for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default. The SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config). If the SDK threw an exception, but you’re certain the version is compatible, then disable the version check using the checkJacksonVersionCompatibility on TelnyxOkHttpClient or TelnyxOkHttpClientAsync.
[!CAUTION] We make no guarantee that the SDK works correctly when the Jackson version check is disabled.
Also note that there are bugs in older Jackson versions that can affect the SDK. We don’t work around all Jackson bugs (example) and expect users to upgrade Jackson for those instead.

Undocumented API functionality

The SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.

Parameters

To set undocumented parameters, call the putAdditionalHeader, putAdditionalQueryParam, or putAdditionalBodyProperty methods on any Params class:
These can be accessed on the built object later using the _additionalHeaders(), _additionalQueryParams(), and _additionalBodyProperties() methods. To set undocumented parameters on nested headers, query params, or body classes, call the putAdditionalProperty method on the nested class:
These properties can be accessed on the nested built object later using the _additionalProperties() method. To set a documented parameter or property to an undocumented or not yet supported value, pass a JsonValue object to its setter:
The most straightforward way to create a JsonValue is using its from(...) method:
Normally a Builder class’s build method will throw IllegalStateException if any required parameter or property is unset. To forcibly omit a required parameter or property, pass JsonMissing:

Response properties

To access undocumented response properties, call the _additionalProperties() method:
To access a property’s raw JSON value, which may be undocumented, call its _ prefixed method:

Response validation

In rare cases, the API may return a response that doesn’t match the expected type. For example, the SDK may expect a property to contain a String, but the API could return something else. By default, the SDK will not throw an exception in this case. It will throw TelnyxInvalidDataException only if you directly access the property. Validating the response is not forwards compatible with new types from the API for existing fields. If you would still prefer to check that the response is completely well-typed upfront, then either call validate():
Or configure the method call to validate the response using the responseValidation method:
Or configure the default for all method calls at the client level:

Proxies

To route requests through a proxy, configure the client using the proxy method:
If the proxy responds with 407 Proxy Authentication Required, supply credentials by also configuring proxyAuthenticator: