| | 1 | | // <auto-generated> |
| | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | 4 | | // license information. |
| | 5 | | // |
| | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 8 | | // regenerated. |
| | 9 | | // </auto-generated> |
| | 10 | |
|
| | 11 | | namespace Microsoft.Azure.CognitiveServices.Knowledge.QnAMaker |
| | 12 | | { |
| | 13 | | using Models; |
| | 14 | | using System.Threading; |
| | 15 | | using System.Threading.Tasks; |
| | 16 | |
|
| | 17 | | /// <summary> |
| | 18 | | /// Extension methods for Knowledgebase. |
| | 19 | | /// </summary> |
| | 20 | | public static partial class KnowledgebaseExtensions |
| | 21 | | { |
| | 22 | | /// <summary> |
| | 23 | | /// Gets all knowledgebases for a user. |
| | 24 | | /// </summary> |
| | 25 | | /// <param name='operations'> |
| | 26 | | /// The operations group for this extension method. |
| | 27 | | /// </param> |
| | 28 | | /// <param name='cancellationToken'> |
| | 29 | | /// The cancellation token. |
| | 30 | | /// </param> |
| | 31 | | public static async Task<KnowledgebasesDTO> ListAllAsync(this IKnowledgebase operations, CancellationToken c |
| | 32 | | { |
| 0 | 33 | | using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwa |
| | 34 | | { |
| 0 | 35 | | return _result.Body; |
| | 36 | | } |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Gets details of a specific knowledgebase. |
| | 41 | | /// </summary> |
| | 42 | | /// <param name='operations'> |
| | 43 | | /// The operations group for this extension method. |
| | 44 | | /// </param> |
| | 45 | | /// <param name='kbId'> |
| | 46 | | /// Knowledgebase id. |
| | 47 | | /// </param> |
| | 48 | | /// <param name='cancellationToken'> |
| | 49 | | /// The cancellation token. |
| | 50 | | /// </param> |
| | 51 | | public static async Task<KnowledgebaseDTO> GetDetailsAsync(this IKnowledgebase operations, string kbId, Canc |
| | 52 | | { |
| 0 | 53 | | using (var _result = await operations.GetDetailsWithHttpMessagesAsync(kbId, null, cancellationToken).Con |
| | 54 | | { |
| 0 | 55 | | return _result.Body; |
| | 56 | | } |
| 0 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> |
| | 60 | | /// Deletes the knowledgebase and all its data. |
| | 61 | | /// </summary> |
| | 62 | | /// <param name='operations'> |
| | 63 | | /// The operations group for this extension method. |
| | 64 | | /// </param> |
| | 65 | | /// <param name='kbId'> |
| | 66 | | /// Knowledgebase id. |
| | 67 | | /// </param> |
| | 68 | | /// <param name='cancellationToken'> |
| | 69 | | /// The cancellation token. |
| | 70 | | /// </param> |
| | 71 | | public static async Task DeleteAsync(this IKnowledgebase operations, string kbId, CancellationToken cancella |
| | 72 | | { |
| 0 | 73 | | (await operations.DeleteWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Disp |
| 0 | 74 | | } |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Publishes all changes in test index of a knowledgebase to its prod index. |
| | 78 | | /// </summary> |
| | 79 | | /// <param name='operations'> |
| | 80 | | /// The operations group for this extension method. |
| | 81 | | /// </param> |
| | 82 | | /// <param name='kbId'> |
| | 83 | | /// Knowledgebase id. |
| | 84 | | /// </param> |
| | 85 | | /// <param name='cancellationToken'> |
| | 86 | | /// The cancellation token. |
| | 87 | | /// </param> |
| | 88 | | public static async Task PublishAsync(this IKnowledgebase operations, string kbId, CancellationToken cancell |
| | 89 | | { |
| 0 | 90 | | (await operations.PublishWithHttpMessagesAsync(kbId, null, cancellationToken).ConfigureAwait(false)).Dis |
| 0 | 91 | | } |
| | 92 | |
|
| | 93 | | /// <summary> |
| | 94 | | /// Replace knowledgebase contents. |
| | 95 | | /// </summary> |
| | 96 | | /// <param name='operations'> |
| | 97 | | /// The operations group for this extension method. |
| | 98 | | /// </param> |
| | 99 | | /// <param name='kbId'> |
| | 100 | | /// Knowledgebase id. |
| | 101 | | /// </param> |
| | 102 | | /// <param name='replaceKb'> |
| | 103 | | /// An instance of ReplaceKbDTO which contains list of qnas to be uploaded |
| | 104 | | /// </param> |
| | 105 | | /// <param name='cancellationToken'> |
| | 106 | | /// The cancellation token. |
| | 107 | | /// </param> |
| | 108 | | public static async Task ReplaceAsync(this IKnowledgebase operations, string kbId, ReplaceKbDTO replaceKb, C |
| | 109 | | { |
| 0 | 110 | | (await operations.ReplaceWithHttpMessagesAsync(kbId, replaceKb, null, cancellationToken).ConfigureAwait( |
| 0 | 111 | | } |
| | 112 | |
|
| | 113 | | /// <summary> |
| | 114 | | /// Asynchronous operation to modify a knowledgebase. |
| | 115 | | /// </summary> |
| | 116 | | /// <param name='operations'> |
| | 117 | | /// The operations group for this extension method. |
| | 118 | | /// </param> |
| | 119 | | /// <param name='kbId'> |
| | 120 | | /// Knowledgebase id. |
| | 121 | | /// </param> |
| | 122 | | /// <param name='updateKb'> |
| | 123 | | /// Post body of the request. |
| | 124 | | /// </param> |
| | 125 | | /// <param name='cancellationToken'> |
| | 126 | | /// The cancellation token. |
| | 127 | | /// </param> |
| | 128 | | public static async Task<Operation> UpdateAsync(this IKnowledgebase operations, string kbId, UpdateKbOperati |
| | 129 | | { |
| 0 | 130 | | using (var _result = await operations.UpdateWithHttpMessagesAsync(kbId, updateKb, null, cancellationToke |
| | 131 | | { |
| 0 | 132 | | return _result.Body; |
| | 133 | | } |
| 0 | 134 | | } |
| | 135 | |
|
| | 136 | | /// <summary> |
| | 137 | | /// Asynchronous operation to create a new knowledgebase. |
| | 138 | | /// </summary> |
| | 139 | | /// <param name='operations'> |
| | 140 | | /// The operations group for this extension method. |
| | 141 | | /// </param> |
| | 142 | | /// <param name='createKbPayload'> |
| | 143 | | /// Post body of the request. |
| | 144 | | /// </param> |
| | 145 | | /// <param name='cancellationToken'> |
| | 146 | | /// The cancellation token. |
| | 147 | | /// </param> |
| | 148 | | public static async Task<Operation> CreateAsync(this IKnowledgebase operations, CreateKbDTO createKbPayload, |
| | 149 | | { |
| 0 | 150 | | using (var _result = await operations.CreateWithHttpMessagesAsync(createKbPayload, null, cancellationTok |
| | 151 | | { |
| 0 | 152 | | return _result.Body; |
| | 153 | | } |
| 0 | 154 | | } |
| | 155 | |
|
| | 156 | | /// <summary> |
| | 157 | | /// Download the knowledgebase. |
| | 158 | | /// </summary> |
| | 159 | | /// <param name='operations'> |
| | 160 | | /// The operations group for this extension method. |
| | 161 | | /// </param> |
| | 162 | | /// <param name='kbId'> |
| | 163 | | /// Knowledgebase id. |
| | 164 | | /// </param> |
| | 165 | | /// <param name='environment'> |
| | 166 | | /// Specifies whether environment is Test or Prod. Possible values include: |
| | 167 | | /// 'Prod', 'Test' |
| | 168 | | /// </param> |
| | 169 | | /// <param name='cancellationToken'> |
| | 170 | | /// The cancellation token. |
| | 171 | | /// </param> |
| | 172 | | public static async Task<QnADocumentsDTO> DownloadAsync(this IKnowledgebase operations, string kbId, string |
| | 173 | | { |
| 0 | 174 | | using (var _result = await operations.DownloadWithHttpMessagesAsync(kbId, environment, null, cancellatio |
| | 175 | | { |
| 0 | 176 | | return _result.Body; |
| | 177 | | } |
| 0 | 178 | | } |
| | 179 | |
|
| | 180 | | } |
| | 181 | | } |