< Summary

Class:Azure.Search.Documents.Indexes.Models.WebApiSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\WebApiSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\WebApiSkill.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\WebApiSkill.cs
Covered lines:0
Uncovered lines:139
Coverable lines:139
Total lines:297
Line coverage:0% (0 of 139)
Covered branches:0
Total branches:70
Branch coverage:0% (0 of 70)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_Uri()-0%100%
get_HttpMethod()-0%100%
get_Timeout()-0%100%
get_BatchSize()-0%100%
get_DegreeOfParallelism()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeWebApiSkill(...)-0%0%
get_HttpHeaders()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\WebApiSkill.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call your cus
 15    public partial class WebApiSkill : SearchIndexerSkill
 16    {
 17        /// <summary> Initializes a new instance of WebApiSkill. </summary>
 18        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 19        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 20        /// <param name="uri"> The url for the Web API. </param>
 21        /// <exception cref="ArgumentNullException"> <paramref name="inputs"/>, <paramref name="outputs"/>, or <paramref
 022        public WebApiSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> outputs, str
 23        {
 024            if (inputs == null)
 25            {
 026                throw new ArgumentNullException(nameof(inputs));
 27            }
 028            if (outputs == null)
 29            {
 030                throw new ArgumentNullException(nameof(outputs));
 31            }
 032            if (uri == null)
 33            {
 034                throw new ArgumentNullException(nameof(uri));
 35            }
 36
 037            Uri = uri;
 038            HttpHeaders = new ChangeTrackingDictionary<string, string>();
 039            ODataType = "#Microsoft.Skills.Custom.WebApiSkill";
 040        }
 41
 42        /// <summary> Initializes a new instance of WebApiSkill. </summary>
 43        /// <param name="oDataType"> Identifies the concrete type of the skill. </param>
 44        /// <param name="name"> The name of the skill which uniquely identifies it within the skillset. A skill with no 
 45        /// <param name="description"> The description of the skill which describes the inputs, outputs, and usage of th
 46        /// <param name="context"> Represents the level at which operations take place, such as the document root or doc
 47        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 48        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 49        /// <param name="uri"> The url for the Web API. </param>
 50        /// <param name="httpHeaders"> The headers required to make the http request. </param>
 51        /// <param name="httpMethod"> The method for the http request. </param>
 52        /// <param name="timeout"> The desired timeout for the request. Default is 30 seconds. </param>
 53        /// <param name="batchSize"> The desired batch size which indicates number of documents. </param>
 54        /// <param name="degreeOfParallelism"> If set, the number of parallel calls that can be made to the Web API. </p
 055        internal WebApiSkill(string oDataType, string name, string description, string context, IList<InputFieldMappingE
 56        {
 057            Uri = uri;
 058            HttpHeaders = httpHeaders;
 059            HttpMethod = httpMethod;
 060            Timeout = timeout;
 061            BatchSize = batchSize;
 062            DegreeOfParallelism = degreeOfParallelism;
 063            ODataType = oDataType ?? "#Microsoft.Skills.Custom.WebApiSkill";
 064        }
 65
 66        /// <summary> The url for the Web API. </summary>
 067        public string Uri { get; set; }
 68        /// <summary> The method for the http request. </summary>
 069        public string HttpMethod { get; set; }
 70        /// <summary> The desired timeout for the request. Default is 30 seconds. </summary>
 071        public TimeSpan? Timeout { get; set; }
 72        /// <summary> The desired batch size which indicates number of documents. </summary>
 073        public int? BatchSize { get; set; }
 74        /// <summary> If set, the number of parallel calls that can be made to the Web API. </summary>
 075        public int? DegreeOfParallelism { get; set; }
 76    }
 77}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\WebApiSkill.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Collections.Generic;
 10using System.Text.Json;
 11using Azure.Core;
 12
 13namespace Azure.Search.Documents.Indexes.Models
 14{
 15    public partial class WebApiSkill : IUtf8JsonSerializable
 16    {
 17        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 18        {
 019            writer.WriteStartObject();
 020            writer.WritePropertyName("uri");
 021            writer.WriteStringValue(Uri);
 022            if (Optional.IsCollectionDefined(HttpHeaders))
 23            {
 024                writer.WritePropertyName("httpHeaders");
 025                writer.WriteStartObject();
 026                foreach (var item in HttpHeaders)
 27                {
 028                    writer.WritePropertyName(item.Key);
 029                    writer.WriteStringValue(item.Value);
 30                }
 031                writer.WriteEndObject();
 32            }
 033            if (Optional.IsDefined(HttpMethod))
 34            {
 035                writer.WritePropertyName("httpMethod");
 036                writer.WriteStringValue(HttpMethod);
 37            }
 038            if (Optional.IsDefined(Timeout))
 39            {
 040                writer.WritePropertyName("timeout");
 041                writer.WriteStringValue(Timeout.Value, "P");
 42            }
 043            if (Optional.IsDefined(BatchSize))
 44            {
 045                if (BatchSize != null)
 46                {
 047                    writer.WritePropertyName("batchSize");
 048                    writer.WriteNumberValue(BatchSize.Value);
 49                }
 50                else
 51                {
 052                    writer.WriteNull("batchSize");
 53                }
 54            }
 055            if (Optional.IsDefined(DegreeOfParallelism))
 56            {
 057                if (DegreeOfParallelism != null)
 58                {
 059                    writer.WritePropertyName("degreeOfParallelism");
 060                    writer.WriteNumberValue(DegreeOfParallelism.Value);
 61                }
 62                else
 63                {
 064                    writer.WriteNull("degreeOfParallelism");
 65                }
 66            }
 067            writer.WritePropertyName("@odata.type");
 068            writer.WriteStringValue(ODataType);
 069            if (Optional.IsDefined(Name))
 70            {
 071                writer.WritePropertyName("name");
 072                writer.WriteStringValue(Name);
 73            }
 074            if (Optional.IsDefined(Description))
 75            {
 076                writer.WritePropertyName("description");
 077                writer.WriteStringValue(Description);
 78            }
 079            if (Optional.IsDefined(Context))
 80            {
 081                writer.WritePropertyName("context");
 082                writer.WriteStringValue(Context);
 83            }
 084            writer.WritePropertyName("inputs");
 085            writer.WriteStartArray();
 086            foreach (var item in Inputs)
 87            {
 088                writer.WriteObjectValue(item);
 89            }
 090            writer.WriteEndArray();
 091            writer.WritePropertyName("outputs");
 092            writer.WriteStartArray();
 093            foreach (var item in Outputs)
 94            {
 095                writer.WriteObjectValue(item);
 96            }
 097            writer.WriteEndArray();
 098            writer.WriteEndObject();
 099        }
 100
 101        internal static WebApiSkill DeserializeWebApiSkill(JsonElement element)
 102        {
 0103            string uri = default;
 0104            Optional<IDictionary<string, string>> httpHeaders = default;
 0105            Optional<string> httpMethod = default;
 0106            Optional<TimeSpan> timeout = default;
 0107            Optional<int?> batchSize = default;
 0108            Optional<int?> degreeOfParallelism = default;
 0109            string odataType = default;
 0110            Optional<string> name = default;
 0111            Optional<string> description = default;
 0112            Optional<string> context = default;
 0113            IList<InputFieldMappingEntry> inputs = default;
 0114            IList<OutputFieldMappingEntry> outputs = default;
 0115            foreach (var property in element.EnumerateObject())
 116            {
 0117                if (property.NameEquals("uri"))
 118                {
 0119                    uri = property.Value.GetString();
 0120                    continue;
 121                }
 0122                if (property.NameEquals("httpHeaders"))
 123                {
 0124                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0125                    foreach (var property0 in property.Value.EnumerateObject())
 126                    {
 0127                        dictionary.Add(property0.Name, property0.Value.GetString());
 128                    }
 0129                    httpHeaders = dictionary;
 0130                    continue;
 131                }
 0132                if (property.NameEquals("httpMethod"))
 133                {
 0134                    httpMethod = property.Value.GetString();
 0135                    continue;
 136                }
 0137                if (property.NameEquals("timeout"))
 138                {
 0139                    timeout = property.Value.GetTimeSpan("P");
 0140                    continue;
 141                }
 0142                if (property.NameEquals("batchSize"))
 143                {
 0144                    if (property.Value.ValueKind == JsonValueKind.Null)
 145                    {
 0146                        batchSize = null;
 0147                        continue;
 148                    }
 0149                    batchSize = property.Value.GetInt32();
 0150                    continue;
 151                }
 0152                if (property.NameEquals("degreeOfParallelism"))
 153                {
 0154                    if (property.Value.ValueKind == JsonValueKind.Null)
 155                    {
 0156                        degreeOfParallelism = null;
 0157                        continue;
 158                    }
 0159                    degreeOfParallelism = property.Value.GetInt32();
 0160                    continue;
 161                }
 0162                if (property.NameEquals("@odata.type"))
 163                {
 0164                    odataType = property.Value.GetString();
 0165                    continue;
 166                }
 0167                if (property.NameEquals("name"))
 168                {
 0169                    name = property.Value.GetString();
 0170                    continue;
 171                }
 0172                if (property.NameEquals("description"))
 173                {
 0174                    description = property.Value.GetString();
 0175                    continue;
 176                }
 0177                if (property.NameEquals("context"))
 178                {
 0179                    context = property.Value.GetString();
 0180                    continue;
 181                }
 0182                if (property.NameEquals("inputs"))
 183                {
 0184                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 0185                    foreach (var item in property.Value.EnumerateArray())
 186                    {
 0187                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 188                    }
 0189                    inputs = array;
 0190                    continue;
 191                }
 0192                if (property.NameEquals("outputs"))
 193                {
 0194                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 0195                    foreach (var item in property.Value.EnumerateArray())
 196                    {
 0197                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 198                    }
 0199                    outputs = array;
 200                    continue;
 201                }
 202            }
 0203            return new WebApiSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, uri, Option
 204        }
 205    }
 206}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\WebApiSkill.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public partial class WebApiSkill
 10    {
 11        /// <summary> The headers required to make the http request. </summary>
 012        public IDictionary<string, string> HttpHeaders { get; }
 13    }
 14}