Giter Site home page Giter Site logo

tramleit / twitter_api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from robertodoering/twitter_api

0.0 0.0 0.0 494 KB

A Dart wrapper for the Twitter API v1.1

Home Page: https://pub.dev/packages/dart_twitter_api

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%

twitter_api's Introduction

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

twitter_api's People

Contributors

robertodoering avatar codernamedhendrick avatar dre8597 avatar jonjomckay avatar nikolajjsj avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.