internal static TextAnalyticsError ReadTextAnalyticsError(JsonElement element) { string errorCode = default; string message = default; string target = default; TextAnalyticsError innerError = default; foreach (JsonProperty property in element.EnumerateObject()) { if (property.NameEquals("code")) { errorCode = property.Value.GetString(); continue; } if (property.NameEquals("message")) { message = property.Value.GetString(); continue; } if (property.NameEquals("target")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } target = property.Value.GetString(); continue; } if (property.NameEquals("innererror")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } innerError = ReadTextAnalyticsError(property.Value); continue; } } // Return the innermost error, which should be only one level down. return(innerError.ErrorCode == default ? new TextAnalyticsError(errorCode, message, target) : innerError); }
/// <summary> /// Initializes a new instance of <see cref="TextAnalytics.RecognizeLinkedEntitiesResult"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="TextAnalyticsResult.Id"/> property.</param> /// <param name="error">Sets the <see cref="TextAnalyticsResult.Error"/> property.</param> /// <returns>A new instance of <see cref="TextAnalytics.RecognizeLinkedEntitiesResult"/> for mocking purposes.</returns> public static RecognizeLinkedEntitiesResult RecognizeLinkedEntitiesResult(string id, TextAnalyticsError error) { return(new RecognizeLinkedEntitiesResult(id, error)); }
/// <summary> /// Initializes a new instance of <see cref="TextAnalytics.ExtractKeyPhrasesResult"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="TextAnalyticsResult.Id"/> property.</param> /// <param name="error">Sets the <see cref="TextAnalyticsResult.Error"/> property.</param> /// <returns>A new instance of <see cref="TextAnalytics.ExtractKeyPhrasesResult"/> for mocking purposes.</returns> public static ExtractKeyPhrasesResult ExtractKeyPhrasesResult(string id, TextAnalyticsError error) { return(new ExtractKeyPhrasesResult(id, error)); }
/// <summary> /// Initializes a new instance of <see cref="TextAnalytics.DetectLanguageResult"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="TextAnalyticsResult.Id"/> property.</param> /// <param name="error">Sets the <see cref="TextAnalyticsResult.Error"/> property.</param> /// <returns>A new instance of <see cref="TextAnalytics.DetectLanguageResult"/> for mocking purposes.</returns> public static DetectLanguageResult DetectLanguageResult(string id, TextAnalyticsError error) { return(new DetectLanguageResult(id, error)); }
/// <summary> /// Initializes a new instance of <see cref="TextAnalytics.AnalyzeSentimentResult"/> for mocking purposes. /// </summary> /// <param name="id">Sets the <see cref="TextAnalyticsResult.Id"/> property.</param> /// <param name="error">Sets the <see cref="TextAnalyticsResult.Error"/> property.</param> /// <returns>A new instance of <see cref="TextAnalytics.AnalyzeSentimentResult"/> for mocking purposes.</returns> public static AnalyzeSentimentResult AnalyzeSentimentResult(string id, TextAnalyticsError error) { return(new AnalyzeSentimentResult(id, error)); }
internal AnalyzeHealthcareEntitiesResult(string id, TextAnalyticsError error) : base(id, error) { }
internal RecognizePiiEntitiesResult(string id, TextAnalyticsError error) : base(id, error) { }
/// <summary> /// Initializes a new instance of the <see cref="DocumentHealthcareResult"/> class. /// </summary> /// <param name="id"></param> /// <param name="textAnalyticsError"></param> internal DocumentHealthcareResult(string id, TextAnalyticsError textAnalyticsError) { Id = id; TextAnalyticsError = textAnalyticsError; }
internal ExtractKeyPhrasesResult(string id, TextAnalyticsError error) : base(id, error) { }
internal AnalyzeSentimentResult(string id, TextAnalyticsError error) : base(id, error) { }
internal DetectLanguageResult(string id, TextAnalyticsError error) : base(id, error) { }
internal SingleCategoryClassifyResult(string id, TextAnalyticsError error) : base(id, error) { }
internal ExtractSummaryResult(string id, TextAnalyticsError error) : base(id, error) { }