team-telnyx / telnyx-go
Go SDK for the Telnyx API
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing team-telnyx/telnyx-go in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewTelnyx Go API Library The official Telnyx Go SDK — providing APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, Number Management, and more. Build global communications applications on Telnyx’s private, carrier-grade network with simple Go bindings to the Telnyx REST API. It is generated with Stainless. MCP Server Use the Telnyx MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application. > Note: You may need to set environment variables in your MCP client. Installation Or to pin the version: Requirements This library requires Go 1.22+. Usage The full API of this library can be found in api.md. Request fields The telnyx library uses the semantics from the Go 1.24+ release for request fields. Required primitive fields ( , , etc.) feature the tag \ . These fields are always serialized, even their zero values. Optional primitive types are wrapped in a . These fields can be set with the provided constructors, , , etc. Any , map, slice, struct or string enum uses the tag \ . Its zero value is considered omitted. The function can confirm the presence of any field. To send instead of a , use . To send instead of a struct , use . Request structs contain a method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use with trusted data. To send a custom value instead of a struct, use . Request unions Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized. Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present. Response objects All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special field containing metadata about each property. To handle optional data, use the method on the JSON field. returns true if a field is not , not present, or couldn't be marshaled. If is false, the corresponding field will simply be its zero value. These structs also include an map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK. Response Unions In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the method or the method if present. If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with and feature the tag . RequestOptions This library uses the functional options pattern. Functions defined in the package return a , which is a closure that mutates a . These options can be supplied to the client or at individual requests. For example: The request option may be helpful while debugging. See the full list of request options. Pagination This library provides some conveniences for working with paginated list endpoints. You can use methods to iterate through items across all pages: Or you can use simple methods to fetch a single page and receive a standard response object with additional helper methods like , e.g.: Errors When the API returns a non-success status code, we return an error with type . This contains the , , and values of the request, as well as the JSON of the error body (much like other response objects in the SDK). To handle errors, we recommend that you use the pattern: When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive wrapping . Timeouts Requests do not time out by default; use context to configure a timeout for a request lifecycle. Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use . File uploads Request parameters that correspond to file uploads in multipart requests are typed as . The contents of the will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream". The file name and content-type can be customized by implementing or on the run-time type of . Note that implements , so a file returned by will be sent with the file name on disk. We also provide a helper which can be used to wrap any with the appropriate file name and content type. Retries Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors. You can use the option to configure or disable this: Accessing raw response data (e.g. response headers) You can access the raw HTTP response data by using the request option. This is useful when you need to examine response headers, status codes, or other details. Making custom/undocumented requests This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used. Undocumented endpoints To make requests to undocumented endpoints, you can use , , and other HTTP verbs. on the client, such as retries, will be respected when making these requests. Undocumented request params To make requests using undocumented parameters, you may use either the or the methods. Undocumented response properties To access undocumented response properties, you may either access the raw JSON of the response as a string with , or get the raw JSON of a particular field on the result with . Any fields that are not present on the response struct will be saved and can be accessed by which returns the extra fields as a . Middleware W…