搜索插件、代码仓与 APP 分类

GitHub 代码仓robertodoering/twitter_api

twitter_api

Dart 的 Twitter API v1.1 封装

twitter_api 项目封面
星标
62
复刻
26
最近推送(UTC)
2024年11月16日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

A Dart wrapper for the Twitter API v1.1

pub test

This dart package provides a well documented wrapper for the Twitter v1.1 API.

To access the v2 endpoints, check out twitter-api-v2.

Why use this package?

To make the usage as convenient and comfortable as possible, this package provides interfaces for the various endpoints of the Twitter API. Documentation for each request is available as dart docs and each request's parameters can be changed as named parameters.

The various data structures returned by Twitter are parsed into data models in an isolate.

Example usage

example

Twitter API key

Get your Twitter API key here.

Features

Implemented endpoints

The implemented API endpoints are available as methods in the corresponding service. The request parameters can be set through named parameters and the response will be parsed into a data object for maximum convenience.

Find a list of implemented endpoints here.


If an API endpoint is not yet implemented, a request can be made to that endpoint by manually using the TwitterClient from the TwitterApi object.

See Making a custom request to the Twitter API for an example.

Error handling

Requests made by the client can throw the following errors:

  • TimeoutException when a request hasn't returned a response for some time (defaults to 10s, can be changed in the TwitterClient).

  • Response when the received response does not have a 2xx status code. Most responses include additional error information that can be parsed manually from the response's body. Check out the Twitter Developer documentation of the endpoint for possible error responses (Hyperlinked in the dart doc for each endpoint).

  • Other unexpected errors in unlikely events (for example when parsing the response).


For an example of uploading media files to Twitter, see Attaching media to a Tweet.

Development

Contribution

I appreciate any contributions to this package. Any not yet implemented endpoints can be added similarly to the other implementations. Feel free to reach out to me to ask any questions.

Please make sure dartanalyzer doesn't report any problems before opening a pull request.

Miscellaneous
  • To generate json_serializable models
    • dart run build_runner build --delete-conflicting-outputs
Roberto Doering GitHub avatar
GitHub 作者

Roberto Doering ↗

语言Dart

分类

此仓库发布的插件

使用的依赖

依赖清单 9 项

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗