{"id":22358815,"url":"https://github.com/en30/tw","last_synced_at":"2025-06-16T05:04:32.079Z","repository":{"id":42069277,"uuid":"460364161","full_name":"en30/tw","owner":"en30","description":"Twitter API client for elixir.","archived":false,"fork":false,"pushed_at":"2022-04-14T04:18:59.000Z","size":362,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-29T09:23:38.027Z","etag":null,"topics":["elixir","twitter","twitter-api"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/tw","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/en30.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-17T09:24:09.000Z","updated_at":"2022-06-29T12:56:04.000Z","dependencies_parsed_at":"2022-08-12T04:00:49.044Z","dependency_job_id":null,"html_url":"https://github.com/en30/tw","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/en30/tw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en30%2Ftw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en30%2Ftw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en30%2Ftw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en30%2Ftw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/en30","download_url":"https://codeload.github.com/en30/tw/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/en30%2Ftw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260101839,"owners_count":22959039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","twitter","twitter-api"],"created_at":"2024-12-04T15:17:59.164Z","updated_at":"2025-06-16T05:04:32.061Z","avatar_url":"https://github.com/en30.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tw\n\n[![CI](https://github.com/en30/tw/actions/workflows/ci.yml/badge.svg)](https://github.com/en30/tw/actions/workflows/ci.yml)\n\n[Docs](https://hexdocs.pm/tw)\n\n\u003c!-- MDOC !--\u003e\n\nTwitter API Client for elixir.\n\n- depends only on `jason` (optional) and `hackney` (optional).\n  - JSON library and HTTP client are replacable.\n- no implicit state (at least for now)\n\n## Installation\n\nThe package can be installed by adding `tw` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:jason, \"~\u003e 1.2\"},   # only if you choose jason\n    {:hackney, \"~\u003e 1.0\"}, # only if you choose hackney\n    {:tw, \"~\u003e 0.1.2\"}\n  ]\nend\n```\n\n## Examples\n\n### Twitter API v1.1\n\n```elixir\nalias Tw.OAuth.\nalias Tw.V1_1.Client\nalias Tw.V1_1.Tweet\n\ncredentials = OAuth.V1_0a.Credentials.new(\n  consumer_key: \"xxx\",\n  consumer_secret: \"xxx\",\n  access_token: \"xxx\",\n  access_token_secret: \"xxx\",\n)\nclient = Client.new(\n  credentials: credentials,\n)\n{:ok, [%Tweet{} | _]} = Tweet.home_timeline(client, %{count: 10})\n```\n\nThere are functions which wrap API endpoints. They provide functionality below.\n\n- parameter encoding from `Struct`, `List` etc.\n- response decoding into `Struct`.\n- documentation.\n- typespec.\n\nIf the corresponding function is not implemented for your desired endpoint, or if the above is unnecessary/problematic, the `Client` can be used as is.\n\n```elixir\nalias Tw.V1_1.Client\n{:ok, result_map} = Client.request(client, :get, \"/foo/bar.json\", %{param_1: 2})\n```\n\n## HTTP Client is replacable\n\nYou can use whichever HTTP client you want as long as it implements `Tw.HTTP.Client` (inspired by [the greate Goth redesign article](https://dashbit.co/blog/goth-redesign)).\n\n## JSON encoder/decoder is replacable\n\nYou can also switch JSON encode/decoder to another one as long as it implements `Tw.JSON.Serializer`.\n\n\u003c!-- MDOC !--\u003e\n\n## Development\n\n### Generate base code from Twitter v1.1 documentation\n\n```console\n$ elixir bin/codegen.exs endpoint 'GET statuses/home_timeline' home_timeline\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/tw](https://hexdocs.pm/tw).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fen30%2Ftw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fen30%2Ftw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fen30%2Ftw/lists"}