BuildIt.CognitiveServices.CognitiveServiceClient.SpellCheckApiRequestAsync C# (CSharp) Метод

SpellCheckApiRequestAsync() публичный Метод

Bing Spell Check API
public SpellCheckApiRequestAsync ( SpellCheckParameters spellCheckParameters ) : Task>
spellCheckParameters BuildIt.CognitiveServices.Models.Feeds.InputParameters.SpellCheckParameters
Результат Task>
        public async Task<ResultDto<SpellCheckApiFeeds>> SpellCheckApiRequestAsync(
            SpellCheckParameters spellCheckParameters)
        {
            var resultDto = new ResultDto<SpellCheckApiFeeds>();
            try
            {
                var client = new HttpClient();
                // Request headers
                client.DefaultRequestHeaders.Add(Constants.SubscriptionTitle, spellCheckParameters.subscriptionKey);

                // Request parameters
                var queryString =
                    $"text={spellCheckParameters.content}&mode={spellCheckParameters.mode}&mkt={spellCheckParameters.mkt}";
                var url = Constants.SpellCheckApi + queryString;

                var jsonResult = await client.GetStringAsync(url);
                var feed = JsonConvert.DeserializeObject<SpellCheckApiFeeds>(jsonResult);
                resultDto.Result = feed;
                resultDto.ErrorMessage = feed.message;
                resultDto.StatusCode = feed.statusCode.ToString();
                resultDto.Success = string.IsNullOrEmpty(feed.message);
            }
            catch (Exception ex)
            {
                resultDto.ErrorMessage = ex.Message;
                resultDto.Exception = ex;
                Debug.WriteLine($"Error: {ex}");
            }
            return resultDto;
        }