From b5b51ce3a86953b5b8a048f28464a8100f568df0 Mon Sep 17 00:00:00 2001 From: josago97 Date: Thu, 27 Jul 2023 19:03:30 +0200 Subject: [PATCH] Changed name of method FetchWordsAsync. Update Readme. Change version to v1.1.1. --- RAE.Demo/Program.cs | 22 +++----- RAE.Tests/DRAE.cs | 8 +-- RAE/DRAE.cs | 2 +- RAE/RAE.csproj | 2 +- README.md | 123 +++++++++++++++++++++++++++++++++++++++----- 5 files changed, 122 insertions(+), 35 deletions(-) diff --git a/RAE.Demo/Program.cs b/RAE.Demo/Program.cs index d4444e5..3704370 100644 --- a/RAE.Demo/Program.cs +++ b/RAE.Demo/Program.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using RAE.Models; namespace RAE.Demo { @@ -12,11 +10,10 @@ class Program static Func[] functions = { - FetchWordsAsync, + FetchWordAsync, GetKeysAsync, SearchWordAsync, - WordOfTheDayAsync, - FetchRandomWorldAsync, + GetWordOfTheDayAsync, GetRandomWorldAsync, GetWordsStartWithAsync, GetWordsContainAsync, @@ -39,13 +36,13 @@ static async Task Main() Console.ReadLine(); } - static async Task FetchWordsAsync() + static async Task FetchWordAsync() { string[] wordsToFetch = { "y", "tonto", "niño", "en", "manada" }; foreach (string wordToFetch in wordsToFetch) { - IList words = await drae.FetchWordsAsync(wordToFetch); + IList words = await drae.FetchWordAsync(wordToFetch); foreach (IWord word in words) { @@ -58,7 +55,7 @@ static async Task FetchWordsAsync() static async Task GetKeysAsync() { - string query = "w"; + string query = "hola"; string[] keys = await drae.GetKeysAsync(query); Console.WriteLine($"GetKeys ({query}): {string.Join(", ", keys)}"); @@ -72,7 +69,7 @@ static async Task SearchWordAsync() Console.WriteLine($"SearchWord ({query}): {string.Join(", ", entries)}"); } - static async Task WordOfTheDayAsync() + static async Task GetWordOfTheDayAsync() { IEntry word = await drae.GetWordOfTheDayAsync(); @@ -86,13 +83,6 @@ static async Task GetRandomWorldAsync() Console.WriteLine($"A random word: {word}"); } - static async Task FetchRandomWorldAsync() - { - IWord word = await drae.GetRandomWordAsync(); - - Console.WriteLine(word); - } - static async Task GetWordsStartWithAsync() { string character = "A"; diff --git a/RAE.Tests/DRAE.cs b/RAE.Tests/DRAE.cs index 1fc2e9b..bca4ca1 100644 --- a/RAE.Tests/DRAE.cs +++ b/RAE.Tests/DRAE.cs @@ -12,9 +12,9 @@ public class DRAE [InlineData("niño")] [InlineData("tonto")] [InlineData("y")] - public async Task FetchWordsExist(string word) + public async Task FetchWordExist(string word) { - IList words = await Drae.FetchWordsAsync(word); + IList words = await Drae.FetchWordAsync(word); Assert.NotNull(words); Assert.NotEmpty(words); @@ -22,9 +22,9 @@ public async Task FetchWordsExist(string word) [Theory] [InlineData("asdadasdada")] - public async Task FetchWordsNoExist(string word) + public async Task FetchWordNoExist(string word) { - IList words = await Drae.FetchWordsAsync(word); + IList words = await Drae.FetchWordAsync(word); Assert.NotNull(words); Assert.Empty(words); diff --git a/RAE/DRAE.cs b/RAE/DRAE.cs index 87912d3..c160ca7 100644 --- a/RAE/DRAE.cs +++ b/RAE/DRAE.cs @@ -24,7 +24,7 @@ public DRAE() /// The word to search. /// La palabra a buscar. /// - public async Task FetchWordsAsync(string word) + public async Task FetchWordAsync(string word) { IEntry[] entries = await _raeAPI.SearchWordAsync(word, true); List result = new List(entries.Length); diff --git a/RAE/RAE.csproj b/RAE/RAE.csproj index ecead02..628e7b0 100644 --- a/RAE/RAE.csproj +++ b/RAE/RAE.csproj @@ -11,7 +11,7 @@ MIT https://github.com/josago97/RAE.NET RAE, Diccionario, España, Español, Lengua, Dictionary, Spain, Spanish, Language - 1.1.0 + 1.1.1 diff --git a/README.md b/README.md index a9f164c..c30eecb 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,117 @@ [![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/josago97/RAE.NET/blob/master/LICENSE) [![NuGet version (RAE.NET)](https://img.shields.io/nuget/v/RAE.NET.svg)](https://www.nuget.org/packages/RAE.NET/) [![Downloads](https://img.shields.io/nuget/dt/RAE.NET.svg)](https://www.nuget.org/packages/RAE.NET/) -**[Español]** (English below) - Esta es una biblioteca no oficial que te permite: -- Buscar palabras clave. -- Obtener definiciones de palabras. -- Obtener la palabra del día. -- Obtener palabras aleatorias. +
+This is an unofficial library that allows you to: ---------------------------------------- -**[English]** +- Obtener definiciones de una palabra. +
+Get definitions of a word. -This is an unofficial library that allows you to: -- Search for keywords. -- Get definitions of words. -- Get random words. -- Get the word of the day. +```cs +DRAE drae = new DRAE(); +IWord[] words = await drae.FetchWordAsync("casa"); + +foreach (IWord word in words) +{ + Console.WriteLine(word); +} +``` +
+ +Obtener definiciones de una palabra por identificador. +
+Get definitions of a word by id. + +```cs +DRAE drae = new DRAE(); +IWord word = await drae.FetchWordByIdAsync("7lsKMtR"); + +Console.WriteLine(word); +``` +
+ +Obtener la palabra del día. +
+Get the word of the day. + +```cs +DRAE drae = new DRAE(); +IEntry entry = await drae.GetWordOfTheDayAsync(); + +Console.WriteLine(entry); +``` +
+ +Obtener una palabra aleatoria. +
+Get a random word. + +```cs +DRAE drae = new DRAE(); +IWord word = await drae.GetRandomWordAsync(); + +Console.WriteLine(word); +``` +
+ +Buscar las entradas de una palabra. +
+Search the entries of a word. + +```cs +DRAE drae = new DRAE(); +IEntry[] entries = await drae.SearchWordAsync("y"); + +Console.WriteLine(string.Join(", ", entries)); +``` +
+ +Buscar palabras clave. +
+Search for keywords. + +```cs +DRAE drae = new DRAE(); +string[] keys = await drae.GetKeysAsync("hola"); + +Console.WriteLine(string.Join(", ", keys)); +``` +
+ +Obtener todas las palabras que comienzan con una cadena. +
+Get all words that start with a string. + +```cs +DRAE drae = new DRAE(); +string[] words = await drae.GetWordsStartWithAsync("sa"); + +Console.WriteLine(string.Join(", ", words)); +``` +
+ +Obtener todas las palabras que continenen una cadena. +
+Get all words that contain a string. + +```cs +DRAE drae = new DRAE(); +string[] words = await drae.GetWordsContainAsync("sa"); + +Console.WriteLine(string.Join(", ", words)); +``` +
+ +Obtener todas las palabras del diccionario. +
+Get all word of the dictionary. + +```cs +DRAE drae = new DRAE(); +string[] allWords = await drae.GetAllWordsAsync(); + +Console.WriteLine(string.Join(", ", allWords)); +```