API Reference TwitterViewer v#0.1.0

Copy Markdown View Source

Modules

Elixir client for the TwitterViewer API: read public X (Twitter) posts, threads, profiles and replies as JSON, Markdown, text or PDF. All access is read-only.

The API answered with a non-2xx status.

A long-form X article.

Credits used by one call. 1 credit = 1 post returned. remaining is the credits left; a very large fixed number for unlimited accounts.

A link preview card.

A configured client. Build it with TwitterViewer.new/1; its fields are not part of the public API. A client is a plain value: share it freely between processes. inspect/1 never shows the API key.

No response was received: DNS, connection or TLS failure. :reason is what the transport reported.

A converted post, thread, conversation or profile.

Credit balance by source.

A raw response body (Markdown, plain text, PDF or JSON) with the metadata sent in the response headers.

The errors a call can return as {:error, error}: TwitterViewer.APIError, TwitterViewer.ConnectionError, TwitterViewer.TimeoutError and TwitterViewer.UnexpectedResponseError. All are exceptions, so raise error works.

Every error code the service defines. Compare against TwitterViewer.APIError.code.

A photo, video or GIF attached to a post. kind is "photo", "video" or "gif"; url is the photo address, or the cover image of a video or GIF.

This month's subscription credits.

A poll attached to a post.

One choice of a poll.

Credits that never expire, including the sign-up credits.

Replies under a post. posts_returned is the number of replies; quoted posts are not counted there but are charged.

The post a reply answers.

The request ran longer than the client's :timeout. Like TwitterViewer.ConnectionError, it means no response was received; TwitterViewer.Error.connection?/1 is true for both.

How the SDK talks HTTP. A transport is a 5-arity function

The default transport, built on Erlang's :httpc: no dependencies. HTTPS verifies the server certificate against the operating system's CA store.

A post on X. author and reposted_by are a TwitterViewer.UserLite, or a TwitterViewer.User when the object carries the full profile. article, poll, card, community_note and sensitive are nil when the API leaves them out.

A successful status came with a body this library cannot read, which usually means the base URL is wrong.

The full profile of an X account: a TwitterViewer.UserLite plus the fields below.

The short form of an X account. verified_type is "blue", "business", "government" or nil.

One rendition of a video or GIF.