public static Task <WordRetrivalResult> RetriveWordAsync(string word, bool getSampleSentences, CancellationToken cancellationToken)
        {
            if (string.IsNullOrWhiteSpace(word))
            {
                throw new ArgumentNullException(nameof(word));
            }

            Task <WordRetrivalResult> task = new Task <WordRetrivalResult>(() =>
            {
                word = word.Trim();
                string encodedWord = Uri.EscapeDataString(word);
                string url         = $"{MAIN_TARGET}?Word={encodedWord}";
                if (getSampleSentences)
                {
                    url += "&Samples=true";
                }
                else
                {
                    url += "&Samples=false";
                }

                HttpClient client = new HttpClient();
                string response;
                try
                {
                    HttpResponseMessage responseMessage = client.GetAsync(url, cancellationToken).GetAwaiter().GetResult();
                    if (!responseMessage.IsSuccessStatusCode)
                    {
                        throw new Exception("request failed");
                    }
                    response          = responseMessage.Content.ReadAsStringAsync().GetAwaiter().GetResult();
                    WordResult result = WordResult.FromJson(response);
                    return(new WordRetrivalResult(word, result));
                }
                catch (TaskCanceledException)
                {
                    return(new WordRetrivalResult(word, true));
                }
                catch (Exception ex)
                {
                    return(new WordRetrivalResult(word, ex));
                }
                finally
                {
                    client.Dispose();
                }
            }, cancellationToken);

            task.Start();
            return(task);
        }
 internal WordRetrivalResult(string word, WordResult result)
 {
     Result        = result;
     RequestedWord = word;
 }