Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktheone committed Sep 3, 2021
2 parents ed6415f + 4d65bbe commit be663e3
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,63 @@
Unofficial .NET Core Duolingo (https://www.duolingo.com/) API. Available as a [NuGet package](https://www.nuget.org/packages/DuolingoNET).

### Usage

- Register an account on [Duolingo](https://www.duolingo.com/register).

- Create an instance of the 'Duolingo' class and provide it with either a 'username' or 'email' and 'password'.
- Create an instance of the `Duolingo` class and provide it with either a `username` or `email`, a `password` and a `HttpClient`.

```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var duolingo = new Duolingo("USERNAME, PASSWORD", new System.Net.Http.HttpClient());
```
Note: a valid Duolingo account is needed to get any data from the API. If you signed in with Google you need to switch to a Duolingo account.

- Alternatively, it's possible to simply instantiate a new class and load the username/email and password from a JSON file 'LoginData.json' in the application folder.
### Documentation

```javascript
{
"login": "USERNAME",
"password": "PASSWORD"
}
###### Account
- [Get User Data Raw](#getuserdataraw)
- [Get User Info](#getuserinfo)
#### GetUserDataRaw()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var userData = GetUserDataRaw();
```
Note: a valid account is needed to get any data from Duolingo.
Returns a `User.Root` containing all the raw data for the user, as pulled by the API. Lacks ads and tracking data.
#### GetUserInfo()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var userData = GetUserInfo();
```
Returns a `UserInfo` containing various information on the user.

### Documentation
###### Language
- [GetLearnedSkills](#getlearnedskills)
- [GetKnownWords](#getknownwords)
- [GetLexemeDataAsync](#getlexemedataasync)
- [GetVocabularyAsync](#getvocabularyasync)
#### GetLearnedSkills
- [Get Learned Skills](#getlearnedskills)
- [Get Known Words](#getknownwords)
- [Get Lexeme Data](#getlexemedataasync)
- [Get Vocabulary](#getvocabularyasync)
#### GetLearnedSkills()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var skills = GetLearnedSkills();
```
Returns a `List<User.Skill>` containing all the skills learned (`"learned": True`) by the user.
#### GetKnownWords
Returns a `List<User.Skill>` containing all the skills learned within the active language(`"learned": True`) by the user.
#### GetKnownWords()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var skills = GetKnownWords();
```
Returns a `List<string>` containing all the words known by the user.
#### GetLexemeDataAsync
Returns a `List<string>` containing all the words known within the active language by the user.
#### GetLexemeDataAsync()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var lexeme = GetLexemeDataAsync(lexemeId);
```
Returns a `Lexeme.Root` representing a single word.
Returns a `Task<Lexeme.Root>` representing a single word.
##### Paramaters
string `lexemeId` **required**

-- The id of the word you want to retrieve data for.
#### GetVocabularyAsync
#### GetVocabularyAsync()
```cs
var duolingo = new Duolingo("USERNAME, PASSWORD");
var lexeme = GetVocabularyAsync(lexemeId);
```
Returns a `Vocabulary.Root` representing the user's vocabulary.
Returns a `Task<Vocabulary.Root>` representing the user's vocabulary.

0 comments on commit be663e3

Please sign in to comment.