Skip to content

Commit

Permalink
AutoPr-QnAMaker-bingisbestest-REST Spec PrNumber 5738 (#5909)
Browse files Browse the repository at this point in the history
* .NET SDK Resource Provider:'QnAMaker'
REST Spec PR 'Azure/azure-rest-api-specs#5738'
REST Spec PR Author 'bingisbestest'
REST Spec PR Last commit

* .NET SDK Resource Provider:'QnAMaker'
REST Spec PR 'Azure/azure-rest-api-specs#5738'
REST Spec PR Author 'bingisbestest'
REST Spec PR Last commit
  • Loading branch information
adxsdknet authored and dsgouda committed Apr 24, 2019
1 parent f6e25c7 commit 93bccfb
Show file tree
Hide file tree
Showing 11 changed files with 487 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// <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.CognitiveServices.Knowledge.QnAMaker.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Context associated with Qna.
/// </summary>
public partial class ContextDTO
{
/// <summary>
/// Initializes a new instance of the ContextDTO class.
/// </summary>
public ContextDTO()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the ContextDTO class.
/// </summary>
/// <param name="isContextOnly">To mark if a prompt is relevant only
/// with a previous question or not.
/// true - Do not include this QnA as search result for queries without
/// context
/// false - ignores context and includes this QnA in search
/// result</param>
/// <param name="prompts">List of prompts associated with the
/// answer.</param>
public ContextDTO(bool? isContextOnly = default(bool?), IList<PromptDTO> prompts = default(IList<PromptDTO>))
{
IsContextOnly = isContextOnly;
Prompts = prompts;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets to mark if a prompt is relevant only with a previous
/// question or not.
/// true - Do not include this QnA as search result for queries without
/// context
/// false - ignores context and includes this QnA in search result
/// </summary>
[JsonProperty(PropertyName = "isContextOnly")]
public bool? IsContextOnly { get; set; }

/// <summary>
/// Gets or sets list of prompts associated with the answer.
/// </summary>
[JsonProperty(PropertyName = "prompts")]
public IList<PromptDTO> Prompts { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Prompts != null)
{
if (Prompts.Count > 20)
{
throw new ValidationException(ValidationRules.MaxItems, "Prompts", 20);
}
foreach (var element in Prompts)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// <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.CognitiveServices.Knowledge.QnAMaker.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// Prompt for an answer.
/// </summary>
public partial class PromptDTO
{
/// <summary>
/// Initializes a new instance of the PromptDTO class.
/// </summary>
public PromptDTO()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the PromptDTO class.
/// </summary>
/// <param name="displayOrder">Index of the prompt - used in ordering
/// of the prompts</param>
/// <param name="qnaId">Qna id corresponding to the prompt - if QnaId
/// is present, QnADTO object is ignored.</param>
/// <param name="qna">QnADTO - Either QnaId or QnADTO needs to be
/// present in a PromptDTO object</param>
/// <param name="displayText">Text displayed to represent a follow up
/// question prompt</param>
public PromptDTO(int? displayOrder = default(int?), int? qnaId = default(int?), PromptDTOQna qna = default(PromptDTOQna), string displayText = default(string))
{
DisplayOrder = displayOrder;
QnaId = qnaId;
Qna = qna;
DisplayText = displayText;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets index of the prompt - used in ordering of the prompts
/// </summary>
[JsonProperty(PropertyName = "displayOrder")]
public int? DisplayOrder { get; set; }

/// <summary>
/// Gets or sets qna id corresponding to the prompt - if QnaId is
/// present, QnADTO object is ignored.
/// </summary>
[JsonProperty(PropertyName = "qnaId")]
public int? QnaId { get; set; }

/// <summary>
/// Gets or sets qnADTO - Either QnaId or QnADTO needs to be present in
/// a PromptDTO object
/// </summary>
[JsonProperty(PropertyName = "qna")]
public PromptDTOQna Qna { get; set; }

/// <summary>
/// Gets or sets text displayed to represent a follow up question
/// prompt
/// </summary>
[JsonProperty(PropertyName = "displayText")]
public string DisplayText { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Qna != null)
{
Qna.Validate();
}
if (DisplayText != null)
{
if (DisplayText.Length > 200)
{
throw new ValidationException(ValidationRules.MaxLength, "DisplayText", 200);
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// <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.CognitiveServices.Knowledge.QnAMaker.Models
{
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// QnADTO - Either QnaId or QnADTO needs to be present in a PromptDTO
/// object
/// </summary>
public partial class PromptDTOQna : QnADTO
{
/// <summary>
/// Initializes a new instance of the PromptDTOQna class.
/// </summary>
public PromptDTOQna()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the PromptDTOQna class.
/// </summary>
/// <param name="answer">Answer text</param>
/// <param name="questions">List of questions associated with the
/// answer.</param>
/// <param name="id">Unique id for the Q-A.</param>
/// <param name="source">Source from which Q-A was indexed. eg.
/// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs</param>
/// <param name="metadata">List of metadata associated with the
/// answer.</param>
/// <param name="context">Context of a QnA</param>
public PromptDTOQna(string answer, IList<string> questions, int? id = default(int?), string source = default(string), IList<MetadataDTO> metadata = default(IList<MetadataDTO>), QnADTOContext context = default(QnADTOContext))
: base(answer, questions, id, source, metadata, context)
{
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public QnADTO()
/// https://docs.microsoft.com/en-us/azure/cognitive-services/QnAMaker/FAQs</param>
/// <param name="metadata">List of metadata associated with the
/// answer.</param>
public QnADTO(string answer, IList<string> questions, int? id = default(int?), string source = default(string), IList<MetadataDTO> metadata = default(IList<MetadataDTO>))
/// <param name="context">Context of a QnA</param>
public QnADTO(string answer, IList<string> questions, int? id = default(int?), string source = default(string), IList<MetadataDTO> metadata = default(IList<MetadataDTO>), QnADTOContext context = default(QnADTOContext))
{
Id = id;
Answer = answer;
Source = source;
Questions = questions;
Metadata = metadata;
Context = context;
CustomInit();
}

Expand Down Expand Up @@ -86,6 +88,12 @@ public QnADTO()
[JsonProperty(PropertyName = "metadata")]
public IList<MetadataDTO> Metadata { get; set; }

/// <summary>
/// Gets or sets context of a QnA
/// </summary>
[JsonProperty(PropertyName = "context")]
public QnADTOContext Context { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
Expand Down Expand Up @@ -130,6 +138,10 @@ public virtual void Validate()
}
}
}
if (Context != null)
{
Context.Validate();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// <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.CognitiveServices.Knowledge.QnAMaker.Models
{
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Context of a QnA
/// </summary>
public partial class QnADTOContext : ContextDTO
{
/// <summary>
/// Initializes a new instance of the QnADTOContext class.
/// </summary>
public QnADTOContext()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the QnADTOContext class.
/// </summary>
/// <param name="isContextOnly">To mark if a prompt is relevant only
/// with a previous question or not.
/// true - Do not include this QnA as search result for queries without
/// context
/// false - ignores context and includes this QnA in search
/// result</param>
/// <param name="prompts">List of prompts associated with the
/// answer.</param>
public QnADTOContext(bool? isContextOnly = default(bool?), IList<PromptDTO> prompts = default(IList<PromptDTO>))
: base(isContextOnly, prompts)
{
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}
Loading

0 comments on commit 93bccfb

Please sign in to comment.