/
WebApiSkill.cs
135 lines (124 loc) · 5.5 KB
/
WebApiSkill.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.Search.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// A skill that can call a Web API endpoint, allowing you to extend a
/// skillset by having it call your custom code.
/// <see
/// href="https://docs.microsoft.com/azure/search/cognitive-search-custom-skill-web-api"
/// />
/// </summary>
[Newtonsoft.Json.JsonObject("#Microsoft.Skills.Custom.WebApiSkill")]
public partial class WebApiSkill : Skill
{
/// <summary>
/// Initializes a new instance of the WebApiSkill class.
/// </summary>
public WebApiSkill()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the WebApiSkill class.
/// </summary>
/// <param name="inputs">Inputs of the skills could be a column in the
/// source data set, or the output of an upstream skill.</param>
/// <param name="outputs">The output of a skill is either a field in a
/// search index, or a value that can be consumed as an input by
/// another skill.</param>
/// <param name="uri">The url for the Web API.</param>
/// <param name="name">The name of the skill which uniquely identifies
/// it within the skillset. A skill with no name defined will be given
/// a default name of its 1-based index in the skills array, prefixed
/// with the character '#'.</param>
/// <param name="description">The description of the skill which
/// describes the inputs, outputs, and usage of the skill.</param>
/// <param name="context">Represents the level at which operations take
/// place, such as the document root or document content (for example,
/// /document or /document/content). The default is /document.</param>
/// <param name="httpHeaders">The headers required to make the http
/// request.</param>
/// <param name="httpMethod">The method for the http request.</param>
/// <param name="timeout">The desired timeout for the request. Default
/// is 30 seconds.</param>
/// <param name="batchSize">The desired batch size which indicates
/// number of documents.</param>
/// <param name="degreeOfParallelism">If set, the number of parallel
/// calls that can be made to the Web API.</param>
public WebApiSkill(IList<InputFieldMappingEntry> inputs, IList<OutputFieldMappingEntry> outputs, string uri, string name = default(string), string description = default(string), string context = default(string), IDictionary<string, string> httpHeaders = default(IDictionary<string, string>), string httpMethod = default(string), System.TimeSpan? timeout = default(System.TimeSpan?), int? batchSize = default(int?), int? degreeOfParallelism = default(int?))
: base(inputs, outputs, name, description, context)
{
Uri = uri;
HttpHeaders = httpHeaders;
HttpMethod = httpMethod;
Timeout = timeout;
BatchSize = batchSize;
DegreeOfParallelism = degreeOfParallelism;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the url for the Web API.
/// </summary>
[JsonProperty(PropertyName = "uri")]
public string Uri { get; set; }
/// <summary>
/// Gets or sets the headers required to make the http request.
/// </summary>
[JsonProperty(PropertyName = "httpHeaders")]
public IDictionary<string, string> HttpHeaders { get; set; }
/// <summary>
/// Gets or sets the method for the http request.
/// </summary>
[JsonProperty(PropertyName = "httpMethod")]
public string HttpMethod { get; set; }
/// <summary>
/// Gets or sets the desired timeout for the request. Default is 30
/// seconds.
/// </summary>
[JsonProperty(PropertyName = "timeout")]
public System.TimeSpan? Timeout { get; set; }
/// <summary>
/// Gets or sets the desired batch size which indicates number of
/// documents.
/// </summary>
[JsonProperty(PropertyName = "batchSize")]
public int? BatchSize { get; set; }
/// <summary>
/// Gets or sets if set, the number of parallel calls that can be made
/// to the Web API.
/// </summary>
[JsonProperty(PropertyName = "degreeOfParallelism")]
public int? DegreeOfParallelism { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Uri == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Uri");
}
}
}
}