WebApiSkill.java

  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. //
  4. // Code generated by Microsoft (R) AutoRest Code Generator.
  5. // Changes may cause incorrect behavior and will be lost if the code is
  6. // regenerated.
  7. package com.azure.search.documents.indexes.models;

  8. import com.azure.core.annotation.Fluent;
  9. import com.fasterxml.jackson.annotation.JsonCreator;
  10. import com.fasterxml.jackson.annotation.JsonProperty;
  11. import com.fasterxml.jackson.annotation.JsonTypeId;
  12. import com.fasterxml.jackson.annotation.JsonTypeInfo;
  13. import com.fasterxml.jackson.annotation.JsonTypeName;
  14. import java.time.Duration;
  15. import java.util.List;
  16. import java.util.Map;

  17. /** A skill that can call a Web API endpoint, allowing you to extend a skillset by having it call your custom code. */
  18. @JsonTypeInfo(
  19.         use = JsonTypeInfo.Id.NAME,
  20.         include = JsonTypeInfo.As.EXISTING_PROPERTY,
  21.         property = "@odata.type",
  22.         visible = true)
  23. @JsonTypeName("#Microsoft.Skills.Custom.WebApiSkill")
  24. @Fluent
  25. public final class WebApiSkill extends SearchIndexerSkill {

  26.     /*
  27.      * Identifies the concrete type of the skill.
  28.      */
  29.     @JsonTypeId
  30.     @JsonProperty(value = "@odata.type", required = true)
  31.     private String odataType = "#Microsoft.Skills.Custom.WebApiSkill";

  32.     /*
  33.      * The url for the Web API.
  34.      */
  35.     @JsonProperty(value = "uri", required = true)
  36.     private String uri;

  37.     /*
  38.      * The headers required to make the http request.
  39.      */
  40.     @JsonProperty(value = "httpHeaders")
  41.     private Map<String, String> httpHeaders;

  42.     /*
  43.      * The method for the http request.
  44.      */
  45.     @JsonProperty(value = "httpMethod")
  46.     private String httpMethod;

  47.     /*
  48.      * The desired timeout for the request. Default is 30 seconds.
  49.      */
  50.     @JsonProperty(value = "timeout")
  51.     private Duration timeout;

  52.     /*
  53.      * The desired batch size which indicates number of documents.
  54.      */
  55.     @JsonProperty(value = "batchSize")
  56.     private Integer batchSize;

  57.     /*
  58.      * If set, the number of parallel calls that can be made to the Web API.
  59.      */
  60.     @JsonProperty(value = "degreeOfParallelism")
  61.     private Integer degreeOfParallelism;

  62.     /**
  63.      * Creates an instance of WebApiSkill class.
  64.      *
  65.      * @param inputs the inputs value to set.
  66.      * @param outputs the outputs value to set.
  67.      * @param uri the uri value to set.
  68.      */
  69.     @JsonCreator
  70.     public WebApiSkill(
  71.             @JsonProperty(value = "inputs", required = true) List<InputFieldMappingEntry> inputs,
  72.             @JsonProperty(value = "outputs", required = true) List<OutputFieldMappingEntry> outputs,
  73.             @JsonProperty(value = "uri", required = true) String uri) {
  74.         super(inputs, outputs);
  75.         this.uri = uri;
  76.     }

  77.     /**
  78.      * Get the uri property: The url for the Web API.
  79.      *
  80.      * @return the uri value.
  81.      */
  82.     public String getUri() {
  83.         return this.uri;
  84.     }

  85.     /**
  86.      * Get the httpHeaders property: The headers required to make the http request.
  87.      *
  88.      * @return the httpHeaders value.
  89.      */
  90.     public Map<String, String> getHttpHeaders() {
  91.         return this.httpHeaders;
  92.     }

  93.     /**
  94.      * Set the httpHeaders property: The headers required to make the http request.
  95.      *
  96.      * @param httpHeaders the httpHeaders value to set.
  97.      * @return the WebApiSkill object itself.
  98.      */
  99.     public WebApiSkill setHttpHeaders(Map<String, String> httpHeaders) {
  100.         this.httpHeaders = httpHeaders;
  101.         return this;
  102.     }

  103.     /**
  104.      * Get the httpMethod property: The method for the http request.
  105.      *
  106.      * @return the httpMethod value.
  107.      */
  108.     public String getHttpMethod() {
  109.         return this.httpMethod;
  110.     }

  111.     /**
  112.      * Set the httpMethod property: The method for the http request.
  113.      *
  114.      * @param httpMethod the httpMethod value to set.
  115.      * @return the WebApiSkill object itself.
  116.      */
  117.     public WebApiSkill setHttpMethod(String httpMethod) {
  118.         this.httpMethod = httpMethod;
  119.         return this;
  120.     }

  121.     /**
  122.      * Get the timeout property: The desired timeout for the request. Default is 30 seconds.
  123.      *
  124.      * @return the timeout value.
  125.      */
  126.     public Duration getTimeout() {
  127.         return this.timeout;
  128.     }

  129.     /**
  130.      * Set the timeout property: The desired timeout for the request. Default is 30 seconds.
  131.      *
  132.      * @param timeout the timeout value to set.
  133.      * @return the WebApiSkill object itself.
  134.      */
  135.     public WebApiSkill setTimeout(Duration timeout) {
  136.         this.timeout = timeout;
  137.         return this;
  138.     }

  139.     /**
  140.      * Get the batchSize property: The desired batch size which indicates number of documents.
  141.      *
  142.      * @return the batchSize value.
  143.      */
  144.     public Integer getBatchSize() {
  145.         return this.batchSize;
  146.     }

  147.     /**
  148.      * Set the batchSize property: The desired batch size which indicates number of documents.
  149.      *
  150.      * @param batchSize the batchSize value to set.
  151.      * @return the WebApiSkill object itself.
  152.      */
  153.     public WebApiSkill setBatchSize(Integer batchSize) {
  154.         this.batchSize = batchSize;
  155.         return this;
  156.     }

  157.     /**
  158.      * Get the degreeOfParallelism property: If set, the number of parallel calls that can be made to the Web API.
  159.      *
  160.      * @return the degreeOfParallelism value.
  161.      */
  162.     public Integer getDegreeOfParallelism() {
  163.         return this.degreeOfParallelism;
  164.     }

  165.     /**
  166.      * Set the degreeOfParallelism property: If set, the number of parallel calls that can be made to the Web API.
  167.      *
  168.      * @param degreeOfParallelism the degreeOfParallelism value to set.
  169.      * @return the WebApiSkill object itself.
  170.      */
  171.     public WebApiSkill setDegreeOfParallelism(Integer degreeOfParallelism) {
  172.         this.degreeOfParallelism = degreeOfParallelism;
  173.         return this;
  174.     }
  175. }