0.0.33 • Published 6 years ago
twitter-api-ts v0.0.33
twitter-api-ts
TypScript compatible Twitter API client.
- io-ts is used to perform IO validation for type safety.
- fp-ts is used for its
Task
,Either
, andOption
types. - Request functions return types of
type Response<T> = either.Either<ErrorResponse, T>
.
This library is written in TypeScript and is published in JavaScript with type declaration files.
Installation
yarn add twitter-api-ts
Example
import { fetchHomeTimeline } from 'twitter-api-ts';
import * as option from 'fp-ts/lib/Option';
const CONSUMER_KEY = 'YOUR_CONSUMER_KEY';
const CONSUMER_SECRET = 'YOUR_CONSUMER_SECRET';
const TOKEN = 'YOUR_TOKEN';
const TOKEN_SECRET = 'YOUR_TOKEN_SECRET';
fetchHomeTimeline({
oAuth: {
consumerKey: CONSUMER_KEY,
consumerSecret: CONSUMER_SECRET,
token: option.some(TOKEN),
tokenSecret: option.some(TOKEN_SECRET),
},
query: {
count: option.some(50),
},
})
// We use fp-ts’ Task type, which is lazy. Running the task returns a
// promise.
.run()
.then(response => {
console.log(response);
// => Either<ErrorResponse, TwitterAPITimelineResponseT>
});
Development
yarn
yarn compile
yarn lint
0.0.33
6 years ago
0.0.32
6 years ago
0.0.31
6 years ago
0.0.30
6 years ago
0.0.29
6 years ago
0.0.28
6 years ago
0.0.27
6 years ago
0.0.26
6 years ago
0.0.25
6 years ago
0.0.24
6 years ago
0.0.23
6 years ago
0.0.22
6 years ago
0.0.21
6 years ago
0.0.20
6 years ago
0.0.19
7 years ago
0.0.18
7 years ago
0.0.17
7 years ago
0.0.16
7 years ago
0.0.15
7 years ago
0.0.14
7 years ago
0.0.13
7 years ago
0.0.12
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago