# twitter-api-ts

> TypScript compatible Twitter API client.

Latest version **0.0.33** (published 2018-08-11) · 0 weekly downloads

## Install

```sh
npm install twitter-api-ts
pnpm add twitter-api-ts
yarn add twitter-api-ts
bun add twitter-api-ts
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.33 |
| Published | 2018-08-11 |
| First published | 2017-05-19 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 41.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | oliverjash |

## Links

- npm: https://www.npmjs.com/package/twitter-api-ts
- npm.io page: https://npm.io/package/twitter-api-ts

## Dependencies (7)

- [qs](https://npm.io/package/qs.md) ^6.5.1
- [fp-ts](https://npm.io/package/fp-ts.md) ^1.7.1
- [io-ts](https://npm.io/package/io-ts.md) ^1.3.0
- [unionize](https://npm.io/package/unionize.md) ^1.0.0
- [decode-ts](https://npm.io/package/decode-ts.md) ^0.0.13
- [node-fetch](https://npm.io/package/node-fetch.md) ^1.7.1
- [oauth-authorization-header](https://npm.io/package/oauth-authorization-header.md) ^0.0.7

## Recent versions

- 0.0.33 (latest) — 2018-08-11
- 0.0.32 — 2018-08-11
- 0.0.31 — 2018-08-11
- 0.0.30 — 2018-08-11
- 0.0.29 — 2018-06-02
- 0.0.28 — 2018-02-18
- 0.0.27 — 2018-02-18
- 0.0.26 — 2018-02-18
- 0.0.25 — 2018-02-18
- 0.0.24 — 2018-02-18
- 0.0.23 — 2018-02-17
- 0.0.22 — 2017-11-12
- 0.0.21 — 2017-11-12
- 0.0.20 — 2017-11-12
- 0.0.19 — 2017-11-10
- … 18 more at https://npm.io/package/twitter-api-ts/versions

## README

# 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`, and `Option` 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

``` ts
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
```

[io-ts]: https://github.com/gcanti/io-ts
[fp-ts]: https://github.com/gcanti/fp-ts

---
_Source: https://npm.io/package/twitter-api-ts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
