# TwitterViewer v0.1.0 - API Reference

## Modules

- [TwitterViewer.Article](TwitterViewer.Article.md): A long-form X article.
- [TwitterViewer.Billing](TwitterViewer.Billing.md): Credits used by one call. 1 credit = 1 post returned. `remaining` is the credits left; a very
large fixed number for unlimited accounts.

- [TwitterViewer.Card](TwitterViewer.Card.md): A link preview card.
- [TwitterViewer.Media](TwitterViewer.Media.md): 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.

- [TwitterViewer.PlanCredits](TwitterViewer.PlanCredits.md): This month's subscription credits.
- [TwitterViewer.Poll](TwitterViewer.Poll.md): A poll attached to a post.
- [TwitterViewer.PollOption](TwitterViewer.PollOption.md): One choice of a poll.
- [TwitterViewer.PurchasedCredits](TwitterViewer.PurchasedCredits.md): Credits that never expire, including the sign-up credits.
- [TwitterViewer.ReplyTarget](TwitterViewer.ReplyTarget.md): The post a reply answers.
- [TwitterViewer.Transport.Httpc](TwitterViewer.Transport.Httpc.md): The default transport, built on Erlang's `:httpc`: no dependencies. HTTPS verifies the
server certificate against the operating system's CA store.

- [TwitterViewer.Tweet](TwitterViewer.Tweet.md): 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.

- [TwitterViewer.User](TwitterViewer.User.md): The full profile of an X account: a `TwitterViewer.UserLite` plus the fields below.
- [TwitterViewer.UserLite](TwitterViewer.UserLite.md): The short form of an X account. `verified_type` is `"blue"`, `"business"`, `"government"` or
`nil`.

- [TwitterViewer.VideoVariant](TwitterViewer.VideoVariant.md): One rendition of a video or GIF.

- Client
  - [TwitterViewer](TwitterViewer.md): Elixir client for the [TwitterViewer API](https://twitterviewer.ai/docs/api): read public X
(Twitter) posts, threads, profiles and replies as JSON, Markdown, text or PDF. All access is
read-only.
  - [TwitterViewer.Client](TwitterViewer.Client.md): 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.

  - [TwitterViewer.Transport](TwitterViewer.Transport.md): How the SDK talks HTTP. A transport is a 5-arity function

- Results
  - [TwitterViewer.ConvertResult](TwitterViewer.ConvertResult.md): A converted post, thread, conversation or profile.
  - [TwitterViewer.CreditBalance](TwitterViewer.CreditBalance.md): Credit balance by source.
  - [TwitterViewer.Document](TwitterViewer.Document.md): A raw response body (Markdown, plain text, PDF or JSON) with the metadata sent in the response
headers.
  - [TwitterViewer.RepliesResult](TwitterViewer.RepliesResult.md): Replies under a post. `posts_returned` is the number of replies; quoted posts are not counted
there but are charged.

- Errors
  - [TwitterViewer.APIError](TwitterViewer.APIError.md): The API answered with a non-2xx status.
  - [TwitterViewer.ConnectionError](TwitterViewer.ConnectionError.md): No response was received: DNS, connection or TLS failure. `:reason` is what the transport
reported.

  - [TwitterViewer.Error](TwitterViewer.Error.md): 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.
  - [TwitterViewer.ErrorCode](TwitterViewer.ErrorCode.md): Every error code the service defines. Compare against `TwitterViewer.APIError.code`.
  - [TwitterViewer.TimeoutError](TwitterViewer.TimeoutError.md): 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.

  - [TwitterViewer.UnexpectedResponseError](TwitterViewer.UnexpectedResponseError.md): A successful status came with a body this library cannot read, which usually means the base
URL is wrong.

