|
5 | 5 | Unofficial .NET Core Duolingo (https://www.duolingo.com/) API. Available as a [NuGet package](https://www.nuget.org/packages/DuolingoNET).
|
6 | 6 |
|
7 | 7 | ### Usage
|
8 |
| - |
9 | 8 | - Register an account on [Duolingo](https://www.duolingo.com/register).
|
10 | 9 |
|
11 |
| -- Create an instance of the 'Duolingo' class and provide it with either a 'username' or 'email' and 'password'. |
| 10 | +- Create an instance of the `Duolingo` class and provide it with either a `username` or `email`, a `password` and a `HttpClient`. |
12 | 11 |
|
13 | 12 | ```cs
|
14 |
| -var duolingo = new Duolingo("USERNAME, PASSWORD"); |
| 13 | +var duolingo = new Duolingo("USERNAME, PASSWORD", new System.Net.Http.HttpClient()); |
15 | 14 | ```
|
| 15 | +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. |
16 | 16 |
|
17 |
| -- 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. |
| 17 | +### Documentation |
18 | 18 |
|
19 |
| -```javascript |
20 |
| -{ |
21 |
| - "login": "USERNAME", |
22 |
| - "password": "PASSWORD" |
23 |
| -} |
| 19 | +###### Account |
| 20 | +- [Get User Data Raw](#getuserdataraw) |
| 21 | +- [Get User Info](#getuserinfo) |
| 22 | +#### GetUserDataRaw() |
| 23 | +```cs |
| 24 | +var duolingo = new Duolingo("USERNAME, PASSWORD"); |
| 25 | +var userData = GetUserDataRaw(); |
24 | 26 | ```
|
25 |
| -Note: a valid account is needed to get any data from Duolingo. |
| 27 | +Returns a `User.Root` containing all the raw data for the user, as pulled by the API. Lacks ads and tracking data. |
| 28 | +#### GetUserInfo() |
| 29 | +```cs |
| 30 | +var duolingo = new Duolingo("USERNAME, PASSWORD"); |
| 31 | +var userData = GetUserInfo(); |
| 32 | +``` |
| 33 | +Returns a `UserInfo` containing various information on the user. |
26 | 34 |
|
27 |
| -### Documentation |
28 | 35 | ###### Language
|
29 |
| -- [GetLearnedSkills](#getlearnedskills) |
30 |
| -- [GetKnownWords](#getknownwords) |
31 |
| -- [GetLexemeDataAsync](#getlexemedataasync) |
32 |
| -- [GetVocabularyAsync](#getvocabularyasync) |
33 |
| -#### GetLearnedSkills |
| 36 | +- [Get Learned Skills](#getlearnedskills) |
| 37 | +- [Get Known Words](#getknownwords) |
| 38 | +- [Get Lexeme Data](#getlexemedataasync) |
| 39 | +- [Get Vocabulary](#getvocabularyasync) |
| 40 | +#### GetLearnedSkills() |
34 | 41 | ```cs
|
35 | 42 | var duolingo = new Duolingo("USERNAME, PASSWORD");
|
36 | 43 | var skills = GetLearnedSkills();
|
37 | 44 | ```
|
38 |
| -Returns a `List<User.Skill>` containing all the skills learned (`"learned": True`) by the user. |
39 |
| -#### GetKnownWords |
| 45 | +Returns a `List<User.Skill>` containing all the skills learned within the active language(`"learned": True`) by the user. |
| 46 | +#### GetKnownWords() |
40 | 47 | ```cs
|
41 | 48 | var duolingo = new Duolingo("USERNAME, PASSWORD");
|
42 | 49 | var skills = GetKnownWords();
|
43 | 50 | ```
|
44 |
| -Returns a `List<string>` containing all the words known by the user. |
45 |
| -#### GetLexemeDataAsync |
| 51 | +Returns a `List<string>` containing all the words known within the active language by the user. |
| 52 | +#### GetLexemeDataAsync() |
46 | 53 | ```cs
|
47 | 54 | var duolingo = new Duolingo("USERNAME, PASSWORD");
|
48 | 55 | var lexeme = GetLexemeDataAsync(lexemeId);
|
49 | 56 | ```
|
50 |
| -Returns a `Lexeme.Root` representing a single word. |
| 57 | +Returns a `Task<Lexeme.Root>` representing a single word. |
51 | 58 | ##### Paramaters
|
52 | 59 | string `lexemeId` **required**
|
53 | 60 |
|
54 | 61 | -- The id of the word you want to retrieve data for.
|
55 |
| -#### GetVocabularyAsync |
| 62 | +#### GetVocabularyAsync() |
56 | 63 | ```cs
|
57 | 64 | var duolingo = new Duolingo("USERNAME, PASSWORD");
|
58 | 65 | var lexeme = GetVocabularyAsync(lexemeId);
|
59 | 66 | ```
|
60 |
| -Returns a `Vocabulary.Root` representing the user's vocabulary. |
| 67 | +Returns a `Task<Vocabulary.Root>` representing the user's vocabulary. |
0 commit comments