Skip to main content

Pagination

List methods in the Telnyx API are paginated. This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:
Alternatively, you can use the #next_page? and #next_page methods for more granular control working with pages.

File uploads

Request parameters that correspond to file uploads can be passed as raw contents, a Pathname instance, StringIO, or more.
Note that you can also pass a raw IO descriptor, but this disables retries, as the library can’t be sure if the descriptor is a file or pipe (which cannot be rewound).

BaseModel

All parameter and response objects inherit from Telnyx::Internal::Type::BaseModel, which provides several conveniences, including:
  1. All fields, including unknown ones, are accessible with obj[:prop] syntax, and can be destructured with obj => {prop: prop} or pattern-matching syntax.
  2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.
  3. Both instances and the classes themselves can be pretty-printed.
  4. Helpers such as #to_h, #deep_to_h, #to_json, and #to_yaml.

Sorbet

This library provides comprehensive RBI definitions, and has no dependency on sorbet-runtime. You can provide typesafe request parameters like so:
Or, equivalently:

Enums

Since this library does not depend on sorbet-runtime, it cannot provide T::Enum instances. Instead, we provide “tagged symbols” instead, which is always a primitive at runtime:
Enum parameters have a “relaxed” type, so you can either pass in enum constants or their literal value: