# duolingo-api-js

> Unofficial Duolingo API for browser, react-native, and nodejs

Latest version **0.0.5** (published 2020-08-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install duolingo-api-js
pnpm add duolingo-api-js
yarn add duolingo-api-js
bun add duolingo-api-js
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2020-08-25 |
| First published | 2020-08-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Andy Spock |
| Maintainers | acspock |
| Keywords | duolingo, duolingo api, duolingo js, duolingo node, duolingo wrapper, duolingo client |

## Links

- npm: https://www.npmjs.com/package/duolingo-api-js
- Repository: https://github.com/acSpock/duolingo-js
- Issues: https://github.com/acSpock/duolingo-js/issues
- npm.io page: https://npm.io/package/duolingo-api-js

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) 0.19.2

## Recent versions

- 0.0.5 (latest) — 2020-08-25
- 0.0.4 — 2020-08-03
- 0.0.3 — 2020-08-02
- 0.0.2 — 2020-08-02
- 0.0.1 — 2020-08-02

## README

# duolingo-js
Unofficial Duolingo API for browser and nodejs. This repo is heavily inspired by the Unofficial Python API found [here](https://github.com/KartikTalwar/Duolingo). Credit to those folks. All http requests to duolingo return promises. Please read the documentation to find out which are and which are not promises.

I just started this wrapper for a side project. I will be updating the README and project  as I go.

Make sure you use "type": "module" in your package.json

## Installation

install with npm

```bash
npm install duolingo-api-js
```

## Usage

```javascript
import Duolingo from "duolingo-api-js";
const duo = new Duolingo({userName:'acspock', password:'password'});

duo.logIn()
    .then((result) => {
        duo.getData()
            .then(data => {
                //use returned data or use userData on duo instance
                console.log(duo.userData)
            })
            .catch(e => {
                //handle error
             });
    })
    .catch();
```
## Documentation
###### Methods
- [Login](#login)
- [Get Data](#get-data)
- [Get Languages](#get-languages)
- [Switch Language](#switch-language)
- [Get User Data](#get-user-data)
- [Get Skills](#get-skills)
- [Get Learned Skills](#get-learned-skills)
- [Get Learned Words](#get-learned-words)
- [Get Related Words](#get-related-words)
- [Get Known Topics](#get-known-topics)
- [Get User Data Keys](#get-user-data-keys)
- [Is Current Language](#current-language)

#### Get User Information
`duo.logIn()`

Logs a user in
```javascript
// Sample Request
duo.logIn()
    .then( data => {
        console.log('data', data);
    })
    .catch();

// Sample Response
 { response: 'OK', username: 'acspock', user_id: '11111' }
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

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